mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: redis支持工单流程审批
This commit is contained in:
@@ -2,6 +2,7 @@ package rdm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"mayfly-go/pkg/errorx"
|
||||
"mayfly-go/pkg/logx"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
@@ -32,6 +33,19 @@ func (r *RedisConn) Scan(cursor uint64, match string, count int64) ([]string, ui
|
||||
return r.GetCmdable().Scan(context.Background(), cursor, match, count).Result()
|
||||
}
|
||||
|
||||
// 执行redis命令
|
||||
// 如: SET str value命令则args为['SET', 'str', 'val']
|
||||
func (r *RedisConn) RunCmd(ctx context.Context, args ...any) (any, error) {
|
||||
redisMode := r.Info.Mode
|
||||
if redisMode == "" || redisMode == StandaloneMode || r.Info.Mode == SentinelMode {
|
||||
return r.Cli.Do(ctx, args...).Result()
|
||||
}
|
||||
if redisMode == ClusterMode {
|
||||
return r.ClusterCli.Do(ctx, args...).Result()
|
||||
}
|
||||
return nil, errorx.NewBiz("redis mode error")
|
||||
}
|
||||
|
||||
func (r *RedisConn) Close() {
|
||||
mode := r.Info.Mode
|
||||
if mode == StandaloneMode || mode == SentinelMode {
|
||||
|
||||
Reference in New Issue
Block a user