Commit 0a8a520f by xuzhenhao

增加了redis工具库中的方法

1 parent a457569b
Showing with 12 additions and 4 deletions
......@@ -229,9 +229,13 @@ func RedisZRank(conn redis.Conn, key string, member string) (reply interface{},
*/
func RedisZRangeByScore(conn redis.Conn, key string, startScore string, endScore string, limit string, limitStart int, limitEnd int) (reply []string, err error) {
if limit == "true" {
return RedisCommand(conn, "zrangebyscore", key, startScore, endScore, "withscore", "limit", limitStart, limitEnd)
res, err := RedisCommand(conn, "zrangebyscore", key, startScore, endScore, "withscore", "limit", limitStart, limitEnd)
reply, _ = redis.Strings(res, nil)
return
}
return RedisCommand(conn, "zrangebyscore", key, startScore, endScore, "withscore")
res, err := RedisCommand(conn, "zrangebyscore", key, startScore, endScore, "withscore")
reply, _ = redis.Strings(res, nil)
return
}
/*
......@@ -239,9 +243,13 @@ func RedisZRangeByScore(conn redis.Conn, key string, startScore string, endScore
*/
func RedisZRevRangeByScore(conn redis.Conn, key string, startScore string, endScore string, limit string, limitStart int, limitEnd int) (reply []string, err error) {
if limit == "true" {
return RedisCommand(conn, "zrevrangebyscore", key, startScore, endScore, "withscore", "limit", limitStart, limitEnd)
res, err := RedisCommand(conn, "zrevrangebyscore", key, startScore, endScore, "withscore", "limit", limitStart, limitEnd)
reply, _ = redis.Strings(res, nil)
return
}
return RedisCommand(conn, "zrevrangebyscore", key, startScore, endScore, "withscore")
res, err := RedisCommand(conn, "zrevrangebyscore", key, startScore, endScore, "withscore")
reply, _ = redis.Strings(res, nil)
return
}
/*
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!