refactor: db/redis/mongo连接代码包独立

This commit is contained in:
meilin.huang
2023-10-27 17:41:45 +08:00
parent a1303b52eb
commit 12f63ef3dd
45 changed files with 1112 additions and 950 deletions

View File

@@ -11,7 +11,7 @@ import (
)
func (r *Redis) GetStringValue(rc *req.Ctx) {
ri, key := r.checkKeyAndGetRedisIns(rc)
ri, key := r.checkKeyAndGetRedisConn(rc)
str, err := ri.GetCmdable().Get(context.TODO(), key).Result()
biz.ErrIsNilAppendErr(err, "获取字符串值失败: %s")
rc.ResData = str
@@ -22,7 +22,7 @@ func (r *Redis) SetStringValue(rc *req.Ctx) {
keyValue := new(form.StringValue)
ginx.BindJsonAndValid(g, keyValue)
ri := r.getRedisIns(rc)
ri := r.getRedisConn(rc)
cmd := ri.GetCmdable()
rc.ReqParam = collx.Kvs("redis", ri.Info, "string", keyValue)