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.

44 lines
823 B

  1. package redisrpc
  2. import (
  3. // "strconv"
  4. "testing"
  5. // "tgo/helper"
  6. )
  7. func Test_HSet(t *testing.T) {
  8. // val := map[string]interface{}{"id": "123", "name": "这是一个测试", "dis": "xxx"}
  9. reply, err := HSet("testing2", "test1", "val")
  10. t.Log(reply)
  11. t.Log(err)
  12. ret, err := HGetString("testing", "test")
  13. t.Log(ret)
  14. if err == nil {
  15. t.Log("nil", err)
  16. } else {
  17. t.Log("error:", err)
  18. }
  19. // ret2, err := HSetExpire("testing2", 200)
  20. // t.Log(ret2)
  21. // t.Log(err)
  22. // ret3, err := HMSet("testing2", "test1", "test1")
  23. // t.Log(ret3)
  24. // t.Log(err)
  25. // ret4, err := HGetAll("1000064_product")
  26. // // ret := ret4.([]interface{})
  27. // // t.Log()
  28. // for _, val := range ret4 {
  29. // // str := strconv.FormatUint(val.([]uint64), 10)
  30. // // t.Log(helper.ToStr(val))
  31. // t.Log(string(val))
  32. // }
  33. // t.Log(err)
  34. }