18 changed files with 1082 additions and 1186 deletions
@ -0,0 +1,28 @@ |
|||
package confignosql |
|||
|
|||
import "fmt" |
|||
|
|||
type RedisSetUpV9 struct { |
|||
RedisClusterV9 RedisConfitSetUp `mapstructure:"redisCluster" json:"redisCluster" yaml:"redisCluster"` //内网集群
|
|||
} |
|||
|
|||
/* |
|||
* |
|||
@ 作者: 秦东 |
|||
@ 时间: 2023-12-13 11:14:06 |
|||
@ 功能: 开启v9集群 |
|||
@ 参数 |
|||
|
|||
# |
|||
|
|||
@ 返回值 |
|||
|
|||
# |
|||
|
|||
@ 方法原型 |
|||
|
|||
# |
|||
*/ |
|||
func (r *RedisConfitSetUp) OpenRedisClan() { |
|||
fmt.Printf("开启%v Redis库 %v\n", r.UrlPathList, r.Name) |
|||
} |
|||
@ -1,55 +1,57 @@ |
|||
module appPlatform |
|||
|
|||
go 1.18 |
|||
go 1.19 |
|||
|
|||
require ( |
|||
github.com/flipped-aurora/gin-vue-admin/server v0.0.0-20220724010254-afab1fdbce13 |
|||
github.com/fsnotify/fsnotify v1.5.4 |
|||
github.com/gin-gonic/gin v1.8.1 |
|||
github.com/go-redis/redis/v8 v8.11.5 |
|||
github.com/flipped-aurora/gin-vue-admin/server v0.0.0-20231212025023-e0a8e9370425 |
|||
github.com/fsnotify/fsnotify v1.7.0 |
|||
github.com/gin-gonic/gin v1.9.1 |
|||
github.com/mitchellh/mapstructure v1.5.0 |
|||
github.com/mojocn/base64Captcha v1.3.5 |
|||
github.com/mozillazg/go-pinyin v0.19.0 |
|||
github.com/spf13/viper v1.12.0 |
|||
gorm.io/driver/mysql v1.3.5 |
|||
gorm.io/gorm v1.23.8 |
|||
github.com/mozillazg/go-pinyin v0.20.0 |
|||
github.com/redis/go-redis/v9 v9.3.0 |
|||
github.com/robfig/cron/v3 v3.0.1 |
|||
github.com/spf13/viper v1.16.0 |
|||
gorm.io/driver/mysql v1.5.2 |
|||
gorm.io/gorm v1.25.5 |
|||
) |
|||
|
|||
require ( |
|||
github.com/cespare/xxhash/v2 v2.1.2 // indirect |
|||
github.com/bytedance/sonic v1.9.1 // indirect |
|||
github.com/cespare/xxhash/v2 v2.2.0 // indirect |
|||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect |
|||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect |
|||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect |
|||
github.com/gin-contrib/sse v0.1.0 // indirect |
|||
github.com/go-playground/locales v0.14.0 // indirect |
|||
github.com/go-playground/universal-translator v0.18.0 // indirect |
|||
github.com/go-playground/validator/v10 v10.10.0 // indirect |
|||
github.com/go-sql-driver/mysql v1.6.0 // indirect |
|||
github.com/goccy/go-json v0.9.7 // indirect |
|||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect |
|||
github.com/go-playground/locales v0.14.1 // indirect |
|||
github.com/go-playground/universal-translator v0.18.1 // indirect |
|||
github.com/go-playground/validator/v10 v10.14.0 // indirect |
|||
github.com/go-sql-driver/mysql v1.7.1 // indirect |
|||
github.com/goccy/go-json v0.10.2 // indirect |
|||
github.com/hashicorp/hcl v1.0.0 // indirect |
|||
github.com/jinzhu/inflection v1.0.0 // indirect |
|||
github.com/jinzhu/now v1.1.5 // indirect |
|||
github.com/json-iterator/go v1.1.12 // indirect |
|||
github.com/leodido/go-urn v1.2.1 // indirect |
|||
github.com/magiconair/properties v1.8.6 // indirect |
|||
github.com/mattn/go-isatty v0.0.14 // indirect |
|||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect |
|||
github.com/leodido/go-urn v1.2.4 // indirect |
|||
github.com/magiconair/properties v1.8.7 // indirect |
|||
github.com/mattn/go-isatty v0.0.19 // indirect |
|||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect |
|||
github.com/modern-go/reflect2 v1.0.2 // indirect |
|||
github.com/pelletier/go-toml v1.9.5 // indirect |
|||
github.com/pelletier/go-toml/v2 v2.0.1 // indirect |
|||
github.com/robfig/cron/v3 v3.0.1 // indirect |
|||
github.com/spf13/afero v1.8.2 // indirect |
|||
github.com/spf13/cast v1.5.0 // indirect |
|||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect |
|||
github.com/spf13/afero v1.11.0 // indirect |
|||
github.com/spf13/cast v1.6.0 // indirect |
|||
github.com/spf13/jwalterweatherman v1.1.0 // indirect |
|||
github.com/spf13/pflag v1.0.5 // indirect |
|||
github.com/subosito/gotenv v1.3.0 // indirect |
|||
github.com/ugorji/go/codec v1.2.7 // indirect |
|||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect |
|||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect |
|||
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect |
|||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect |
|||
golang.org/x/text v0.3.7 // indirect |
|||
google.golang.org/protobuf v1.28.0 // indirect |
|||
gopkg.in/ini.v1 v1.66.4 // indirect |
|||
gopkg.in/yaml.v2 v2.4.0 // indirect |
|||
gopkg.in/yaml.v3 v3.0.0 // indirect |
|||
github.com/subosito/gotenv v1.6.0 // indirect |
|||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect |
|||
github.com/ugorji/go/codec v1.2.11 // indirect |
|||
golang.org/x/arch v0.3.0 // indirect |
|||
golang.org/x/crypto v0.16.0 // indirect |
|||
golang.org/x/net v0.19.0 // indirect |
|||
golang.org/x/sys v0.15.0 // indirect |
|||
golang.org/x/text v0.14.0 // indirect |
|||
google.golang.org/protobuf v1.31.0 // indirect |
|||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect |
|||
gopkg.in/ini.v1 v1.67.0 // indirect |
|||
gopkg.in/yaml.v3 v3.0.1 // indirect |
|||
) |
|||
|
|||
File diff suppressed because it is too large
@ -0,0 +1,414 @@ |
|||
package grocerystore |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"context" |
|||
"fmt" |
|||
"time" |
|||
|
|||
"github.com/redis/go-redis/v9" |
|||
) |
|||
|
|||
/* |
|||
* |
|||
@ 作者: 秦东 |
|||
@ 时间: 2023-12-13 13:23:48 |
|||
@ 功能: Redis集群操作 |
|||
@ 参数 |
|||
|
|||
# |
|||
|
|||
@ 返回值 |
|||
|
|||
# |
|||
|
|||
@ 方法原型 |
|||
|
|||
# |
|||
*/ |
|||
func RunRedisClan(redisClient *redis.ClusterClient) *RedisStoreType { |
|||
var redisStoreType RedisStoreType |
|||
redisStoreType.Expiration = time.Second * 300 |
|||
redisStoreType.PreKey = fmt.Sprintf("%v:", overall.CONSTANT_CONFIG.RedisPrefixStr.PreFix) |
|||
redisStoreType.Context = context.Background() |
|||
redisStoreType.RedisDbClan = redisClient |
|||
return &redisStoreType |
|||
} |
|||
|
|||
// 设置字符串
|
|||
func (r *RedisStoreType) SetClan(key string, value string) bool { |
|||
err := r.RedisDbClan.Set(r.Context, r.PreKey+key, value, r.Expiration).Err() |
|||
if err != nil { |
|||
return false |
|||
} |
|||
return true |
|||
} |
|||
|
|||
// 获取字符串
|
|||
func (r *RedisStoreType) GetClan(key string) (bool, string) { |
|||
err := r.RedisDbClan.Get(r.Context, r.PreKey+key) |
|||
if err.Err() != nil { |
|||
return false, "" |
|||
} |
|||
return true, err.Val() |
|||
} |
|||
|
|||
// 删除键
|
|||
func (r *RedisStoreType) DelKeyClan(key string) bool { |
|||
err := r.RedisDbClan.Del(r.Context, r.PreKey+key).Err() |
|||
if err != nil { |
|||
return false |
|||
} |
|||
return true |
|||
} |
|||
|
|||
//哈希操作
|
|||
/* |
|||
获取单个哈希键值 |
|||
@hashName 集合名称 |
|||
@hashKey 哈希键 |
|||
callback |
|||
errs 状态 |
|||
hashVal 获得值 |
|||
*/ |
|||
func (r *RedisStoreType) HashGetClan(hashName, hashKey string) (errs bool, hashVal string) { |
|||
err := r.RedisDbClan.HGet(r.Context, r.PreKey+hashName, hashKey) |
|||
if err.Err() != nil { |
|||
return false, "" |
|||
} |
|||
return true, err.Val() |
|||
} |
|||
|
|||
/* |
|||
为哈希表中的字段赋值 。 单一设置 |
|||
@hashName 集合名称 |
|||
@hashKey 哈希键 |
|||
@hashVal 要添加的值 |
|||
*/ |
|||
func (r *RedisStoreType) HashSetClan(hashName, hashKey, hashVal string) bool { |
|||
err := r.RedisDbClan.HSet(r.Context, r.PreKey+hashName, hashKey, hashVal).Err() |
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDbClan.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDbClan.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
// global.GVA_REDIS.PExpire(r.Context, r.PreKey+hashName, r.Expiration)
|
|||
return true |
|||
} |
|||
|
|||
/* |
|||
同时将多个 field-value (字段-值)对设置到哈希表中。 |
|||
@hashName 集合名称 |
|||
@hashVal 要添加的键与值 |
|||
*/ |
|||
func (r *RedisStoreType) HashMsetAddClan(hashName string, hashVal map[string]interface{}) bool { |
|||
// rdb := RedisInit()
|
|||
err := r.RedisDbClan.HMSet(r.Context, r.PreKey+hashName, hashVal).Err() |
|||
fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal) |
|||
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
|
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDbClan.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDbClan.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
|
|||
return true |
|||
} |
|||
func (r *RedisStoreType) HashMsetAddinterfaceClan(hashName string, hashVal interface{}) bool { |
|||
// rdb := RedisInit()
|
|||
err := r.RedisDbClan.HMSet(r.Context, r.PreKey+hashName, hashVal).Err() |
|||
// fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal)
|
|||
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
|
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDbClan.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDbClan.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
|
|||
return true |
|||
} |
|||
func (r *RedisStoreType) HashMsetAddAryClan(hashName string, hashVal []map[string]interface{}) bool { |
|||
// rdb := RedisInit()
|
|||
err := r.RedisDbClan.HMSet(r.Context, r.PreKey+hashName, hashVal).Err() |
|||
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
|
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDbClan.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDbClan.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
// global.GVA_REDIS.PExpire(r.Context, r.PreKey+hashName, r.Expiration)
|
|||
// fmt.Printf("错误sss=========》%v\n", hashVal)
|
|||
return true |
|||
} |
|||
|
|||
/* |
|||
返回哈希表中,所有的字段和值。 |
|||
@hashName 集合名称 |
|||
@hashKey 哈希键 |
|||
*/ |
|||
func (r *RedisStoreType) HashGetAllClan(hashName string) (map[string]string, bool) { |
|||
// rdb := RedisInit()
|
|||
fmt.Printf("strKEy:===>%v\n", r.PreKey+hashName) |
|||
val, err := r.RedisDbClan.HGetAll(r.Context, r.PreKey+hashName).Result() |
|||
fmt.Printf("strKEy:==1=>%v==1=>%v\n", val, err) |
|||
if err != nil { |
|||
return val, false |
|||
} |
|||
if len(val) == 0 { |
|||
return val, false |
|||
} |
|||
return val, true |
|||
} |
|||
|
|||
//Redis 列表(List)
|
|||
|
|||
/* |
|||
* |
|||
Linsert 命令用于在列表的元素前或者后插入元素。当指定元素不存在于列表中时,不执行任何操作。 |
|||
当列表不存在时,被视为空列表,不执行任何操作。 |
|||
如果 key 不是列表类型,返回一个错误。 |
|||
@key 列表 |
|||
@op 插入状态 (1:在pivot之后;2:在pivot之前) |
|||
@pivot 定位值 |
|||
@value 要插入值 |
|||
*/ |
|||
func (r *RedisStoreType) LinsertClan(key string, op int, pivot, value interface{}) (int64, bool) { |
|||
BeforeOrAfter := "BEFORE" |
|||
if op != 1 { |
|||
BeforeOrAfter = "AFTER" |
|||
} |
|||
linsert, linsertErr := r.RedisDbClan.LInsert(r.Context, key, BeforeOrAfter, pivot, value).Result() |
|||
if linsertErr != nil { |
|||
return 0, false |
|||
} |
|||
return linsert, true |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lindex 命令用于通过索引获取列表中的元素。你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 |
|||
@key 列表 |
|||
@index 索引 |
|||
*/ |
|||
func (r *RedisStoreType) LindexClan(key string, index int64) (val string, err error) { |
|||
val, err = r.RedisDbClan.LIndex(r.Context, key, index).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Llen 命令用于返回列表的长度。 如果列表 key 不存在,则 key 被解释为一个空列表,返回 0 。 如果 key 不是列表类型,返回一个错误。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) LlenClan(key string) (val int64, err error) { |
|||
val, err = r.RedisDbClan.LLen(r.Context, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lpop 命令用于移除并返回列表的第一个元素。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) LpopClan(key string) (val string, err error) { |
|||
val, err = r.RedisDbClan.LPop(r.Context, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lpush 命令将一个或多个值插入到列表头部。 如果 key 不存在,一个空列表会被创建并执行 LPUSH 操作。 当 key 存在但不是列表类型时,返回一个错误。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) LpushClan(key string, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDbClan.LPush(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lpushx 将一个值插入到已存在的列表头部,列表不存在时操作无效。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) LpushxClan(key, value string) (val int64, err error) { |
|||
val, err = r.RedisDbClan.LPushX(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lrange 返回列表中指定区间内的元素,区间以偏移量 START 和 END 指定。 其中 0 表示列表的第一个元素, 1 表示列表的第二个元素,以此类推。 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 |
|||
@key 列表 |
|||
@start 起始值 |
|||
@stop 结束值 |
|||
*/ |
|||
func (r *RedisStoreType) LrangeClan(key string, start, stop int64) (val []string, err error) { |
|||
val, err = r.RedisDbClan.LRange(r.Context, key, start, stop).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lrem 根据参数 COUNT 的值,移除列表中与参数 VALUE 相等的元素。 |
|||
COUNT 的值可以是以下几种: |
|||
|
|||
count > 0 : 从表头开始向表尾搜索,移除与 VALUE 相等的元素,数量为 COUNT 。 |
|||
count < 0 : 从表尾开始向表头搜索,移除与 VALUE 相等的元素,数量为 COUNT 的绝对值。 |
|||
count = 0 : 移除表中所有与 VALUE 相等的值。 |
|||
|
|||
@start = COUNT |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) LremClan(key string, start int64, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDbClan.LRem(r.Context, key, start, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Redis Lset 通过索引来设置元素的值。 |
|||
|
|||
当索引参数超出范围,或对一个空列表进行 LSET 时,返回一个错误。 |
|||
@key 列表 |
|||
@indexes 索引值 |
|||
*/ |
|||
func (r *RedisStoreType) LsetClan(key string, indexes int64, value ...interface{}) (val string, err error) { |
|||
val, err = r.RedisDbClan.LSet(r.Context, key, indexes, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Ltrim 对一个列表进行修剪(trim),就是说,让列表只保留指定区间内的元素,不在指定区间之内的元素都将被删除。 |
|||
|
|||
下标 0 表示列表的第一个元素,以 1 表示列表的第二个元素,以此类推。 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 |
|||
@key 列表 |
|||
@start 起始值 |
|||
@stop 结束值 |
|||
*/ |
|||
func (r *RedisStoreType) LtrimClan(key string, start, stop int64) (val string, err error) { |
|||
val, err = r.RedisDbClan.LTrim(r.Context, key, start, stop).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpop 命令用于移除列表的最后一个元素,返回值为移除的元素。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) RpopClan(key string) (val string, err error) { |
|||
val, err = r.RedisDbClan.RPop(r.Context, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpoplpush 命令用于移除列表的最后一个元素,并将该元素添加到另一个列表并返回。 |
|||
@sourceKey 源列表 |
|||
@newKey 目标列表 |
|||
*/ |
|||
func (r *RedisStoreType) RpoplpushClan(sourceKey, newKey string) (val string, err error) { |
|||
val, err = r.RedisDbClan.RPopLPush(r.Context, sourceKey, newKey).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpush 命令用于将一个或多个值插入到列表的尾部(最右边)。 |
|||
如果列表不存在,一个空列表会被创建并执行 RPUSH 操作。 当列表存在但不是列表类型时,返回一个错误。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) RpushClan(key string, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDbClan.RPush(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpushx 命令用于将一个值插入到已存在的列表尾部(最右边)。如果列表不存在,操作无效。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) RpushxClan(key string, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDbClan.RPushX(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Blpop 命令移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) BlpopClan(key string) (val []string, err error) { |
|||
val, err = r.RedisDbClan.BLPop(r.Context, r.Expiration, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Brpop 命令移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) BrpopClan(key string) (val []string, err error) { |
|||
val, err = r.RedisDbClan.BRPop(r.Context, r.Expiration, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Brpoplpush 命令从列表中取出最后一个元素,并插入到另外一个列表的头部; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 |
|||
@source 源列表 |
|||
@destination 目标列表 |
|||
*/ |
|||
func (r *RedisStoreType) BrpoplpushClan(source, destination string) (val string, err error) { |
|||
val, err = r.RedisDbClan.BRPopLPush(r.Context, source, destination, r.Expiration).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
Redis 键Clan(key) |
|||
Redis 键命令用于管理 redis 的键。 |
|||
*/ |
|||
|
|||
/* |
|||
Redis SCAN 命令 |
|||
Redis Scan 命令用于迭代数据库中的数据库键。 |
|||
|
|||
SCAN 命令是一个基于游标的迭代器,每次被调用之后, 都会向用户返回一个新的游标, 用户在下次迭代时需要使用这个新游标作为 SCAN 命令的游标参数, 以此来延续之前的迭代过程。 |
|||
|
|||
SCAN 返回一个包含两个元素的数组, 第一个元素是用于进行下一次迭代的新游标, 而第二个元素则是一个数组, 这个数组中包含了所有被迭代的元素。如果新游标返回 0 表示迭代已结束。 |
|||
|
|||
相关命令: |
|||
|
|||
SSCAN 命令用于迭代集合键中的元素。 |
|||
HSCAN 命令用于迭代哈希键中的键值对。 |
|||
ZSCAN 命令用于迭代有序集合中的元素(包括元素成员和元素分值)。 |
|||
*/ |
|||
|
|||
func (r *RedisStoreType) ScanClan(cursor uint64, match string, count int64) (keys []string, cursores uint64, err error) { |
|||
keys, cursores, err = r.RedisDbClan.Scan(r.Context, cursor, match, count).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
*Keys 命令用于查找所有符合给定模式 pattern 的 key 。。 |
|||
*/ |
|||
func (r *RedisStoreType) KeysClan(key string) (val []string, err error) { |
|||
val, err = r.RedisDbClan.Keys(r.Context, key).Result() |
|||
return |
|||
} |
|||
@ -0,0 +1 @@ |
|||
package overall |
|||
Loading…
Reference in new issue