Documentation
¶
Index ¶
- Variables
- func MatchFilter(patterns []string, key string) bool
- type Empty
- type KRedis
- func (mr *KRedis) Del(keys ...string) (int64, error)
- func (mr *KRedis) Do(args ...interface{}) (interface{}, error)
- func (mr *KRedis) Dump(key string) (string, error)
- func (mr *KRedis) Exist(key string) (bool, error)
- func (that *KRedis) Expire(key string, expiration time.Duration) bool
- func (that *KRedis) ExpireAt(key string, tm time.Time) bool
- func (mr *KRedis) Get(key string) (interface{}, error)
- func (that *KRedis) HDel(key string, fields ...string) error
- func (that *KRedis) HExists(key string, field string) (bool, error)
- func (that *KRedis) HGet(key string, field string) (interface{}, error)
- func (that *KRedis) HGetAll(key string) (map[string]string, error)
- func (that *KRedis) HKeys(ctx context.Context, key string) ([]string, error)
- func (that *KRedis) HLen(key string) (int64, error)
- func (that *KRedis) HMGet(key string, fields ...string) ([]interface{}, error)
- func (that *KRedis) HMSet(key string, fields map[string]interface{}) error
- func (that *KRedis) HSet(key string, field string, value interface{}) error
- func (that *KRedis) HSetAll(key string, fields map[string]interface{}) error
- func (that *KRedis) HSetNX(ctx context.Context, key, field string, value interface{}) (bool, error)
- func (that *KRedis) HVals(ctx context.Context, key string) ([]string, error)
- func (that *KRedis) JsonDel(key string, path string) (int64, error)
- func (that *KRedis) JsonGet(key string, paths ...string) (string, error)
- func (that *KRedis) JsonMerge(key string, path string, value string) error
- func (that *KRedis) JsonObjKeys(key string, path string) ([]string, error)
- func (that *KRedis) JsonObjLen(key string, path string) ([]int64, error)
- func (that *KRedis) JsonSet(key string, path string, value string) error
- func (that *KRedis) JsonType(key string, path string) ([]string, error)
- func (that *KRedis) LIndex(key string, index int64) (string, error)
- func (that *KRedis) LInsert(key string, position string, pivot interface{}, value interface{}) (int64, error)
- func (that *KRedis) LLen(key string) (int64, error)
- func (that *KRedis) LPop(key string) (string, error)
- func (that *KRedis) LPush(key string, values ...interface{}) (int64, error)
- func (that *KRedis) LPushX(key string, values ...interface{}) (int64, error)
- func (that *KRedis) LRange(key string, start int64, stop int64) ([]string, error)
- func (that *KRedis) LRem(key string, count int64, value interface{}) (int64, error)
- func (that *KRedis) LSet(key string, index int64, value interface{}) error
- func (that *KRedis) LTrim(key string, start int64, stop int64) error
- func (mr *KRedis) PSubscribe(timeout int, callback func(err error, topic string, payload interface{}), ...)
- func (mr *KRedis) PSubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
- func (mr *KRedis) PSubscribeWithChanSize(timeout int, chanSize int, ...)
- func (mr *KRedis) PTTL(key string) (time.Duration, error)
- func (mr *KRedis) Ping() bool
- func (mr *KRedis) Pipeline() redisHd.Pipeliner
- func (mr *KRedis) Publish(topic string, payload interface{}) error
- func (that *KRedis) RPop(key string) (string, error)
- func (that *KRedis) RPush(key string, values ...interface{}) (int64, error)
- func (that *KRedis) RPushX(key string, values ...interface{}) (int64, error)
- func (mr *KRedis) Restore(key string, ttl time.Duration, value string) (string, error)
- func (mr *KRedis) RestoreReplace(key string, ttl time.Duration, value string) (string, error)
- func (that *KRedis) SAdd(key string, members ...interface{}) (int64, error)
- func (that *KRedis) SCard(key string) (int64, error)
- func (that *KRedis) SDiff(keys ...string) ([]string, error)
- func (that *KRedis) SDiffStore(destKey string, keys ...string) (int64, error)
- func (that *KRedis) SInter(keys ...string) ([]string, error)
- func (that *KRedis) SInterStore(destKey string, keys ...string) (int64, error)
- func (that *KRedis) SIsMember(key string, member interface{}) (bool, error)
- func (that *KRedis) SMembers(key string) ([]string, error)
- func (that *KRedis) SMove(source, destination string, member interface{}) (bool, error)
- func (that *KRedis) SPop(key string) (string, error)
- func (that *KRedis) SPopN(key string, count int64) ([]string, error)
- func (that *KRedis) SRandMember(key string) (string, error)
- func (that *KRedis) SRem(key string, members ...interface{}) (int64, error)
- func (that *KRedis) SUnion(keys ...string) ([]string, error)
- func (that *KRedis) SUnionStore(destKey string, keys ...string) (int64, error)
- func (mr *KRedis) Scan(limit int, aboutTypes []string, ignoreKeys []string, includeKeys []string, ...) ([]*RedisRecord, error)
- func (mr *KRedis) ScanMatch(limit int, aboutTypes []string, ignoreKeys []string, includeKeys []string, ...) ([]*RedisRecord, error)
- func (mr *KRedis) Set(key string, value interface{}, duration time.Duration) (bool, error)
- func (mr *KRedis) Stop()
- func (mr *KRedis) Subscribe(timeout int, callback func(err error, topic string, payload interface{}), ...)
- func (mr *KRedis) SubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
- func (mr *KRedis) SubscribeWithoutTimeout(callback func(err error, topic string, payload interface{}), topics ...string)
- func (mr *KRedis) SyncPSubscribe(timeout int, callback func(err error, topic string, payload interface{}), ...)
- func (mr *KRedis) SyncPSubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
- func (mr *KRedis) SyncPSubscribeWithChanSize(timeout int, chanSize int, ...)
- func (mr *KRedis) SyncSubscribe(timeout int, callback func(err error, topic string, payload interface{}), ...)
- func (mr *KRedis) SyncSubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
- func (mr *KRedis) SyncSubscribeWithoutTimeout(callback func(err error, topic string, payload interface{}), topics ...string)
- func (mr *KRedis) TTL(key string) (time.Duration, error)
- func (mr *KRedis) Type(key string) (string, error)
- type RedisMessage
- type RedisMessagePackConstraints
- type RedisRecord
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnSubscribe = errors.New("func UnSubscribe be called") ErrChannelClosed = errors.New("channel be closed") )
Functions ¶
func MatchFilter ¶
Types ¶
type KRedis ¶
func (*KRedis) JsonDel ¶ added in v0.4.2
JsonDel 封装了 Redis JSON.DEL 命令。 key: Redis 中的键名。 path: 可选的 JSON Path。如果为空字符串,则删除整个 JSON 文档。 返回值:被删除的 JSON 值数量。如果键或路径不存在,通常返回 0。
func (*KRedis) JsonGet ¶ added in v0.4.2
JsonGet 封装了 Redis JSON.GET 命令,并直接返回原始的 JSON 字符串。 调用方将负责对返回的字符串进行反序列化。 key: Redis 中的键名。 paths: 可选的 JSON Path 参数。如果没有提供,则获取整个 JSON 文档。 返回值:JSON 字符串。如果键或路径不存在,或结果为空,则返回空字符串和 nil 错误。
func (*KRedis) JsonMerge ¶ added in v0.4.2
JsonMerge 封装了 Redis JSON.MERGE 命令。 该命令会将 Go 值序列化为 JSON 并与现有值合并。如果路径不存在,则创建新字段。 key: Redis 中的键名。 path: JSON Path,指定要合并的位置。 value: 要存储的 Go 值,将被序列化为 JSON 并与现有值合并。 返回值:如果操作成功则返回 nil,否则返回错误。
func (*KRedis) JsonObjKeys ¶ added in v0.4.2
JsonObjKeys 封装了 Redis JSON.OBJKEYS 命令。 key: Redis 中的键名。 path: 可选的 JSON Path。如果为空字符串,则返回根对象的键。 返回值:一个包含对象键的字符串切片。如果键、路径不存在或路径对应的不是对象,则返回 nil 切片和 nil 错误。
func (*KRedis) JsonObjLen ¶ added in v0.4.2
OBJLEN 获取JSON 对象中键的数量,如果匹配的 JSON 值不是对象,则为 -1 key: Redis 中的键名。 path: 可选的 JSON Path。如果为空字符串,则返回根对象的键。 返回值:一个包含对象键的字符串切片。如果键、路径不存在或路径对应的不是对象,则返回 nil 切片和 nil 错误。
func (*KRedis) JsonSet ¶ added in v0.4.2
JsonSet 封装了 Redis JSON.SET 命令。 它会将 Go 值自动序列化为 JSON 字符串并存储。 key: Redis 中的键名。 path: JSON Path。 value: 要存储的 Go 值,将被序列化为 JSON。 返回值:如果操作成功则返回 nil,否则返回错误。
func (*KRedis) JsonType ¶ added in v0.4.2
JsonType 封装了 Redis JSON.TYPE 命令。 key: Redis 中的键名。 path: 可选的 JSON Path。如果为空字符串,则返回根路径的类型; 不支持同时指定多个路径。 返回值:一个包含 JSON 值类型的字符串切片。如果键或路径不存在,则返回 nil 切片和 nil 错误。
func (*KRedis) LInsert ¶
func (that *KRedis) LInsert(key string, position string, pivot interface{}, value interface{}) (int64, error)
在指定位置插入数据,在头部插入用"before",尾部插入用"after"
func (*KRedis) PSubscribe ¶
func (mr *KRedis) PSubscribe(timeout int, callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, topic支持通配符, timeout 设置轮询超时时间, 单位ms; callback为接收消息的回调函数; topics为需要订阅的topic
func (*KRedis) PSubscribeLow ¶ added in v0.4.11
func (mr *KRedis) PSubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, 底层API, 最好使用Subscribe替代
func (*KRedis) PSubscribeWithChanSize ¶
func (mr *KRedis) PSubscribeWithChanSize(timeout int, chanSize int, callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, topic支持通配符, timeout 设置轮询超时时间, 单位ms; chanSize 最大允许队列大小, 如果< 1, 则为1; callback为接收消息的回调函数; topics为需要订阅的topic
func (*KRedis) RestoreReplace ¶
func (*KRedis) SDiffStore ¶
func (*KRedis) SInterStore ¶
func (*KRedis) SUnionStore ¶
func (*KRedis) Scan ¶
func (mr *KRedis) Scan(limit int, aboutTypes []string, ignoreKeys []string, includeKeys []string, needDel bool, logf klogger.AppLogFunc) ([]*RedisRecord, error)
func (*KRedis) ScanMatch ¶
func (mr *KRedis) ScanMatch(limit int, aboutTypes []string, ignoreKeys []string, includeKeys []string, needDel bool, logf klogger.AppLogFunc) ([]*RedisRecord, error)
func (*KRedis) Subscribe ¶
func (mr *KRedis) Subscribe(timeout int, callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, timeout 设置轮询超时时间, 单位ms; callback为接收消息的回调函数; topics为需要订阅的topic
func (*KRedis) SubscribeLow ¶
func (mr *KRedis) SubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, 底层API, 最好使用Subscribe替代
func (*KRedis) SubscribeWithoutTimeout ¶
func (mr *KRedis) SubscribeWithoutTimeout(callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息
func (*KRedis) SyncPSubscribe ¶ added in v0.4.12
func (mr *KRedis) SyncPSubscribe(timeout int, callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, topic支持通配符, timeout 设置轮询超时时间, 单位ms; callback为接收消息的回调函数; topics为需要订阅的topic
func (*KRedis) SyncPSubscribeLow ¶ added in v0.4.12
func (mr *KRedis) SyncPSubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, 底层API, 最好使用Subscribe替代
func (*KRedis) SyncPSubscribeWithChanSize ¶ added in v0.4.12
func (mr *KRedis) SyncPSubscribeWithChanSize(timeout int, chanSize int, callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, topic支持通配符, timeout 设置轮询超时时间, 单位ms; chanSize 最大允许队列大小, 如果< 1, 则为1; callback为接收消息的回调函数; topics为需要订阅的topic
func (*KRedis) SyncSubscribe ¶ added in v0.4.12
func (mr *KRedis) SyncSubscribe(timeout int, callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, timeout 设置轮询超时时间, 单位ms; callback为接收消息的回调函数; topics为需要订阅的topic
func (*KRedis) SyncSubscribeLow ¶ added in v0.4.12
func (mr *KRedis) SyncSubscribeLow(callback func(err error, topic string, payload interface{}), topics ...string)
从指定topic订阅消息, 底层API, 最好使用Subscribe替代
type RedisMessage ¶
type RedisMessagePackConstraints ¶
type RedisMessagePackConstraints interface {
RedisRecord | RedisMessage
}