redis client支持设置mock模式

This commit is contained in:
2025-04-21 16:42:28 +08:00
parent ac633385b7
commit 5d1ebcf505
4 changed files with 28 additions and 2 deletions

View File

@ -10,8 +10,8 @@ package abstract
import (
"context"
"git.zhangdeman.cn/zhangdeman/consts"
"git.zhangdeman.cn/zhangdeman/redis/define"
"github.com/go-redis/redismock/v9"
"go.uber.org/zap"
)
@ -28,4 +28,6 @@ type IRedisClient interface {
SetLogger(loggerInstance *zap.Logger, extraLogFieldList []string) // 设置日志实例, 全局生效, 而非针对某一个实例
Exec(ctx context.Context, instanceFlag string, command consts.RedisCmd, args ...any) *define.RedisResult // 执行任意命令
SetCommandWhiteList(command []consts.RedisCmd) // 设置命令的白名单,全局生效, 而非单独针对某一个实例
SetMockMode() // 设置mock模式, 这是单元测试专用的, 生产环境不要使用!!!!!!
GetMockInstance() redismock.ClientMock // 数据mock实例
}