Documentation ¶
Index ¶
- Variables
- type Base
- func (db *Base) Client() Client
- func (db *Base) DecrBy(key string, num int) Result
- func (db *Base) Delete(key string) Result
- func (db *Base) Do(cmd string, args ...interface{}) Result
- func (db *Base) Exists(key string) Result
- func (db *Base) Expire(key string, seconds interface{}) Result
- func (db *Base) Get(key string) Result
- func (db *Base) HGet(key string, hKey string) Result
- func (db *Base) HSet(key string, hKey string, value interface{}) Result
- func (db *Base) IncrBy(key string, num int) Result
- func (db *Base) Key(key string) string
- func (db *Base) LPop(key string) Result
- func (db *Base) LPush(key string, val interface{}) Result
- func (db *Base) LRange(key string, start int, end int) Result
- func (db *Base) Name() string
- func (db *Base) Pipe(method func(c Conn) error) (result Result)
- func (db *Base) RPop(key string) Result
- func (db *Base) RPush(key string, val interface{}) Result
- func (db *Base) SMembers(key string) Result
- func (db *Base) Set(key string, val interface{}) Result
- func (db *Base) SetIfNotExists(key string, val interface{}) Result
- func (db *Base) SetWithExpire(key string, val interface{}, seconds interface{}) Result
- type Client
- type Config
- type Conn
- type Model
- type Option
- func WithAddr(addr string) Option
- func WithClientName(clientName string) Option
- func WithDatabase(database int) Option
- func WithIdleTimeout(idleTimeout time.Duration) Option
- func WithMaxActive(maxActive int) Option
- func WithMaxConnLifetime(maxConnLifetime time.Duration) Option
- func WithMaxIdle(maxIdle int) Option
- func WithPassword(password string) Option
- func WithUsername(username string) Option
- func WithWait(wait bool) Option
- type Result
- func (result Result) Bool() bool
- func (result Result) ByteSlices() [][]byte
- func (result Result) Bytes() []byte
- func (result Result) Error() error
- func (result Result) Float64() float64
- func (result Result) Float64s() []float64
- func (result Result) Int() int
- func (result Result) Int64() int64
- func (result Result) Int64Map() map[string]int64
- func (result Result) Int64s() []int64
- func (result Result) IntMap() map[string]int
- func (result Result) Ints() []int
- func (result Result) Positions() []*[2]float64
- func (result Result) Reply() interface{}
- func (result Result) SlowLogs() []redis.SlowLog
- func (result Result) String() string
- func (result Result) StringMap() map[string]string
- func (result Result) Strings() []string
- func (result Result) Uint64() uint64
- func (result Result) Uint64Map() map[string]uint64
- func (result Result) Uint64s() []uint64
- func (result Result) Value() interface{}
- func (result Result) Values() []interface{}
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNil = errors.New("redisc returned nil")
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func NewBaseModel ¶
func (*Base) SetIfNotExists ¶
func (*Base) SetWithExpire ¶
type Client ¶
type Client interface { GetConn() (conn redis.Conn) Close() Do(cmd string, args ...interface{}) Result }
func NewClientWithConfig ¶
type Config ¶
type Config struct { Addr string `mapstructure:"addr" json:"addr"` Username string `mapstructure:"username" json:"username"` Password string `mapstructure:"password" json:"password"` // Maximum number of idle connections in the pool. MaxIdle int `mapstructure:"max_idle" json:"max_idle"` // Maximum number of connections allocated by the pool at a given time. // When zero, there is no limit on the number of connections in the pool. MaxActive int `mapstructure:"max_active" json:"max_active"` // Close connections after remaining idle for this duration. If the value // is zero, then idle connections are not closed. Applications should set // the timeout to a value less than the server's timeout. IdleTimeout time.Duration `mapstructure:"idle_timeout" json:"idle_timeout"` // If Wait is true and the pool is at the MaxActive limit, then Get() waits // for a connection to be returned to the pool before returning. Wait bool `mapstructure:"wait" json:"wait"` // Close connections older than this duration. If the value is zero, then // the pool does not close connections based on age. MaxConnLifetime time.Duration `mapstructure:"max_conn_lifetime" json:"max_conn_lifetime"` // ClientName specifies a client name to be used by the Redis server connection. ClientName string `mapstructure:"client_name" json:"client_name"` Database int `mapstructure:"db" json:"db"` }
type Option ¶
type Option func(config *Config)
func WithClientName ¶
func WithDatabase ¶
func WithIdleTimeout ¶
func WithMaxActive ¶
func WithMaxConnLifetime ¶
func WithMaxIdle ¶
func WithPassword ¶
func WithUsername ¶
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (Result) ByteSlices ¶
Click to show internal directories.
Click to hide internal directories.