Documentation ¶
Index ¶
- Variables
- func Bool(reply interface{}) (bool, error)
- func BoolDefault(reply interface{}, def ...bool) bool
- func ByteSlices(reply interface{}) ([][]byte, error)
- func Bytes(reply interface{}) ([]byte, error)
- func BytesDefault(reply interface{}, def ...[]byte) []byte
- func Copy(dst, src interface{})
- func DbTag(tp reflect.Type) (map[string]string, string)
- func Float64(reply interface{}) (float64, error)
- func Float64Default(reply interface{}, def ...float64) float64
- func GetPtrInterface(v reflect.Value) interface{}
- func Int(reply interface{}) (int, error)
- func Int64(reply interface{}) (int64, error)
- func Int64Default(reply interface{}, def ...int64) int64
- func Int64Map(result interface{}) (map[string]int64, error)
- func IntDefault(reply interface{}, def ...int) int
- func IntMap(result interface{}) (map[string]int, error)
- func IsEmpty(v reflect.Value) bool
- func MultiBulk(reply interface{}) ([]interface{}, error)deprecated
- func SetMapValue(obj interface{}, m map[string]interface{})
- func String(reply interface{}) (string, error)
- func StringDefault(reply interface{}, def ...string) string
- func StringMap(result interface{}) (map[string]string, error)
- func Strings(reply interface{}) ([]string, error)
- func Uint64(reply interface{}) (uint64, error)
- func Uint64Default(reply interface{}, def ...uint64) uint64
- func Values(reply interface{}) ([]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNil = errors.New("nil returned")
ErrNil indicates that a reply value is nil.
Functions ¶
func Bool ¶
Bool is a helper that converts a command reply to a boolean. If err is not equal to nil, then Bool returns false, err. Otherwise Bool converts the reply to boolean as follows:
Reply type ExecResult integer value != 0, nil bulk string strconv.ParseBool(reply) nil false, ErrNil other false, error
func BoolDefault ¶
BoolDefault is a helper that converts a command reply to a boolean. If err is not equal to nil, then Bool returns default value
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 ExecResult bulk string reply, nil simple string []byte(reply), nil nil nil, ErrNil other nil, error
func BytesDefault ¶
BytesDefault is a helper that converts a command reply to a slice of bytes. If err is not equal to nil, then Bytes returns default value
func Copy ¶
func Copy(dst, src interface{})
Copy 转换对象值,对象字段名称相同并且类型相同时自动赋值相应字段 @param dst interface{} 目标对象 @param src interface{} 原始对象
func DbTag ¶
dbTag 解析对象数据库结构 @param tp reflect.Type 对象类型 @return map[string]string 对象数据库结构字段对照表 @return string 对象数据库主键字段名
func Float64 ¶
Float64 is a helper that converts a command reply to 64 bit float. If err is not equal to nil, then Float64 returns 0, err. Otherwise, Float64 converts the reply to an int as follows:
Reply type ExecResult bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Float64Default ¶
Float64Default is a helper that converts a command reply to 64 bit float. If err is not equal to nil, then return default value
func Int ¶
Int is a helper that converts a command reply to an integer. If err is not equal to nil, then Int returns 0, err. Otherwise, Int converts the reply to an int as follows:
Reply type ExecResult integer int(reply), nil bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Int64 ¶
Int64 is a helper that converts a command reply to 64 bit integer. If err is not equal to nil, then Int returns 0, err. Otherwise, Int64 converts the reply to an int64 as follows:
Reply type ExecResult integer reply, nil bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Int64Default ¶
Int64Default is a helper that converts 64 bit integer. If err is not equal to nil, then return default value
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 IntDefault ¶
IntDefault is a helper that converts interface to an integer. If err is not equal to nil, then return default value
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 String ¶
String is a helper that converts a command reply to a string. If err is not equal to nil, then String returns "", err. Otherwise String converts the reply to a string as follows:
Reply type ExecResult bulk string string(reply), nil simple string reply, nil nil "", ErrNil other "", error
func StringDefault ¶
StringDefault is a helper that converts a command reply to a string. If err is not equal to nil, then String returns default value
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.
func Strings ¶
Strings is a helper that converts an array command reply to a []string. If err is not equal to nil, then Strings returns nil, err. Nil array items are converted to "" in the output slice. Strings returns an error if an array item is not a bulk string or nil.
func Uint64 ¶
Uint64 is a helper that converts a command reply to 64 bit integer. If err is not equal to nil, then Int returns 0, err. Otherwise, Int64 converts the reply to an int64 as follows:
Reply type ExecResult integer reply, nil bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Uint64Default ¶
Uint64Default is a helper that converts to 64 bit integer. If err is not equal to nil, then return default value
func Values ¶
func Values(reply interface{}) ([]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 ExecResult array reply, nil nil nil, ErrNil other nil, error
Types ¶
This section is empty.