redis

package
v1.6.13 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT, Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CommandDEL     = "DEL"
	CommandHGETALL = "HGETALL"
	CommandHMSET   = "HMSET"
	CommandSET     = "SET"
	CommandTTL     = "TTL"
	CommandSETNX   = "SETNX"
)
View Source
const (
	KeySortSet = "_Sorted_Set"
)

Variables

View Source
var ErrNil = errors.New("redis: nil")

ErrNil indicates that a reply value is nil.

Functions

func ByteSlices

func ByteSlices(reply interface{}, err error) ([][]byte, error)

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

func Bytes(reply interface{}, err error) ([]byte, error)

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

func Int64Map(result interface{}, err error) (map[string]int64, error)

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

func IntMap(result interface{}, err error) (map[string]int, error)

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 MultiBulk deprecated

func MultiBulk(reply interface{}, err error) ([]interface{}, error)

MultiBulk is a helper that converts an array command reply to a []interface{}.

Deprecated: Use Values instead.

func Positions

func Positions(result interface{}, err error) ([]*[2]float64, error)

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

func StringMap(result interface{}, err error) (map[string]string, error)

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.

func Values

func Values(reply interface{}, err error) ([]interface{}, error)

Values is a helper that converts an array command reply to a []interface{}. If err is not equal to nil, then Values returns nil, err. Otherwise, Values converts the reply as follows:

Reply type      Result
array           reply, nil
nil             nil, ErrNil
other           nil, error

Types

type Error

type Error string

func (Error) Error

func (err Error) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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