|
@ -42,6 +42,25 @@ func ZAdd(key string, score, member interface{}) (int64, error) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* 存值 |
|
|
|
|
|
* key 域 |
|
|
|
|
|
* member 成员 |
|
|
|
|
|
* score 分值 |
|
|
|
|
|
*/ |
|
|
|
|
|
func ZAddFloat(key string, score, member interface{}) (float64, error) { |
|
|
|
|
|
c := GetConn() |
|
|
|
|
|
|
|
|
|
|
|
reply, err := c.Do("ZADD", key, score, member) |
|
|
|
|
|
CloseConn(c) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} else { |
|
|
|
|
|
return redisdb.Float64(reply, nil) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* 删除hash值 |
|
|
* 删除hash值 |
|
|
*/ |
|
|
*/ |
|
@ -98,6 +117,26 @@ func ZIncrBy(key string, inc, member interface{}) (int64, error) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* 自增 |
|
|
|
|
|
* key 域 |
|
|
|
|
|
* member 成员 |
|
|
|
|
|
* inc 分值 |
|
|
|
|
|
*/ |
|
|
|
|
|
func ZIncrByFloat(key string, inc, member interface{}) (float64, error) { |
|
|
|
|
|
c := GetConn() |
|
|
|
|
|
|
|
|
|
|
|
reply, err := c.Do("ZINCRBY", key, inc, member) |
|
|
|
|
|
CloseConn(c) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} else { |
|
|
|
|
|
return redisdb.Float64(reply, nil) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func ZRange(key string, start, stop int64) ([]map[string]string, error) { |
|
|
func ZRange(key string, start, stop int64) ([]map[string]string, error) { |
|
|
c := GetConn() |
|
|
c := GetConn() |
|
|
defer CloseConn(c) |
|
|
defer CloseConn(c) |
|
|