Documentation ¶
Index ¶
- Variables
- func Bytes(reply interface{}, err error) ([]byte, error)
- func String(reply interface{}, err error) (string, error)
- type Error
- type RedisConfig
- type RedisConn
- func (r *RedisConn) Close() error
- func (r *RedisConn) Connection() error
- func (r *RedisConn) Del(key string) (interface{}, error)
- func (r *RedisConn) Exists(key string) (interface{}, error)
- func (r *RedisConn) Expire(key string, timeout int) (interface{}, error)
- func (r *RedisConn) Get(key string) (interface{}, error)
- func (r *RedisConn) Init(config *RedisConfig) error
- func (r *RedisConn) LIndex(key string) (interface{}, error)
- func (r *RedisConn) LInsert(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) LLen(key string) (interface{}, error)
- func (r *RedisConn) LPUSHX(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) LPop(key string) (interface{}, error)
- func (r *RedisConn) LPush(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) LRange(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) LRem(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) LSet(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) RPop(key string) (interface{}, error)
- func (r *RedisConn) RPush(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) RPushx(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) Set(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) SetNX(key string, args ...interface{}) (interface{}, error)
- func (r *RedisConn) String(value interface{}) string
Constants ¶
This section is empty.
Variables ¶
var ErrNil = errors.New("go_helper redis: nil returned")
ErrNil indicates that a reply value is nil.
Functions ¶
func Bytes ¶
Bytes is a helper that converts a command reply to a slice of bytes. If err is not equal to nil, then Bytes returns nil, err. Otherwise Bytes converts the reply to a slice of bytes as follows:
Reply type Result bulk string reply, nil simple string []byte(reply), nil nil nil, ErrNil other nil, error
Types ¶
type RedisConfig ¶
type RedisConn ¶
type RedisConn struct { Config *RedisConfig // contains filtered or unexported fields }
func (*RedisConn) Get ¶
Get a value by a given key return an interface and an error Origin command: GET KEY_NAME
func (*RedisConn) LInsert ¶
LINSERT LInsert(key, "BEFORE", element, value) Insert value into before the element of the list.
func (*RedisConn) LRange ¶
LRANGE
LRange(key, start, end) Start or end is beginning with 0, and -1 is meaning that the end of the list.
Get the elements in the specified range of the list.
func (*RedisConn) LRem ¶
LRem LRrm(key, count, value)
count > 0: Search from the beginning of the header to the end of the table, removing the equivalent of value, the number is count.
count < 0: Search from the beginning of the table to the header, remove the same element as value, the number is the absolute value of count.
count = 0: Remove all values in the table that are equal to value.
func (*RedisConn) RPop ¶
RPop Remove the element which in the end of the list. Return the value of element which is removed. If the index is not exists, return nil.
func (*RedisConn) RPush ¶
RPush RPush(key, "foo") Insert one or more values into the end of the list(far right).
func (*RedisConn) RPushx ¶
RPushx RPushx(key, "foo") Insert one value into the end of the list(far right).
func (*RedisConn) Set ¶
Set a value for a customize key return an interface and an error Origin command: GET KEY_NAME