db

package
v0.0.0-...-d73b14a Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Const = struct {
	SessionState     string
	SessionUsers     string
	SessionObservers string
	User             string
	VoteCount        string
	Tally            string
}{
	"ballot:session:%s:voting",
	"ballot:session:%s:users",
	"ballot:session:%s:observers",
	"ballot:user:%s",
	"ballot:session:%s:vote_count",
	"ballot:session:%s:tally",
}

Functions

func NewPool

func NewPool(server string) *redis.Pool

Types

type Store

type Store struct {
	Pool          *redis.Pool
	SubConn       redis.PubSubConn
	ServiceSubCon redis.PubSubConn
	// contains filtered or unexported fields
}

func (*Store) AddToSet

func (p *Store) AddToSet(key string, args ...interface{}) error

func (*Store) Close

func (p *Store) Close(c redis.Conn)

func (*Store) Decr

func (p *Store) Decr(key string, num uint8) error

func (*Store) Del

func (p *Store) Del(key string) error

func (*Store) DelHashKey

func (p *Store) DelHashKey(field string) error

func (*Store) ExpireKey

func (p *Store) ExpireKey(key string) error

func (*Store) GetHashKey

func (p *Store) GetHashKey(key string, field string) (string, error)

func (*Store) GetInt

func (p *Store) GetInt(key string) (int, error)

func (*Store) GetSessionObserverIds

func (p *Store) GetSessionObserverIds(sessionId string) ([]string, error)

func (*Store) GetSessionObservers

func (p *Store) GetSessionObservers(sessionId string) ([]model.User, error)

func (*Store) GetSessionVoterIds

func (p *Store) GetSessionVoterIds(sessionId string) ([]string, error)

func (*Store) GetSessionVoters

func (p *Store) GetSessionVoters(sessionId string) ([]model.User, error)

func (*Store) GetSetLength

func (p *Store) GetSetLength(key string) (int, error)

func (*Store) GetStr

func (p *Store) GetStr(key string) (string, error)

func (*Store) GetUser

func (p *Store) GetUser(userId string) (model.User, error)

func (*Store) GetUsers

func (p *Store) GetUsers(sessionId string, isObserver bool) ([]model.User, error)

func (*Store) Incr

func (p *Store) Incr(key string, num uint8) error

func (*Store) RemoveFromSet

func (p *Store) RemoveFromSet(key string, val string) error

func (*Store) Set

func (p *Store) Set(key string, val interface{}) error

func (*Store) SetHashKey

func (p *Store) SetHashKey(key string, args ...interface{}) error

Jump to

Keyboard shortcuts

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