Documentation
¶
Index ¶
- Constants
- func Redis(c RedisConfig) *redis.Client
- type Attr
- type Attrs
- type DBGetter
- type InterfaceResult
- type Iterator
- type Operation
- func (o *Operation) Del(keys ...string) *InterfaceResult
- func (o *Operation) Get(key string) *Result
- func (o *Operation) GetPrefix() string
- func (o *Operation) GetRedisClient() *redis.Client
- func (o *Operation) HDel(key string, fields ...string) *InterfaceResult
- func (o *Operation) HGet(key string, field string) *Result
- func (o *Operation) HGetAll(key string) *Result
- func (o *Operation) HMGet(key string, fields ...string) *Result
- func (o *Operation) HMSet(key string, fields map[string]string) *InterfaceResult
- func (o *Operation) HSet(key string, field string, value interface{}) *InterfaceResult
- func (o *Operation) MGet(keys ...string) *Result
- func (o *Operation) Set(key string, value interface{}, attrs ...*Attr) *InterfaceResult
- type RedisConfig
- type RedisStore
- type Result
- func (r *Result) Iterator() *Iterator
- func (r *Result) UnWarp() string
- func (r *Result) UnWarpWithDefault(defaultValue string) string
- func (r *Result) UnwrapMap() map[string]interface{}
- func (r *Result) UnwrapMapStringStr() map[string]string
- func (r *Result) UnwrapMapStringStrWithDefault(defaultValue map[string]string) map[string]string
- func (r *Result) UnwrapMapWithDefault(defaultValue map[string]interface{}) map[string]interface{}
- func (r *Result) UnwrapSlice() []interface{}
- func (r *Result) UnwrapSliceWithDefault(defaultValue []interface{}) []interface{}
Constants ¶
View Source
const ( AttrExpire = "expire" AttrNx = "nx" AttrXx = "xx" )
View Source
const (
SetSuccess = "OK"
)
Variables ¶
This section is empty.
Functions ¶
func Redis ¶
func Redis(c RedisConfig) *redis.Client
Types ¶
type InterfaceResult ¶
type InterfaceResult struct { Result interface{} Err error }
InterfaceResult set结果接口
func NewInterfaceResult ¶
func NewInterfaceResult(result interface{}, err error) *InterfaceResult
func (*InterfaceResult) Unwrap ¶
func (i *InterfaceResult) Unwrap() interface{}
func (*InterfaceResult) UnwrapWithDefault ¶
func (i *InterfaceResult) UnwrapWithDefault(defaultValue interface{}) interface{}
type Iterator ¶
type Iterator struct { Index int Items []interface{} }
Iterator 迭代器
func NewIterator ¶
func NewIterator(data []interface{}) *Iterator
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
Operation redis 操作
func NewOperation ¶
func NewOperation(c RedisConfig) *Operation
func (*Operation) GetRedisClient ¶ added in v0.0.5
func (o *Operation) GetRedisClient() *redis.Client
GetRedisClient Redis 获取redis客户端
func (*Operation) HDel ¶
func (o *Operation) HDel(key string, fields ...string) *InterfaceResult
HDel DelHash 删除hash值
func (*Operation) HMSet ¶
func (o *Operation) HMSet(key string, fields map[string]string) *InterfaceResult
HMSet SetHashMulti 设置多个hash值
type RedisConfig ¶
type RedisStore ¶ added in v0.0.5
func (*RedisStore) GetClient ¶ added in v0.0.5
func (r *RedisStore) GetClient() *redis.Client
GetClient 获取client
type Result ¶
type Result struct { StringResult string Err error SliceResult []interface{} MapResult map[string]interface{} MapStringStr map[string]string }
Result redis get 结果
func (*Result) UnWarpWithDefault ¶
UnWarpWithDefault 获取结果,如果有错误则返回默认值
func (*Result) UnwrapMapStringStr ¶
UnwrapMapStringStr 获取map string string
func (*Result) UnwrapMapStringStrWithDefault ¶
UnwrapMapStringStrWithDefault 获取map string string 结果 如果有错误则返回默认值
func (*Result) UnwrapMapWithDefault ¶
UnwrapMapWithDefault 取结果map,如果有错误则返回默认值
func (*Result) UnwrapSliceWithDefault ¶
func (r *Result) UnwrapSliceWithDefault(defaultValue []interface{}) []interface{}
UnwrapSliceWithDefault 取结果切片,如果有错误则返回默认值
Click to show internal directories.
Click to hide internal directories.