Browse Source

增加HList方法

master
guzeng 2 years ago
parent
commit
e940890234
1 changed files with 30 additions and 0 deletions
  1. +30
    -0
      hash.go

+ 30
- 0
hash.go View File

@ -96,6 +96,36 @@ func HGetAll(key string) ([]map[string]string, error) {
} }
//hash取所有值
func HGetList(key string) ([]string, error) {
c := GetConn()
ret, err := c.Do("HGETAll", key)
reply := make([][]byte, 0)
if err == nil {
reply, err = redisdb.ByteSlices(ret, err)
}
// var info map[string]string
var all []string
if len(values) > 0 {
for key, item := range values {
if (key+1)%2 == 0 { //只处理偶数位
all = append(all, string(item))
}
}
}
CloseConn(c)
return all, err
}
/* /*
* hash存值, * hash存值,
* key * key


Loading…
Cancel
Save