Documentation
¶
Index ¶
- Constants
- Variables
- func ByteSlices(reply interface{}, err error) ([][]byte, error)
- func Bytes(reply interface{}, err error) ([]byte, error)
- func Int64Map(result interface{}, err error) (map[string]int64, error)
- func IntMap(result interface{}, err error) (map[string]int, error)
- func MultiBulk(reply interface{}, err error) ([]interface{}, error)deprecated
- func Positions(result interface{}, err error) ([]*[2]float64, error)
- func StringMap(result interface{}, err error) (map[string]string, error)
- func Values(reply interface{}, err error) ([]interface{}, error)
- type Error
Constants ¶
const ( CommandDEL = "DEL" CommandHGETALL = "HGETALL" CommandHMSET = "HMSET" CommandSET = "SET" CommandTTL = "TTL" CommandSETNX = "SETNX" )
const (
KeySortSet = "_Sorted_Set"
)
Variables ¶
var ErrNil = errors.New("redis: nil")
ErrNil indicates that a reply value is nil.
Functions ¶
func ByteSlices ¶
ByteSlices is a helper that converts an array command reply to a [][]byte. If err is not equal to nil, then ByteSlices returns nil, err. Nil array items are stay nil. ByteSlices returns an error if an array item is not a bulk string or nil.
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
func Int64Map ¶
Int64Map is a helper that converts an array of strings (alternating key, value) into a map[string]int64. The HGETALL commands return replies in this format. Requires an even number of values in result.
func IntMap ¶
IntMap is a helper that converts an array of strings (alternating key, value) into a map[string]int. The HGETALL commands return replies in this format. Requires an even number of values in result.
func Positions ¶
Positions is a helper that converts an array of positions (lat, long) into a [][2]float64. The GEOPOS command returns replies in this format.
func StringMap ¶
StringMap is a helper that converts an array of strings (alternating key, value) into a map[string]string. The HGETALL and CONFIG GET commands return replies in this format. Requires an even number of values in result.