|
@ -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 域 |
|
|