redis

package
v0.0.0-...-4405966 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pool *redis.Pool

Pool is the gloabl pool of Redis connections opened in main

Functions

func AddUserSession

func AddUserSession(userID int, sessionID string) error

AddUserSession adds userID to userid:<userID>:sessionids set

func AddUserStore

func AddUserStore(userID, storeID int) error

AddUserStore adds storeID to userid:<userID>:storeids set

func Delete

func Delete(key string) error

Delete deletes a key from a Redis DB

func DeleteAPIKeySecretKey

func DeleteAPIKeySecretKey(apiKey string) error

DeleteAPIKeySecretKey deletes key apikey:<apiKey>:secretkey

func DeleteAPIKeyStore

func DeleteAPIKeyStore(apiKey string) error

DeleteAPIKeyStore deletes key apikey:<apiKey>:storeid

func DeleteSession

func DeleteSession(sessionID string) error

DeleteSession deletes key sessionid:<sessionID>:userid

func DeleteStoreTitle

func DeleteStoreTitle(storeID int) error

DeleteStoreTitle deletes storeid:<storeid>:title key

func DeleteUserSessions

func DeleteUserSessions(userID int) error

DeleteUserSessions removes set userid:<userID>:sessionids

func Exists

func Exists(key string) (exists bool, err error)

Exists check if a key exists in a Redis DB

func Expire

func Expire(key string, ttl int) error

Expire sets the expiration of a key in a Redis DB

func FlushAll

func FlushAll() error

FlushAll deletes all the keys from a Redis DB

func GetAPIKeySecretKey

func GetAPIKeySecretKey(apiKey string) (secretKey string, err error)

GetAPIKeySecretKey returns the string value of apikey:<apiKey>:secretkey

func GetAPIKeyStore

func GetAPIKeyStore(apiKey string) (storeID int, err error)

GetAPIKeyStore returns the int value of apikey:<apiKey>:storeid

func GetInt

func GetInt(key string) (value int, err error)

GetInt gets the int value of a key from a Redis DB

func GetSessionUser

func GetSessionUser(sessionID string) (userID int, err error)

GetSessionUser returns the int value of key sessionid:<sessionID>:userid

func GetSetMembers

func GetSetMembers(key string) (members []string, err error)

GetSetMembers gets the members of a set from a Redis DB

func GetStoreTitle

func GetStoreTitle(storeID int) (title string, err error)

GetStoreTitle returns the string value of key storeid:<storeID>:title

func GetString

func GetString(key string) (value string, err error)

GetString gets the string value of a key from a Redis DB

func GetUserEmail

func GetUserEmail(userID int) (email string, err error)

GetUserEmail returns the string value of key userid:<userID>:email

func GetUserSessions

func GetUserSessions(userID int) (sessionIDs []string, err error)

GetUserSessions returns all the values of set userid:<userID>:sessionids

func GetUserStores

func GetUserStores(userID int) (storeIDs []int, err error)

GetUserStores returns all the values of set userid:<userID>:storeids

func GetUserUsername

func GetUserUsername(userID int) (username string, err error)

GetUserUsername returns the string value of key userid:<userID>:username

func IsSetMember

func IsSetMember(key string, member interface{}) (bool, error)

IsSetMember returns whether "member" is a member of the set "key" or not

func IsSupportedCurrency

func IsSupportedCurrency(currency string) (bool, error)

IsSupportedCurrency returns whether currency is a member of the supportedcurrencies set or not

func NewPool

func NewPool(address string) *redis.Pool

NewPool creates a new pool of Redis connections

func Ping

func Ping() error

Ping pings a Redis DB

func RemoveUserSession

func RemoveUserSession(userID int, sessionID string) error

RemoveUserSession removes sessionID from userid:<userID>:sessionids set

func RemoveUserStore

func RemoveUserStore(userID, storeID int) error

RemoveUserStore removes storeID from userid:<userID>:storeids set

func Set

func Set(key string, value interface{}) error

Set sets the value of a key in a Redis DB

func SetAPIKeySecretKey

func SetAPIKeySecretKey(apiKey, secretKey string) error

SetAPIKeySecretKey sets secretKey as the value of apikey:<apiKey>:secretkey

func SetAPIKeyStore

func SetAPIKeyStore(apiKey string, storeID int) error

SetAPIKeyStore sets storeID as the value of apikey:<apiKey>:storeid

func SetAddMember

func SetAddMember(key string, member interface{}) error

SetAddMember adds a member to a set in a Redis DB

func SetRemoveMember

func SetRemoveMember(key string, member interface{}) error

SetRemoveMember removes the member of a set from a Redis DB

func SetSessionExpiration

func SetSessionExpiration(sessionID string, ttl int) error

SetSessionExpiration sets key sessionid:<sessionID>:userid to expire after ttl seconds passed

func SetSessionUser

func SetSessionUser(sessionID string, userID int) error

SetSessionUser sets userID as the value of sessionid:<sessionID>:userid key

func SetStoreTitle

func SetStoreTitle(storeID int, title string) error

SetStoreTitle sets title as the value of storeid:<storeID>:title key

func SetSupportedCurrencies

func SetSupportedCurrencies(currencies []string) error

SetSupportedCurrencies adds all currencies to the supportedcurrencies set

func SetUserEmail

func SetUserEmail(userID int, email string) error

SetUserEmail sets email as the value of key userid:<userID>:email

func SetUserUsername

func SetUserUsername(userID int, username string) error

SetUserUsername sets username as the value of key userid:<userID>:username

func UserOwnsStore

func UserOwnsStore(userID, storeID int) (bool, error)

UserOwnsStore returns whether storeID is a member of userid:<userID>:storeids set or not

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL