mirror of
https://github.com/redis/go-redis.git
synced 2025-07-26 19:21:03 +03:00
Merge pull request #304 from go-redis/fix/rename-zrangebyscore
Rename ZRangeByScore to ZRange since it is used in ZRangeByLex.
This commit is contained in:
19
commands.go
19
commands.go
@ -1169,13 +1169,12 @@ func (c *commandable) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
|
||||
return cmd
|
||||
}
|
||||
|
||||
// TODO: Rename to something more generic in v4
|
||||
type ZRangeByScore struct {
|
||||
type ZRangeBy struct {
|
||||
Min, Max string
|
||||
Offset, Count int64
|
||||
}
|
||||
|
||||
func (c *commandable) zRangeBy(zcmd, key string, opt ZRangeByScore, withScores bool) *StringSliceCmd {
|
||||
func (c *commandable) zRangeBy(zcmd, key string, opt ZRangeBy, withScores bool) *StringSliceCmd {
|
||||
args := []interface{}{zcmd, key, opt.Min, opt.Max}
|
||||
if withScores {
|
||||
args = append(args, "WITHSCORES")
|
||||
@ -1193,15 +1192,15 @@ func (c *commandable) zRangeBy(zcmd, key string, opt ZRangeByScore, withScores b
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd {
|
||||
func (c *commandable) ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd {
|
||||
return c.zRangeBy("ZRANGEBYSCORE", key, opt, false)
|
||||
}
|
||||
|
||||
func (c *commandable) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd {
|
||||
func (c *commandable) ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd {
|
||||
return c.zRangeBy("ZRANGEBYLEX", key, opt, false)
|
||||
}
|
||||
|
||||
func (c *commandable) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd {
|
||||
func (c *commandable) ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd {
|
||||
args := []interface{}{"ZRANGEBYSCORE", key, opt.Min, opt.Max, "WITHSCORES"}
|
||||
if opt.Offset != 0 || opt.Count != 0 {
|
||||
args = append(
|
||||
@ -1263,7 +1262,7 @@ func (c *commandable) ZRevRangeWithScores(key string, start, stop int64) *ZSlice
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) zRevRangeBy(zcmd, key string, opt ZRangeByScore) *StringSliceCmd {
|
||||
func (c *commandable) zRevRangeBy(zcmd, key string, opt ZRangeBy) *StringSliceCmd {
|
||||
args := []interface{}{zcmd, key, opt.Max, opt.Min}
|
||||
if opt.Offset != 0 || opt.Count != 0 {
|
||||
args = append(
|
||||
@ -1278,15 +1277,15 @@ func (c *commandable) zRevRangeBy(zcmd, key string, opt ZRangeByScore) *StringSl
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd {
|
||||
func (c *commandable) ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd {
|
||||
return c.zRevRangeBy("ZREVRANGEBYSCORE", key, opt)
|
||||
}
|
||||
|
||||
func (c *commandable) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd {
|
||||
func (c *commandable) ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd {
|
||||
return c.zRevRangeBy("ZREVRANGEBYLEX", key, opt)
|
||||
}
|
||||
|
||||
func (c *commandable) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd {
|
||||
func (c *commandable) ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd {
|
||||
args := []interface{}{"ZREVRANGEBYSCORE", key, opt.Max, opt.Min, "WITHSCORES"}
|
||||
if opt.Offset != 0 || opt.Count != 0 {
|
||||
args = append(
|
||||
|
Reference in New Issue
Block a user