mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
redis replace to go_redis
This commit is contained in:
+19
-23
@@ -1,9 +1,5 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
log2 "Open_IM/pkg/common/log"
|
||||
)
|
||||
|
||||
const (
|
||||
accountTempCode = "ACCOUNT_TEMP_CODE"
|
||||
resetPwdTempCode = "RESET_PWD_TEMP_CODE"
|
||||
@@ -23,25 +19,25 @@ const (
|
||||
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
|
||||
)
|
||||
|
||||
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
||||
con := d.redisPool.Get()
|
||||
if err := con.Err(); err != nil {
|
||||
log2.Error("", "", "redis cmd = %v, err = %v", cmd, err)
|
||||
return nil, err
|
||||
}
|
||||
defer con.Close()
|
||||
|
||||
params := make([]interface{}, 0)
|
||||
params = append(params, key)
|
||||
|
||||
if len(args) > 0 {
|
||||
for _, v := range args {
|
||||
params = append(params, v)
|
||||
}
|
||||
}
|
||||
|
||||
return con.Do(cmd, params...)
|
||||
}
|
||||
//func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
||||
// con := d.redisPool.Get()
|
||||
// if err := con.Err(); err != nil {
|
||||
// log2.Error("", "", "redis cmd = %v, err = %v", cmd, err)
|
||||
// return nil, err
|
||||
// }
|
||||
// defer con.Close()
|
||||
//
|
||||
// params := make([]interface{}, 0)
|
||||
// params = append(params, key)
|
||||
//
|
||||
// if len(args) > 0 {
|
||||
// for _, v := range args {
|
||||
// params = append(params, v)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return con.Do(cmd, params...)
|
||||
//}
|
||||
|
||||
//func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
|
||||
// key := accountTempCode + account
|
||||
|
||||
Reference in New Issue
Block a user