Documentation
¶
Index ¶
Constants ¶
const ( // StringType is redis string StringType = "string" // ListType is redis list ListType = "list" // SetType is redis set SetType = "set" // HashType is redis hash HashType = "hash" // ZSetType is redis sorted set ZSetType = "zset" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseObject ¶
type BaseObject struct {
DB int `json:"db"` // DB is db index of redis object
Key string `json:"key"` // Key is key of redis object
Expiration *time.Time `json:"expiration,omitempty"` // Expiration is expiration time, expiration of persistent object is nil
Size int `json:"size"` // Size is rdb value size in Byte
Type string `json:"type"`
}
BaseObject is basement of redis object
func (*BaseObject) GetDBIndex ¶
func (o *BaseObject) GetDBIndex() int
GetDBIndex returns db index of object
func (*BaseObject) GetElemCount ¶
func (o *BaseObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*BaseObject) GetExpiration ¶
func (o *BaseObject) GetExpiration() *time.Time
GetExpiration returns expiration time, expiration of persistent object is nil
func (*BaseObject) GetSize ¶
func (o *BaseObject) GetSize() int
GetSize returns rdb value size in Byte
type CallbackFunc ¶
type CallbackFunc func(object RedisObject) bool
CallbackFunc process redis object
type HashObject ¶
type HashObject struct {
*BaseObject
Hash map[string][]byte
}
HashObject stores a hash object
func (*HashObject) GetElemCount ¶
func (o *HashObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*HashObject) GetType ¶
func (o *HashObject) GetType() string
GetType returns redis object type
func (*HashObject) MarshalJSON ¶
func (o *HashObject) MarshalJSON() ([]byte, error)
MarshalJSON marshal []byte as string
type ListObject ¶
type ListObject struct {
*BaseObject
Values [][]byte
}
ListObject stores a list object
func (*ListObject) GetElemCount ¶
func (o *ListObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*ListObject) GetType ¶
func (o *ListObject) GetType() string
GetType returns redis object type
func (*ListObject) MarshalJSON ¶
func (o *ListObject) MarshalJSON() ([]byte, error)
MarshalJSON marshal []byte as string
type RedisObject ¶
type RedisObject interface {
// GetType returns redis type of object: string/list/set/hash/zset
GetType() string
// GetKey returns key of object
GetKey() string
// GetDBIndex returns db index of object
GetDBIndex() int
// GetExpiration returns expiration time, expiration of persistent object is nil
GetExpiration() *time.Time
// GetSize returns rdb value size in Byte
GetSize() int
// GetElemCount returns number of elements in list/set/hash/zset
GetElemCount() int
}
RedisObject is interface for a redis object
type SetObject ¶
type SetObject struct {
*BaseObject
Members [][]byte
}
SetObject stores a set object
func (*SetObject) GetElemCount ¶
GetElemCount returns number of elements in list/set/hash/zset
func (*SetObject) MarshalJSON ¶
MarshalJSON marshal []byte as string
type StringObject ¶
type StringObject struct {
*BaseObject
Value []byte
}
StringObject stores a string object
func (*StringObject) GetType ¶
func (o *StringObject) GetType() string
GetType returns redis object type
func (*StringObject) MarshalJSON ¶
func (o *StringObject) MarshalJSON() ([]byte, error)
MarshalJSON marshal []byte as string
type ZSetObject ¶
type ZSetObject struct {
*BaseObject
Entries []*ZSetEntry `json:"entries"`
}
ZSetObject stores a sorted set object
func (*ZSetObject) GetElemCount ¶
func (o *ZSetObject) GetElemCount() int
GetElemCount returns number of elements in list/set/hash/zset
func (*ZSetObject) GetType ¶
func (o *ZSetObject) GetType() string
GetType returns redis object type