redis rpc服务, 提供redis操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
954 B

package redisrpc
import (
// "strconv"
"testing"
// "tgo/helper"
)
func Test_HSet(t *testing.T) {
// val := map[string]interface{}{"id": "123", "name": "这是一个测试", "dis": "xxx"}
reply, err := HSet("testing", "test", "test1")
t.Log(reply)
t.Log(err)
ret, err := HGetString("testing", "test")
t.Log(ret)
if err == nil {
t.Log("nil", err)
} else {
t.Log("error:", err)
}
del_ret, err := HDel("testing", "test")
t.Log(del_ret)
if err == nil {
t.Log("nil", err)
} else {
t.Log("error:", err)
}
// ret2, err := HSetExpire("testing2", 200)
// t.Log(ret2)
// t.Log(err)
// ret3, err := HMSet("testing2", "test1", "test1")
// t.Log(ret3)
// t.Log(err)
// ret4, err := HGetAll("1000064_product")
// // ret := ret4.([]interface{})
// // t.Log()
// for _, val := range ret4 {
// // str := strconv.FormatUint(val.([]uint64), 10)
// // t.Log(helper.ToStr(val))
// t.Log(string(val))
// }
// t.Log(err)
}