forked from mirror/redis
Add ZLexCount
This commit is contained in:
parent
7a034e1609
commit
a9364f117c
|
@ -159,6 +159,7 @@ type Cmdable interface {
|
||||||
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
|
||||||
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
|
||||||
ZRange(key string, start, stop int64) *StringSliceCmd
|
ZRange(key string, start, stop int64) *StringSliceCmd
|
||||||
|
@ -1352,6 +1353,12 @@ func (c *cmdable) ZCount(key, min, max string) *IntCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cmdable) ZLexCount(key, min, max string) *IntCmd {
|
||||||
|
cmd := NewIntCmd("zlexcount", key, min, max)
|
||||||
|
c.process(cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
func (c *cmdable) ZIncrBy(key string, increment float64, member string) *FloatCmd {
|
func (c *cmdable) ZIncrBy(key string, increment float64, member string) *FloatCmd {
|
||||||
cmd := NewFloatCmd("zincrby", key, increment, member)
|
cmd := NewFloatCmd("zincrby", key, increment, member)
|
||||||
c.process(cmd)
|
c.process(cmd)
|
||||||
|
|
|
@ -2176,20 +2176,24 @@ var _ = Describe("Commands", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZCount", func() {
|
It("should ZCount", func() {
|
||||||
zAdd := client.ZAdd("zset", redis.Z{1, "one"})
|
err := client.ZAdd("zset", redis.Z{1, "one"}).Err()
|
||||||
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
zAdd = client.ZAdd("zset", redis.Z{2, "two"})
|
err = client.ZAdd("zset", redis.Z{2, "two"}).Err()
|
||||||
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
zAdd = client.ZAdd("zset", redis.Z{3, "three"})
|
err = client.ZAdd("zset", redis.Z{3, "three"}).Err()
|
||||||
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
zCount := client.ZCount("zset", "-inf", "+inf")
|
count, err := client.ZCount("zset", "-inf", "+inf").Result()
|
||||||
Expect(zCount.Err()).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(zCount.Val()).To(Equal(int64(3)))
|
Expect(count).To(Equal(int64(3)))
|
||||||
|
|
||||||
zCount = client.ZCount("zset", "(1", "3")
|
count, err = client.ZCount("zset", "(1", "3").Result()
|
||||||
Expect(zCount.Err()).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(zCount.Val()).To(Equal(int64(2)))
|
Expect(count).To(Equal(int64(2)))
|
||||||
|
|
||||||
|
count, err = client.ZLexCount("zset", "-", "+").Result()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(count).To(Equal(int64(3)))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should ZIncrBy", func() {
|
It("should ZIncrBy", func() {
|
||||||
|
|
Loading…
Reference in New Issue