forked from mirror/redis
Pass pointers where it makes sense
This commit is contained in:
parent
458982a440
commit
685d8922de
|
@ -188,7 +188,7 @@ func BenchmarkZAdd(b *testing.B) {
|
||||||
|
|
||||||
b.RunParallel(func(pb *testing.PB) {
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
for pb.Next() {
|
for pb.Next() {
|
||||||
err := client.ZAdd("key", redis.Z{
|
err := client.ZAdd("key", &redis.Z{
|
||||||
Score: float64(1),
|
Score: float64(1),
|
||||||
Member: "hello",
|
Member: "hello",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
|
48
command.go
48
command.go
|
@ -1220,7 +1220,7 @@ func xPendingParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
type XPendingExt struct {
|
type XPendingExt struct {
|
||||||
Id string
|
ID string
|
||||||
Consumer string
|
Consumer string
|
||||||
Idle time.Duration
|
Idle time.Duration
|
||||||
RetryCount int64
|
RetryCount int64
|
||||||
|
@ -1290,7 +1290,7 @@ func xPendingExtSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = append(ret, XPendingExt{
|
ret = append(ret, XPendingExt{
|
||||||
Id: id,
|
ID: id,
|
||||||
Consumer: consumer,
|
Consumer: consumer,
|
||||||
Idle: time.Duration(idle) * time.Millisecond,
|
Idle: time.Duration(idle) * time.Millisecond,
|
||||||
RetryCount: retryCount,
|
RetryCount: retryCount,
|
||||||
|
@ -1370,7 +1370,7 @@ func zSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
type ZWithKeyCmd struct {
|
type ZWithKeyCmd struct {
|
||||||
baseCmd
|
baseCmd
|
||||||
|
|
||||||
val ZWithKey
|
val *ZWithKey
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Cmder = (*ZWithKeyCmd)(nil)
|
var _ Cmder = (*ZWithKeyCmd)(nil)
|
||||||
|
@ -1381,11 +1381,11 @@ func NewZWithKeyCmd(args ...interface{}) *ZWithKeyCmd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *ZWithKeyCmd) Val() ZWithKey {
|
func (cmd *ZWithKeyCmd) Val() *ZWithKey {
|
||||||
return cmd.val
|
return cmd.val
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *ZWithKeyCmd) Result() (ZWithKey, error) {
|
func (cmd *ZWithKeyCmd) Result() (*ZWithKey, error) {
|
||||||
return cmd.Val(), cmd.Err()
|
return cmd.Val(), cmd.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1399,7 +1399,7 @@ func (cmd *ZWithKeyCmd) readReply(rd *proto.Reader) error {
|
||||||
if cmd.err != nil {
|
if cmd.err != nil {
|
||||||
return cmd.err
|
return cmd.err
|
||||||
}
|
}
|
||||||
cmd.val = v.(ZWithKey)
|
cmd.val = v.(*ZWithKey)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,7 +1424,8 @@ func zWithKeyParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return z, nil
|
|
||||||
|
return &z, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -1787,25 +1788,7 @@ func (cmd *GeoPosCmd) readReply(rd *proto.Reader) error {
|
||||||
func geoPosSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
|
func geoPosSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
positions := make([]*GeoPos, 0, n)
|
positions := make([]*GeoPos, 0, n)
|
||||||
for i := int64(0); i < n; i++ {
|
for i := int64(0); i < n; i++ {
|
||||||
v, err := rd.ReadReply(geoPosParser)
|
_, err := rd.ReadReply(func(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
if err != nil {
|
|
||||||
if err == Nil {
|
|
||||||
positions = append(positions, nil)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
switch v := v.(type) {
|
|
||||||
case *GeoPos:
|
|
||||||
positions = append(positions, v)
|
|
||||||
default:
|
|
||||||
return nil, fmt.Errorf("got %T, expected *GeoPos", v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return positions, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func geoPosParser(rd *proto.Reader, n int64) (interface{}, error) {
|
|
||||||
var pos GeoPos
|
var pos GeoPos
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -1819,7 +1802,18 @@ func geoPosParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pos, nil
|
positions = append(positions, &pos)
|
||||||
|
return nil, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
if err == Nil {
|
||||||
|
positions = append(positions, nil)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return positions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
80
commands.go
80
commands.go
|
@ -189,27 +189,27 @@ type Cmdable interface {
|
||||||
XTrimApprox(key string, maxLen int64) *IntCmd
|
XTrimApprox(key string, maxLen int64) *IntCmd
|
||||||
BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
|
BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
|
||||||
BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
|
BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
|
||||||
ZAdd(key string, members ...Z) *IntCmd
|
ZAdd(key string, members ...*Z) *IntCmd
|
||||||
ZAddNX(key string, members ...Z) *IntCmd
|
ZAddNX(key string, members ...*Z) *IntCmd
|
||||||
ZAddXX(key string, members ...Z) *IntCmd
|
ZAddXX(key string, members ...*Z) *IntCmd
|
||||||
ZAddCh(key string, members ...Z) *IntCmd
|
ZAddCh(key string, members ...*Z) *IntCmd
|
||||||
ZAddNXCh(key string, members ...Z) *IntCmd
|
ZAddNXCh(key string, members ...*Z) *IntCmd
|
||||||
ZAddXXCh(key string, members ...Z) *IntCmd
|
ZAddXXCh(key string, members ...*Z) *IntCmd
|
||||||
ZIncr(key string, member Z) *FloatCmd
|
ZIncr(key string, member *Z) *FloatCmd
|
||||||
ZIncrNX(key string, member Z) *FloatCmd
|
ZIncrNX(key string, member *Z) *FloatCmd
|
||||||
ZIncrXX(key string, member Z) *FloatCmd
|
ZIncrXX(key string, member *Z) *FloatCmd
|
||||||
ZCard(key string) *IntCmd
|
ZCard(key string) *IntCmd
|
||||||
ZCount(key, min, max string) *IntCmd
|
ZCount(key, min, max string) *IntCmd
|
||||||
ZLexCount(key, min, max string) *IntCmd
|
ZLexCount(key, min, max string) *IntCmd
|
||||||
ZIncrBy(key string, increment float64, member string) *FloatCmd
|
ZIncrBy(key string, increment float64, member string) *FloatCmd
|
||||||
ZInterStore(destination string, store ZStore, keys ...string) *IntCmd
|
ZInterStore(destination string, store *ZStore, keys ...string) *IntCmd
|
||||||
ZPopMax(key string, count ...int64) *ZSliceCmd
|
ZPopMax(key string, count ...int64) *ZSliceCmd
|
||||||
ZPopMin(key string, count ...int64) *ZSliceCmd
|
ZPopMin(key string, count ...int64) *ZSliceCmd
|
||||||
ZRange(key string, start, stop int64) *StringSliceCmd
|
ZRange(key string, start, stop int64) *StringSliceCmd
|
||||||
ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
|
ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
|
||||||
ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd
|
ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
|
||||||
ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd
|
ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
|
||||||
ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd
|
ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
|
||||||
ZRank(key, member string) *IntCmd
|
ZRank(key, member string) *IntCmd
|
||||||
ZRem(key string, members ...interface{}) *IntCmd
|
ZRem(key string, members ...interface{}) *IntCmd
|
||||||
ZRemRangeByRank(key string, start, stop int64) *IntCmd
|
ZRemRangeByRank(key string, start, stop int64) *IntCmd
|
||||||
|
@ -217,12 +217,12 @@ type Cmdable interface {
|
||||||
ZRemRangeByLex(key, min, max string) *IntCmd
|
ZRemRangeByLex(key, min, max string) *IntCmd
|
||||||
ZRevRange(key string, start, stop int64) *StringSliceCmd
|
ZRevRange(key string, start, stop int64) *StringSliceCmd
|
||||||
ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
|
ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
|
||||||
ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd
|
ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
|
||||||
ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd
|
ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
|
||||||
ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd
|
ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
|
||||||
ZRevRank(key, member string) *IntCmd
|
ZRevRank(key, member string) *IntCmd
|
||||||
ZScore(key, member string) *FloatCmd
|
ZScore(key, member string) *FloatCmd
|
||||||
ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd
|
ZUnionStore(dest string, store *ZStore, keys ...string) *IntCmd
|
||||||
PFAdd(key string, els ...interface{}) *IntCmd
|
PFAdd(key string, els ...interface{}) *IntCmd
|
||||||
PFCount(keys ...string) *IntCmd
|
PFCount(keys ...string) *IntCmd
|
||||||
PFMerge(dest string, keys ...string) *StatusCmd
|
PFMerge(dest string, keys ...string) *StatusCmd
|
||||||
|
@ -1453,8 +1453,7 @@ func (c *cmdable) XGroupDelConsumer(stream, group, consumer string) *IntCmd {
|
||||||
type XReadGroupArgs struct {
|
type XReadGroupArgs struct {
|
||||||
Group string
|
Group string
|
||||||
Consumer string
|
Consumer string
|
||||||
// List of streams and ids.
|
Streams []string // list of streams and ids, e.g. stream1 stream2 id1 id2
|
||||||
Streams []string
|
|
||||||
Count int64
|
Count int64
|
||||||
Block time.Duration
|
Block time.Duration
|
||||||
NoAck bool
|
NoAck bool
|
||||||
|
@ -1618,7 +1617,7 @@ func (c *cmdable) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) zAdd(a []interface{}, n int, members ...Z) *IntCmd {
|
func (c *cmdable) zAdd(a []interface{}, n int, members ...*Z) *IntCmd {
|
||||||
for i, m := range members {
|
for i, m := range members {
|
||||||
a[n+2*i] = m.Score
|
a[n+2*i] = m.Score
|
||||||
a[n+2*i+1] = m.Member
|
a[n+2*i+1] = m.Member
|
||||||
|
@ -1629,7 +1628,7 @@ func (c *cmdable) zAdd(a []interface{}, n int, members ...Z) *IntCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key score member [score member ...]` command.
|
// Redis `ZADD key score member [score member ...]` command.
|
||||||
func (c *cmdable) ZAdd(key string, members ...Z) *IntCmd {
|
func (c *cmdable) ZAdd(key string, members ...*Z) *IntCmd {
|
||||||
const n = 2
|
const n = 2
|
||||||
a := make([]interface{}, n+2*len(members))
|
a := make([]interface{}, n+2*len(members))
|
||||||
a[0], a[1] = "zadd", key
|
a[0], a[1] = "zadd", key
|
||||||
|
@ -1637,7 +1636,7 @@ func (c *cmdable) ZAdd(key string, members ...Z) *IntCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key NX score member [score member ...]` command.
|
// Redis `ZADD key NX score member [score member ...]` command.
|
||||||
func (c *cmdable) ZAddNX(key string, members ...Z) *IntCmd {
|
func (c *cmdable) ZAddNX(key string, members ...*Z) *IntCmd {
|
||||||
const n = 3
|
const n = 3
|
||||||
a := make([]interface{}, n+2*len(members))
|
a := make([]interface{}, n+2*len(members))
|
||||||
a[0], a[1], a[2] = "zadd", key, "nx"
|
a[0], a[1], a[2] = "zadd", key, "nx"
|
||||||
|
@ -1645,7 +1644,7 @@ func (c *cmdable) ZAddNX(key string, members ...Z) *IntCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key XX score member [score member ...]` command.
|
// Redis `ZADD key XX score member [score member ...]` command.
|
||||||
func (c *cmdable) ZAddXX(key string, members ...Z) *IntCmd {
|
func (c *cmdable) ZAddXX(key string, members ...*Z) *IntCmd {
|
||||||
const n = 3
|
const n = 3
|
||||||
a := make([]interface{}, n+2*len(members))
|
a := make([]interface{}, n+2*len(members))
|
||||||
a[0], a[1], a[2] = "zadd", key, "xx"
|
a[0], a[1], a[2] = "zadd", key, "xx"
|
||||||
|
@ -1653,7 +1652,7 @@ func (c *cmdable) ZAddXX(key string, members ...Z) *IntCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key CH score member [score member ...]` command.
|
// Redis `ZADD key CH score member [score member ...]` command.
|
||||||
func (c *cmdable) ZAddCh(key string, members ...Z) *IntCmd {
|
func (c *cmdable) ZAddCh(key string, members ...*Z) *IntCmd {
|
||||||
const n = 3
|
const n = 3
|
||||||
a := make([]interface{}, n+2*len(members))
|
a := make([]interface{}, n+2*len(members))
|
||||||
a[0], a[1], a[2] = "zadd", key, "ch"
|
a[0], a[1], a[2] = "zadd", key, "ch"
|
||||||
|
@ -1661,7 +1660,7 @@ func (c *cmdable) ZAddCh(key string, members ...Z) *IntCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key NX CH score member [score member ...]` command.
|
// Redis `ZADD key NX CH score member [score member ...]` command.
|
||||||
func (c *cmdable) ZAddNXCh(key string, members ...Z) *IntCmd {
|
func (c *cmdable) ZAddNXCh(key string, members ...*Z) *IntCmd {
|
||||||
const n = 4
|
const n = 4
|
||||||
a := make([]interface{}, n+2*len(members))
|
a := make([]interface{}, n+2*len(members))
|
||||||
a[0], a[1], a[2], a[3] = "zadd", key, "nx", "ch"
|
a[0], a[1], a[2], a[3] = "zadd", key, "nx", "ch"
|
||||||
|
@ -1669,14 +1668,14 @@ func (c *cmdable) ZAddNXCh(key string, members ...Z) *IntCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key XX CH score member [score member ...]` command.
|
// Redis `ZADD key XX CH score member [score member ...]` command.
|
||||||
func (c *cmdable) ZAddXXCh(key string, members ...Z) *IntCmd {
|
func (c *cmdable) ZAddXXCh(key string, members ...*Z) *IntCmd {
|
||||||
const n = 4
|
const n = 4
|
||||||
a := make([]interface{}, n+2*len(members))
|
a := make([]interface{}, n+2*len(members))
|
||||||
a[0], a[1], a[2], a[3] = "zadd", key, "xx", "ch"
|
a[0], a[1], a[2], a[3] = "zadd", key, "xx", "ch"
|
||||||
return c.zAdd(a, n, members...)
|
return c.zAdd(a, n, members...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) zIncr(a []interface{}, n int, members ...Z) *FloatCmd {
|
func (c *cmdable) zIncr(a []interface{}, n int, members ...*Z) *FloatCmd {
|
||||||
for i, m := range members {
|
for i, m := range members {
|
||||||
a[n+2*i] = m.Score
|
a[n+2*i] = m.Score
|
||||||
a[n+2*i+1] = m.Member
|
a[n+2*i+1] = m.Member
|
||||||
|
@ -1687,7 +1686,7 @@ func (c *cmdable) zIncr(a []interface{}, n int, members ...Z) *FloatCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key INCR score member` command.
|
// Redis `ZADD key INCR score member` command.
|
||||||
func (c *cmdable) ZIncr(key string, member Z) *FloatCmd {
|
func (c *cmdable) ZIncr(key string, member *Z) *FloatCmd {
|
||||||
const n = 3
|
const n = 3
|
||||||
a := make([]interface{}, n+2)
|
a := make([]interface{}, n+2)
|
||||||
a[0], a[1], a[2] = "zadd", key, "incr"
|
a[0], a[1], a[2] = "zadd", key, "incr"
|
||||||
|
@ -1695,7 +1694,7 @@ func (c *cmdable) ZIncr(key string, member Z) *FloatCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key NX INCR score member` command.
|
// Redis `ZADD key NX INCR score member` command.
|
||||||
func (c *cmdable) ZIncrNX(key string, member Z) *FloatCmd {
|
func (c *cmdable) ZIncrNX(key string, member *Z) *FloatCmd {
|
||||||
const n = 4
|
const n = 4
|
||||||
a := make([]interface{}, n+2)
|
a := make([]interface{}, n+2)
|
||||||
a[0], a[1], a[2], a[3] = "zadd", key, "incr", "nx"
|
a[0], a[1], a[2], a[3] = "zadd", key, "incr", "nx"
|
||||||
|
@ -1703,7 +1702,7 @@ func (c *cmdable) ZIncrNX(key string, member Z) *FloatCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redis `ZADD key XX INCR score member` command.
|
// Redis `ZADD key XX INCR score member` command.
|
||||||
func (c *cmdable) ZIncrXX(key string, member Z) *FloatCmd {
|
func (c *cmdable) ZIncrXX(key string, member *Z) *FloatCmd {
|
||||||
const n = 4
|
const n = 4
|
||||||
a := make([]interface{}, n+2)
|
a := make([]interface{}, n+2)
|
||||||
a[0], a[1], a[2], a[3] = "zadd", key, "incr", "xx"
|
a[0], a[1], a[2], a[3] = "zadd", key, "incr", "xx"
|
||||||
|
@ -1734,7 +1733,7 @@ func (c *cmdable) ZIncrBy(key string, increment float64, member string) *FloatCm
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd {
|
func (c *cmdable) ZInterStore(destination string, store *ZStore, keys ...string) *IntCmd {
|
||||||
args := make([]interface{}, 3+len(keys))
|
args := make([]interface{}, 3+len(keys))
|
||||||
args[0] = "zinterstore"
|
args[0] = "zinterstore"
|
||||||
args[1] = destination
|
args[1] = destination
|
||||||
|
@ -1826,7 +1825,7 @@ type ZRangeBy struct {
|
||||||
Offset, Count int64
|
Offset, Count int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) zRangeBy(zcmd, key string, opt ZRangeBy, withScores bool) *StringSliceCmd {
|
func (c *cmdable) zRangeBy(zcmd, key string, opt *ZRangeBy, withScores bool) *StringSliceCmd {
|
||||||
args := []interface{}{zcmd, key, opt.Min, opt.Max}
|
args := []interface{}{zcmd, key, opt.Min, opt.Max}
|
||||||
if withScores {
|
if withScores {
|
||||||
args = append(args, "withscores")
|
args = append(args, "withscores")
|
||||||
|
@ -1844,15 +1843,15 @@ func (c *cmdable) zRangeBy(zcmd, key string, opt ZRangeBy, withScores bool) *Str
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd {
|
func (c *cmdable) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd {
|
||||||
return c.zRangeBy("zrangebyscore", key, opt, false)
|
return c.zRangeBy("zrangebyscore", key, opt, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd {
|
func (c *cmdable) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd {
|
||||||
return c.zRangeBy("zrangebylex", key, opt, false)
|
return c.zRangeBy("zrangebylex", key, opt, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd {
|
func (c *cmdable) ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd {
|
||||||
args := []interface{}{"zrangebyscore", key, opt.Min, opt.Max, "withscores"}
|
args := []interface{}{"zrangebyscore", key, opt.Min, opt.Max, "withscores"}
|
||||||
if opt.Offset != 0 || opt.Count != 0 {
|
if opt.Offset != 0 || opt.Count != 0 {
|
||||||
args = append(
|
args = append(
|
||||||
|
@ -1918,7 +1917,7 @@ func (c *cmdable) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) zRevRangeBy(zcmd, key string, opt ZRangeBy) *StringSliceCmd {
|
func (c *cmdable) zRevRangeBy(zcmd, key string, opt *ZRangeBy) *StringSliceCmd {
|
||||||
args := []interface{}{zcmd, key, opt.Max, opt.Min}
|
args := []interface{}{zcmd, key, opt.Max, opt.Min}
|
||||||
if opt.Offset != 0 || opt.Count != 0 {
|
if opt.Offset != 0 || opt.Count != 0 {
|
||||||
args = append(
|
args = append(
|
||||||
|
@ -1933,15 +1932,15 @@ func (c *cmdable) zRevRangeBy(zcmd, key string, opt ZRangeBy) *StringSliceCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd {
|
func (c *cmdable) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd {
|
||||||
return c.zRevRangeBy("zrevrangebyscore", key, opt)
|
return c.zRevRangeBy("zrevrangebyscore", key, opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd {
|
func (c *cmdable) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd {
|
||||||
return c.zRevRangeBy("zrevrangebylex", key, opt)
|
return c.zRevRangeBy("zrevrangebylex", key, opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd {
|
func (c *cmdable) ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd {
|
||||||
args := []interface{}{"zrevrangebyscore", key, opt.Max, opt.Min, "withscores"}
|
args := []interface{}{"zrevrangebyscore", key, opt.Max, opt.Min, "withscores"}
|
||||||
if opt.Offset != 0 || opt.Count != 0 {
|
if opt.Offset != 0 || opt.Count != 0 {
|
||||||
args = append(
|
args = append(
|
||||||
|
@ -1968,7 +1967,8 @@ func (c *cmdable) ZScore(key, member string) *FloatCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd {
|
// TODO: move keys to ZStore?
|
||||||
|
func (c *cmdable) ZUnionStore(dest string, store *ZStore, keys ...string) *IntCmd {
|
||||||
args := make([]interface{}, 3+len(keys))
|
args := make([]interface{}, 3+len(keys))
|
||||||
args[0] = "zunionstore"
|
args[0] = "zunionstore"
|
||||||
args[1] = dest
|
args[1] = dest
|
||||||
|
|
296
commands_test.go
296
commands_test.go
|
@ -796,7 +796,7 @@ var _ = Describe("Commands", func() {
|
||||||
|
|
||||||
It("should ZScan", func() {
|
It("should ZScan", func() {
|
||||||
for i := 0; i < 1000; i++ {
|
for i := 0; i < 1000; i++ {
|
||||||
err := client.ZAdd("myset", redis.Z{
|
err := client.ZAdd("myset", &redis.Z{
|
||||||
Score: float64(i),
|
Score: float64(i),
|
||||||
Member: fmt.Sprintf("member%d", i),
|
Member: fmt.Sprintf("member%d", i),
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2139,17 +2139,17 @@ var _ = Describe("Commands", func() {
|
||||||
Describe("sorted sets", func() {
|
Describe("sorted sets", func() {
|
||||||
|
|
||||||
It("should BZPopMax", func() {
|
It("should BZPopMax", func() {
|
||||||
err := client.ZAdd("zset1", redis.Z{
|
err := client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset1", redis.Z{
|
err = client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset1", redis.Z{
|
err = client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2157,7 +2157,7 @@ var _ = Describe("Commands", func() {
|
||||||
|
|
||||||
member, err := client.BZPopMax(0, "zset1", "zset2").Result()
|
member, err := client.BZPopMax(0, "zset1", "zset2").Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(member).To(Equal(redis.ZWithKey{
|
Expect(member).To(Equal(&redis.ZWithKey{
|
||||||
Z: redis.Z{
|
Z: redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
|
@ -2175,7 +2175,7 @@ var _ = Describe("Commands", func() {
|
||||||
started <- true
|
started <- true
|
||||||
bZPopMax := client.BZPopMax(0, "zset")
|
bZPopMax := client.BZPopMax(0, "zset")
|
||||||
Expect(bZPopMax.Err()).NotTo(HaveOccurred())
|
Expect(bZPopMax.Err()).NotTo(HaveOccurred())
|
||||||
Expect(bZPopMax.Val()).To(Equal(redis.ZWithKey{
|
Expect(bZPopMax.Val()).To(Equal(&redis.ZWithKey{
|
||||||
Z: redis.Z{
|
Z: redis.Z{
|
||||||
Member: "a",
|
Member: "a",
|
||||||
Score: 1,
|
Score: 1,
|
||||||
|
@ -2193,7 +2193,7 @@ var _ = Describe("Commands", func() {
|
||||||
// ok
|
// ok
|
||||||
}
|
}
|
||||||
|
|
||||||
zAdd := client.ZAdd("zset", redis.Z{
|
zAdd := client.ZAdd("zset", &redis.Z{
|
||||||
Member: "a",
|
Member: "a",
|
||||||
Score: 1,
|
Score: 1,
|
||||||
})
|
})
|
||||||
|
@ -2210,7 +2210,7 @@ var _ = Describe("Commands", func() {
|
||||||
It("should BZPopMax timeout", func() {
|
It("should BZPopMax timeout", func() {
|
||||||
val, err := client.BZPopMax(time.Second, "zset1").Result()
|
val, err := client.BZPopMax(time.Second, "zset1").Result()
|
||||||
Expect(err).To(Equal(redis.Nil))
|
Expect(err).To(Equal(redis.Nil))
|
||||||
Expect(val).To(Equal(redis.ZWithKey{}))
|
Expect(val).To(BeNil())
|
||||||
|
|
||||||
Expect(client.Ping().Err()).NotTo(HaveOccurred())
|
Expect(client.Ping().Err()).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
@ -2221,17 +2221,17 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should BZPopMin", func() {
|
It("should BZPopMin", func() {
|
||||||
err := client.ZAdd("zset1", redis.Z{
|
err := client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset1", redis.Z{
|
err = client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset1", redis.Z{
|
err = client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2239,7 +2239,7 @@ var _ = Describe("Commands", func() {
|
||||||
|
|
||||||
member, err := client.BZPopMin(0, "zset1", "zset2").Result()
|
member, err := client.BZPopMin(0, "zset1", "zset2").Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(member).To(Equal(redis.ZWithKey{
|
Expect(member).To(Equal(&redis.ZWithKey{
|
||||||
Z: redis.Z{
|
Z: redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
|
@ -2257,7 +2257,7 @@ var _ = Describe("Commands", func() {
|
||||||
started <- true
|
started <- true
|
||||||
bZPopMin := client.BZPopMin(0, "zset")
|
bZPopMin := client.BZPopMin(0, "zset")
|
||||||
Expect(bZPopMin.Err()).NotTo(HaveOccurred())
|
Expect(bZPopMin.Err()).NotTo(HaveOccurred())
|
||||||
Expect(bZPopMin.Val()).To(Equal(redis.ZWithKey{
|
Expect(bZPopMin.Val()).To(Equal(&redis.ZWithKey{
|
||||||
Z: redis.Z{
|
Z: redis.Z{
|
||||||
Member: "a",
|
Member: "a",
|
||||||
Score: 1,
|
Score: 1,
|
||||||
|
@ -2275,7 +2275,7 @@ var _ = Describe("Commands", func() {
|
||||||
// ok
|
// ok
|
||||||
}
|
}
|
||||||
|
|
||||||
zAdd := client.ZAdd("zset", redis.Z{
|
zAdd := client.ZAdd("zset", &redis.Z{
|
||||||
Member: "a",
|
Member: "a",
|
||||||
Score: 1,
|
Score: 1,
|
||||||
})
|
})
|
||||||
|
@ -2292,7 +2292,7 @@ var _ = Describe("Commands", func() {
|
||||||
It("should BZPopMin timeout", func() {
|
It("should BZPopMin timeout", func() {
|
||||||
val, err := client.BZPopMin(time.Second, "zset1").Result()
|
val, err := client.BZPopMin(time.Second, "zset1").Result()
|
||||||
Expect(err).To(Equal(redis.Nil))
|
Expect(err).To(Equal(redis.Nil))
|
||||||
Expect(val).To(Equal(redis.ZWithKey{}))
|
Expect(val).To(BeNil())
|
||||||
|
|
||||||
Expect(client.Ping().Err()).NotTo(HaveOccurred())
|
Expect(client.Ping().Err()).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
@ -2303,28 +2303,28 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAdd", func() {
|
It("should ZAdd", func() {
|
||||||
added, err := client.ZAdd("zset", redis.Z{
|
added, err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "uno",
|
Member: "uno",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2346,28 +2346,28 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAdd bytes", func() {
|
It("should ZAdd bytes", func() {
|
||||||
added, err := client.ZAdd("zset", redis.Z{
|
added, err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: []byte("one"),
|
Member: []byte("one"),
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: []byte("uno"),
|
Member: []byte("uno"),
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: []byte("two"),
|
Member: []byte("two"),
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: []byte("two"),
|
Member: []byte("two"),
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2389,7 +2389,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAddNX", func() {
|
It("should ZAddNX", func() {
|
||||||
added, err := client.ZAddNX("zset", redis.Z{
|
added, err := client.ZAddNX("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2400,7 +2400,7 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
||||||
|
|
||||||
added, err = client.ZAddNX("zset", redis.Z{
|
added, err = client.ZAddNX("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2413,7 +2413,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAddXX", func() {
|
It("should ZAddXX", func() {
|
||||||
added, err := client.ZAddXX("zset", redis.Z{
|
added, err := client.ZAddXX("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2424,14 +2424,14 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(BeEmpty())
|
Expect(vals).To(BeEmpty())
|
||||||
|
|
||||||
added, err = client.ZAdd("zset", redis.Z{
|
added, err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
added, err = client.ZAddXX("zset", redis.Z{
|
added, err = client.ZAddXX("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2444,14 +2444,14 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAddCh", func() {
|
It("should ZAddCh", func() {
|
||||||
changed, err := client.ZAddCh("zset", redis.Z{
|
changed, err := client.ZAddCh("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(changed).To(Equal(int64(1)))
|
Expect(changed).To(Equal(int64(1)))
|
||||||
|
|
||||||
changed, err = client.ZAddCh("zset", redis.Z{
|
changed, err = client.ZAddCh("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2460,7 +2460,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAddNXCh", func() {
|
It("should ZAddNXCh", func() {
|
||||||
changed, err := client.ZAddNXCh("zset", redis.Z{
|
changed, err := client.ZAddNXCh("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2471,7 +2471,7 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
||||||
|
|
||||||
changed, err = client.ZAddNXCh("zset", redis.Z{
|
changed, err = client.ZAddNXCh("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2487,7 +2487,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZAddXXCh", func() {
|
It("should ZAddXXCh", func() {
|
||||||
changed, err := client.ZAddXXCh("zset", redis.Z{
|
changed, err := client.ZAddXXCh("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2498,14 +2498,14 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(BeEmpty())
|
Expect(vals).To(BeEmpty())
|
||||||
|
|
||||||
added, err := client.ZAdd("zset", redis.Z{
|
added, err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
changed, err = client.ZAddXXCh("zset", redis.Z{
|
changed, err = client.ZAddXXCh("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2518,7 +2518,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZIncr", func() {
|
It("should ZIncr", func() {
|
||||||
score, err := client.ZIncr("zset", redis.Z{
|
score, err := client.ZIncr("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2529,7 +2529,7 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
||||||
|
|
||||||
score, err = client.ZIncr("zset", redis.Z{Score: 1, Member: "one"}).Result()
|
score, err = client.ZIncr("zset", &redis.Z{Score: 1, Member: "one"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(score).To(Equal(float64(2)))
|
Expect(score).To(Equal(float64(2)))
|
||||||
|
|
||||||
|
@ -2539,7 +2539,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZIncrNX", func() {
|
It("should ZIncrNX", func() {
|
||||||
score, err := client.ZIncrNX("zset", redis.Z{
|
score, err := client.ZIncrNX("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2550,7 +2550,7 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}}))
|
||||||
|
|
||||||
score, err = client.ZIncrNX("zset", redis.Z{
|
score, err = client.ZIncrNX("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2563,7 +2563,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZIncrXX", func() {
|
It("should ZIncrXX", func() {
|
||||||
score, err := client.ZIncrXX("zset", redis.Z{
|
score, err := client.ZIncrXX("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2574,14 +2574,14 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(BeEmpty())
|
Expect(vals).To(BeEmpty())
|
||||||
|
|
||||||
added, err := client.ZAdd("zset", redis.Z{
|
added, err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(added).To(Equal(int64(1)))
|
Expect(added).To(Equal(int64(1)))
|
||||||
|
|
||||||
score, err = client.ZIncrXX("zset", redis.Z{
|
score, err = client.ZIncrXX("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2594,12 +2594,12 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZCard", func() {
|
It("should ZCard", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{
|
err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2611,17 +2611,17 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZCount", func() {
|
It("should ZCount", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{
|
err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2641,12 +2641,12 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZIncrBy", func() {
|
It("should ZIncrBy", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{
|
err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2668,26 +2668,26 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZInterStore", func() {
|
It("should ZInterStore", func() {
|
||||||
err := client.ZAdd("zset1", redis.Z{
|
err := client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset1", redis.Z{
|
err = client.ZAdd("zset1", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
err = client.ZAdd("zset2", redis.Z{Score: 1, Member: "one"}).Err()
|
err = client.ZAdd("zset2", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset2", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset2", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset3", redis.Z{Score: 3, Member: "two"}).Err()
|
err = client.ZAdd("zset3", &redis.Z{Score: 3, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zInterStore := client.ZInterStore(
|
zInterStore := client.ZInterStore(
|
||||||
"out", redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2")
|
"out", &redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2")
|
||||||
Expect(zInterStore.Err()).NotTo(HaveOccurred())
|
Expect(zInterStore.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zInterStore.Val()).To(Equal(int64(2)))
|
Expect(zInterStore.Val()).To(Equal(int64(2)))
|
||||||
|
|
||||||
|
@ -2703,17 +2703,17 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZPopMax", func() {
|
It("should ZPopMax", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{
|
err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2727,7 +2727,7 @@ var _ = Describe("Commands", func() {
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
// adding back 3
|
// adding back 3
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2743,12 +2743,12 @@ var _ = Describe("Commands", func() {
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
// adding back 2 & 3
|
// adding back 2 & 3
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2768,17 +2768,17 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZPopMin", func() {
|
It("should ZPopMin", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{
|
err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2792,7 +2792,7 @@ var _ = Describe("Commands", func() {
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
// adding back 1
|
// adding back 1
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2808,13 +2808,13 @@ var _ = Describe("Commands", func() {
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
// adding back 1 & 2
|
// adding back 1 & 2
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 1,
|
Score: 1,
|
||||||
Member: "one",
|
Member: "one",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 2,
|
Score: 2,
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}).Err()
|
}).Err()
|
||||||
|
@ -2835,11 +2835,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRange", func() {
|
It("should ZRange", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRange := client.ZRange("zset", 0, -1)
|
zRange := client.ZRange("zset", 0, -1)
|
||||||
|
@ -2856,11 +2856,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRangeWithScores", func() {
|
It("should ZRangeWithScores", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
vals, err := client.ZRangeWithScores("zset", 0, -1).Result()
|
vals, err := client.ZRangeWithScores("zset", 0, -1).Result()
|
||||||
|
@ -2892,35 +2892,35 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRangeByScore", func() {
|
It("should ZRangeByScore", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRangeByScore := client.ZRangeByScore("zset", redis.ZRangeBy{
|
zRangeByScore := client.ZRangeByScore("zset", &redis.ZRangeBy{
|
||||||
Min: "-inf",
|
Min: "-inf",
|
||||||
Max: "+inf",
|
Max: "+inf",
|
||||||
})
|
})
|
||||||
Expect(zRangeByScore.Err()).NotTo(HaveOccurred())
|
Expect(zRangeByScore.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zRangeByScore.Val()).To(Equal([]string{"one", "two", "three"}))
|
Expect(zRangeByScore.Val()).To(Equal([]string{"one", "two", "three"}))
|
||||||
|
|
||||||
zRangeByScore = client.ZRangeByScore("zset", redis.ZRangeBy{
|
zRangeByScore = client.ZRangeByScore("zset", &redis.ZRangeBy{
|
||||||
Min: "1",
|
Min: "1",
|
||||||
Max: "2",
|
Max: "2",
|
||||||
})
|
})
|
||||||
Expect(zRangeByScore.Err()).NotTo(HaveOccurred())
|
Expect(zRangeByScore.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zRangeByScore.Val()).To(Equal([]string{"one", "two"}))
|
Expect(zRangeByScore.Val()).To(Equal([]string{"one", "two"}))
|
||||||
|
|
||||||
zRangeByScore = client.ZRangeByScore("zset", redis.ZRangeBy{
|
zRangeByScore = client.ZRangeByScore("zset", &redis.ZRangeBy{
|
||||||
Min: "(1",
|
Min: "(1",
|
||||||
Max: "2",
|
Max: "2",
|
||||||
})
|
})
|
||||||
Expect(zRangeByScore.Err()).NotTo(HaveOccurred())
|
Expect(zRangeByScore.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zRangeByScore.Val()).To(Equal([]string{"two"}))
|
Expect(zRangeByScore.Val()).To(Equal([]string{"two"}))
|
||||||
|
|
||||||
zRangeByScore = client.ZRangeByScore("zset", redis.ZRangeBy{
|
zRangeByScore = client.ZRangeByScore("zset", &redis.ZRangeBy{
|
||||||
Min: "(1",
|
Min: "(1",
|
||||||
Max: "(2",
|
Max: "(2",
|
||||||
})
|
})
|
||||||
|
@ -2929,44 +2929,44 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRangeByLex", func() {
|
It("should ZRangeByLex", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{
|
err := client.ZAdd("zset", &redis.Z{
|
||||||
Score: 0,
|
Score: 0,
|
||||||
Member: "a",
|
Member: "a",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 0,
|
Score: 0,
|
||||||
Member: "b",
|
Member: "b",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{
|
err = client.ZAdd("zset", &redis.Z{
|
||||||
Score: 0,
|
Score: 0,
|
||||||
Member: "c",
|
Member: "c",
|
||||||
}).Err()
|
}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRangeByLex := client.ZRangeByLex("zset", redis.ZRangeBy{
|
zRangeByLex := client.ZRangeByLex("zset", &redis.ZRangeBy{
|
||||||
Min: "-",
|
Min: "-",
|
||||||
Max: "+",
|
Max: "+",
|
||||||
})
|
})
|
||||||
Expect(zRangeByLex.Err()).NotTo(HaveOccurred())
|
Expect(zRangeByLex.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zRangeByLex.Val()).To(Equal([]string{"a", "b", "c"}))
|
Expect(zRangeByLex.Val()).To(Equal([]string{"a", "b", "c"}))
|
||||||
|
|
||||||
zRangeByLex = client.ZRangeByLex("zset", redis.ZRangeBy{
|
zRangeByLex = client.ZRangeByLex("zset", &redis.ZRangeBy{
|
||||||
Min: "[a",
|
Min: "[a",
|
||||||
Max: "[b",
|
Max: "[b",
|
||||||
})
|
})
|
||||||
Expect(zRangeByLex.Err()).NotTo(HaveOccurred())
|
Expect(zRangeByLex.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zRangeByLex.Val()).To(Equal([]string{"a", "b"}))
|
Expect(zRangeByLex.Val()).To(Equal([]string{"a", "b"}))
|
||||||
|
|
||||||
zRangeByLex = client.ZRangeByLex("zset", redis.ZRangeBy{
|
zRangeByLex = client.ZRangeByLex("zset", &redis.ZRangeBy{
|
||||||
Min: "(a",
|
Min: "(a",
|
||||||
Max: "[b",
|
Max: "[b",
|
||||||
})
|
})
|
||||||
Expect(zRangeByLex.Err()).NotTo(HaveOccurred())
|
Expect(zRangeByLex.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zRangeByLex.Val()).To(Equal([]string{"b"}))
|
Expect(zRangeByLex.Val()).To(Equal([]string{"b"}))
|
||||||
|
|
||||||
zRangeByLex = client.ZRangeByLex("zset", redis.ZRangeBy{
|
zRangeByLex = client.ZRangeByLex("zset", &redis.ZRangeBy{
|
||||||
Min: "(a",
|
Min: "(a",
|
||||||
Max: "(b",
|
Max: "(b",
|
||||||
})
|
})
|
||||||
|
@ -2975,14 +2975,14 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRangeByScoreWithScoresMap", func() {
|
It("should ZRangeByScoreWithScoresMap", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{
|
vals, err := client.ZRangeByScoreWithScores("zset", &redis.ZRangeBy{
|
||||||
Min: "-inf",
|
Min: "-inf",
|
||||||
Max: "+inf",
|
Max: "+inf",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -2998,7 +2998,7 @@ var _ = Describe("Commands", func() {
|
||||||
Member: "three",
|
Member: "three",
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
vals, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{
|
vals, err = client.ZRangeByScoreWithScores("zset", &redis.ZRangeBy{
|
||||||
Min: "1",
|
Min: "1",
|
||||||
Max: "2",
|
Max: "2",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -3011,14 +3011,14 @@ var _ = Describe("Commands", func() {
|
||||||
Member: "two",
|
Member: "two",
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
vals, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{
|
vals, err = client.ZRangeByScoreWithScores("zset", &redis.ZRangeBy{
|
||||||
Min: "(1",
|
Min: "(1",
|
||||||
Max: "2",
|
Max: "2",
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "two"}}))
|
Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "two"}}))
|
||||||
|
|
||||||
vals, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{
|
vals, err = client.ZRangeByScoreWithScores("zset", &redis.ZRangeBy{
|
||||||
Min: "(1",
|
Min: "(1",
|
||||||
Max: "(2",
|
Max: "(2",
|
||||||
}).Result()
|
}).Result()
|
||||||
|
@ -3027,11 +3027,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRank", func() {
|
It("should ZRank", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRank := client.ZRank("zset", "three")
|
zRank := client.ZRank("zset", "three")
|
||||||
|
@ -3044,11 +3044,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRem", func() {
|
It("should ZRem", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRem := client.ZRem("zset", "two")
|
zRem := client.ZRem("zset", "two")
|
||||||
|
@ -3067,11 +3067,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRemRangeByRank", func() {
|
It("should ZRemRangeByRank", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRemRangeByRank := client.ZRemRangeByRank("zset", 0, 1)
|
zRemRangeByRank := client.ZRemRangeByRank("zset", 0, 1)
|
||||||
|
@ -3087,11 +3087,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRemRangeByScore", func() {
|
It("should ZRemRangeByScore", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRemRangeByScore := client.ZRemRangeByScore("zset", "-inf", "(2")
|
zRemRangeByScore := client.ZRemRangeByScore("zset", "-inf", "(2")
|
||||||
|
@ -3110,7 +3110,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRemRangeByLex", func() {
|
It("should ZRemRangeByLex", func() {
|
||||||
zz := []redis.Z{
|
zz := []*redis.Z{
|
||||||
{Score: 0, Member: "aaaa"},
|
{Score: 0, Member: "aaaa"},
|
||||||
{Score: 0, Member: "b"},
|
{Score: 0, Member: "b"},
|
||||||
{Score: 0, Member: "c"},
|
{Score: 0, Member: "c"},
|
||||||
|
@ -3137,11 +3137,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRange", func() {
|
It("should ZRevRange", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRevRange := client.ZRevRange("zset", 0, -1)
|
zRevRange := client.ZRevRange("zset", 0, -1)
|
||||||
|
@ -3158,11 +3158,11 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRangeWithScoresMap", func() {
|
It("should ZRevRangeWithScoresMap", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
val, err := client.ZRevRangeWithScores("zset", 0, -1).Result()
|
val, err := client.ZRevRangeWithScores("zset", 0, -1).Result()
|
||||||
|
@ -3194,63 +3194,63 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRangeByScore", func() {
|
It("should ZRevRangeByScore", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
vals, err := client.ZRevRangeByScore(
|
vals, err := client.ZRevRangeByScore(
|
||||||
"zset", redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result()
|
"zset", &redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]string{"three", "two", "one"}))
|
Expect(vals).To(Equal([]string{"three", "two", "one"}))
|
||||||
|
|
||||||
vals, err = client.ZRevRangeByScore(
|
vals, err = client.ZRevRangeByScore(
|
||||||
"zset", redis.ZRangeBy{Max: "2", Min: "(1"}).Result()
|
"zset", &redis.ZRangeBy{Max: "2", Min: "(1"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]string{"two"}))
|
Expect(vals).To(Equal([]string{"two"}))
|
||||||
|
|
||||||
vals, err = client.ZRevRangeByScore(
|
vals, err = client.ZRevRangeByScore(
|
||||||
"zset", redis.ZRangeBy{Max: "(2", Min: "(1"}).Result()
|
"zset", &redis.ZRangeBy{Max: "(2", Min: "(1"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]string{}))
|
Expect(vals).To(Equal([]string{}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRangeByLex", func() {
|
It("should ZRevRangeByLex", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 0, Member: "a"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 0, Member: "a"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 0, Member: "b"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 0, Member: "b"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 0, Member: "c"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 0, Member: "c"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
vals, err := client.ZRevRangeByLex(
|
vals, err := client.ZRevRangeByLex(
|
||||||
"zset", redis.ZRangeBy{Max: "+", Min: "-"}).Result()
|
"zset", &redis.ZRangeBy{Max: "+", Min: "-"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]string{"c", "b", "a"}))
|
Expect(vals).To(Equal([]string{"c", "b", "a"}))
|
||||||
|
|
||||||
vals, err = client.ZRevRangeByLex(
|
vals, err = client.ZRevRangeByLex(
|
||||||
"zset", redis.ZRangeBy{Max: "[b", Min: "(a"}).Result()
|
"zset", &redis.ZRangeBy{Max: "[b", Min: "(a"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]string{"b"}))
|
Expect(vals).To(Equal([]string{"b"}))
|
||||||
|
|
||||||
vals, err = client.ZRevRangeByLex(
|
vals, err = client.ZRevRangeByLex(
|
||||||
"zset", redis.ZRangeBy{Max: "(b", Min: "(a"}).Result()
|
"zset", &redis.ZRangeBy{Max: "(b", Min: "(a"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]string{}))
|
Expect(vals).To(Equal([]string{}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRangeByScoreWithScores", func() {
|
It("should ZRevRangeByScoreWithScores", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
vals, err := client.ZRevRangeByScoreWithScores(
|
vals, err := client.ZRevRangeByScoreWithScores(
|
||||||
"zset", redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result()
|
"zset", &redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{
|
Expect(vals).To(Equal([]redis.Z{{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
|
@ -3265,15 +3265,15 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRangeByScoreWithScoresMap", func() {
|
It("should ZRevRangeByScoreWithScoresMap", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
vals, err := client.ZRevRangeByScoreWithScores(
|
vals, err := client.ZRevRangeByScoreWithScores(
|
||||||
"zset", redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result()
|
"zset", &redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{
|
Expect(vals).To(Equal([]redis.Z{{
|
||||||
Score: 3,
|
Score: 3,
|
||||||
|
@ -3287,22 +3287,22 @@ var _ = Describe("Commands", func() {
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
vals, err = client.ZRevRangeByScoreWithScores(
|
vals, err = client.ZRevRangeByScoreWithScores(
|
||||||
"zset", redis.ZRangeBy{Max: "2", Min: "(1"}).Result()
|
"zset", &redis.ZRangeBy{Max: "2", Min: "(1"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "two"}}))
|
Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "two"}}))
|
||||||
|
|
||||||
vals, err = client.ZRevRangeByScoreWithScores(
|
vals, err = client.ZRevRangeByScoreWithScores(
|
||||||
"zset", redis.ZRangeBy{Max: "(2", Min: "(1"}).Result()
|
"zset", &redis.ZRangeBy{Max: "(2", Min: "(1"}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(vals).To(Equal([]redis.Z{}))
|
Expect(vals).To(Equal([]redis.Z{}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZRevRank", func() {
|
It("should ZRevRank", func() {
|
||||||
err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zRevRank := client.ZRevRank("zset", "one")
|
zRevRank := client.ZRevRank("zset", "one")
|
||||||
|
@ -3315,7 +3315,7 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZScore", func() {
|
It("should ZScore", func() {
|
||||||
zAdd := client.ZAdd("zset", redis.Z{Score: 1.001, Member: "one"})
|
zAdd := client.ZAdd("zset", &redis.Z{Score: 1.001, Member: "one"})
|
||||||
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zScore := client.ZScore("zset", "one")
|
zScore := client.ZScore("zset", "one")
|
||||||
|
@ -3324,20 +3324,20 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZUnionStore", func() {
|
It("should ZUnionStore", func() {
|
||||||
err := client.ZAdd("zset1", redis.Z{Score: 1, Member: "one"}).Err()
|
err := client.ZAdd("zset1", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset1", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset1", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
err = client.ZAdd("zset2", redis.Z{Score: 1, Member: "one"}).Err()
|
err = client.ZAdd("zset2", &redis.Z{Score: 1, Member: "one"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset2", redis.Z{Score: 2, Member: "two"}).Err()
|
err = client.ZAdd("zset2", &redis.Z{Score: 2, Member: "two"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
err = client.ZAdd("zset2", redis.Z{Score: 3, Member: "three"}).Err()
|
err = client.ZAdd("zset2", &redis.Z{Score: 3, Member: "three"}).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zUnionStore := client.ZUnionStore(
|
zUnionStore := client.ZUnionStore(
|
||||||
"out", redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2")
|
"out", &redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2")
|
||||||
Expect(zUnionStore.Err()).NotTo(HaveOccurred())
|
Expect(zUnionStore.Err()).NotTo(HaveOccurred())
|
||||||
Expect(zUnionStore.Val()).To(Equal(int64(3)))
|
Expect(zUnionStore.Val()).To(Equal(int64(3)))
|
||||||
|
|
||||||
|
@ -3622,9 +3622,9 @@ var _ = Describe("Commands", func() {
|
||||||
infoExt[i].Idle = 0
|
infoExt[i].Idle = 0
|
||||||
}
|
}
|
||||||
Expect(infoExt).To(Equal([]redis.XPendingExt{
|
Expect(infoExt).To(Equal([]redis.XPendingExt{
|
||||||
{Id: "1-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
{ID: "1-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
||||||
{Id: "2-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
{ID: "2-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
||||||
{Id: "3-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
{ID: "3-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
n, err := client.XGroupDelConsumer("stream", "group", "consumer").Result()
|
n, err := client.XGroupDelConsumer("stream", "group", "consumer").Result()
|
||||||
|
|
Loading…
Reference in New Issue