redisc

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNil = errors.New("redisc returned nil")

Functions

This section is empty.

Types

type Base added in v1.3.4

type Base struct {
	// contains filtered or unexported fields
}

func NewBaseModel added in v1.3.4

func NewBaseModel(client Client, name string) *Base

func (*Base) Client added in v1.3.4

func (db *Base) Client() Client

func (*Base) DecrBy added in v1.3.4

func (db *Base) DecrBy(key string, num int) int

func (*Base) Delete added in v1.3.4

func (db *Base) Delete(key string) Result

func (*Base) Do added in v1.3.4

func (db *Base) Do(cmd string, args ...interface{}) Result

func (*Base) Exists added in v1.3.4

func (db *Base) Exists(key string) Result

func (*Base) Expire added in v1.3.4

func (db *Base) Expire(key string, seconds interface{}) Result

func (*Base) Get added in v1.3.4

func (db *Base) Get(key string) Result

func (*Base) HGet added in v1.3.4

func (db *Base) HGet(key string, hKey string) Result

func (*Base) HSet added in v1.3.4

func (db *Base) HSet(key string, hKey string, value interface{}) Result

func (*Base) IncrBy added in v1.3.4

func (db *Base) IncrBy(key string, num int) int

func (*Base) Key added in v1.3.4

func (db *Base) Key(key string) string

func (*Base) LPop added in v1.3.4

func (db *Base) LPop(key string) Result

func (*Base) LPush added in v1.3.4

func (db *Base) LPush(key string, val interface{}) Result

func (*Base) LRange added in v1.3.4

func (db *Base) LRange(key string, start int, end int) Result

func (*Base) Name added in v1.3.4

func (db *Base) Name() string

func (*Base) Pipe added in v1.3.4

func (db *Base) Pipe(method func(c Conn) error) (result Result)

func (*Base) RPop added in v1.3.4

func (db *Base) RPop(key string) Result

func (*Base) RPush added in v1.3.4

func (db *Base) RPush(key string, val interface{}) Result

func (*Base) SMembers added in v1.3.4

func (db *Base) SMembers(key string) Result

func (*Base) Set added in v1.3.4

func (db *Base) Set(key string, val interface{}) Result

func (*Base) SetIfNotExists added in v1.3.4

func (db *Base) SetIfNotExists(key string, val interface{}) bool

func (*Base) SetWithExpire added in v1.3.4

func (db *Base) SetWithExpire(key string, val interface{}, seconds interface{}) Result

type Client

type Client interface {
	GetConn() (conn redis.Conn)
	Close()
	Do(cmd string, args ...interface{}) Result
}

func NewClient

func NewClient(options ...Option) (Client, error)

func NewClientWithConfig added in v1.3.4

func NewClientWithConfig(config Config) (Client, error)

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:"database" json:"database"`
}

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func (Conn) Send

func (conn Conn) Send(command string, args ...interface{}) error

type Model added in v1.3.4

type Model interface {
	Name() string
}

type Option added in v1.3.4

type Option func(config *Config)

func WithAddr added in v1.3.4

func WithAddr(addr string) Option

func WithClientName added in v1.3.4

func WithClientName(clientName string) Option

func WithDatabase added in v1.3.4

func WithDatabase(database int) Option

func WithIdleTimeout added in v1.3.4

func WithIdleTimeout(idleTimeout time.Duration) Option

func WithMaxActive added in v1.3.4

func WithMaxActive(maxActive int) Option

func WithMaxConnLifetime added in v1.3.4

func WithMaxConnLifetime(maxConnLifetime time.Duration) Option

func WithMaxIdle added in v1.3.4

func WithMaxIdle(maxIdle int) Option

func WithPassword added in v1.3.4

func WithPassword(password string) Option

func WithUsername added in v1.3.4

func WithUsername(username string) Option

func WithWait added in v1.3.4

func WithWait(wait bool) Option

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (Result) Bool

func (result Result) Bool() bool

func (Result) ByteSlices

func (result Result) ByteSlices() [][]byte

func (Result) Bytes

func (result Result) Bytes() []byte

func (Result) Error

func (result Result) Error() error

func (Result) Float64

func (result Result) Float64() float64

func (Result) Float64s

func (result Result) Float64s() []float64

func (Result) Int

func (result Result) Int() int

func (Result) Int64

func (result Result) Int64() int64

func (Result) Int64Map

func (result Result) Int64Map() map[string]int64

func (Result) Int64s

func (result Result) Int64s() []int64

func (Result) IntMap

func (result Result) IntMap() map[string]int

func (Result) Ints

func (result Result) Ints() []int

func (Result) Positions

func (result Result) Positions() []*[2]float64

func (Result) Reply

func (result Result) Reply() interface{}

func (Result) SlowLogs

func (result Result) SlowLogs() []redis.SlowLog

func (Result) String

func (result Result) String() string

func (Result) StringMap

func (result Result) StringMap() map[string]string

func (Result) Strings

func (result Result) Strings() []string

func (Result) Uint64

func (result Result) Uint64() uint64

func (Result) Uint64Map

func (result Result) Uint64Map() map[string]uint64

func (Result) Uint64s

func (result Result) Uint64s() []uint64

func (Result) Value

func (result Result) Value() interface{}

func (Result) Values

func (result Result) Values() []interface{}

Jump to

Keyboard shortcuts

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