Documentation ¶
Index ¶
- func CloseConn(rc *RedisClient) error
- type RedisClient
- func (rc *RedisClient) DeleteSession(token string) (string, error)
- func (rc *RedisClient) InsertUser(username string) error
- func (rc *RedisClient) RetreiveAllUsers() ([]string, error)
- func (rc *RedisClient) RetreiveSession(token string) (string, error)
- func (rc *RedisClient) SaveSession(username string) (string, error)
- func (rc *RedisClient) SaveUsers(usernameArr *[]string) error
- func (rc *RedisClient) SetCookie(w http.ResponseWriter, token string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient represents the Redis client
func StartRedis ¶
func StartRedis(redisAddr string, pass string) (*RedisClient, error)
StartRedis start the connection to redis and return the client
func (*RedisClient) DeleteSession ¶
func (rc *RedisClient) DeleteSession(token string) (string, error)
DeleteSession delete the session from Redis
func (*RedisClient) InsertUser ¶
func (rc *RedisClient) InsertUser(username string) error
InsertUser insert new username into users list
func (*RedisClient) RetreiveAllUsers ¶
func (rc *RedisClient) RetreiveAllUsers() ([]string, error)
RetreiveAllUsers retreive all users from redis user list
func (*RedisClient) RetreiveSession ¶
func (rc *RedisClient) RetreiveSession(token string) (string, error)
RetreiveSession retreive user from token
func (*RedisClient) SaveSession ¶
func (rc *RedisClient) SaveSession(username string) (string, error)
SaveSession save current session in Redis
func (*RedisClient) SaveUsers ¶
func (rc *RedisClient) SaveUsers(usernameArr *[]string) error
SaveUsers save users to Redis
func (*RedisClient) SetCookie ¶
func (rc *RedisClient) SetCookie(w http.ResponseWriter, token string)
SetCookie set cookie for client
Click to show internal directories.
Click to hide internal directories.