forked from mirror/redis
commit
effc0c507a
11
commands.go
11
commands.go
|
@ -166,6 +166,7 @@ type Cmdable interface {
|
||||||
SUnion(keys ...string) *StringSliceCmd
|
SUnion(keys ...string) *StringSliceCmd
|
||||||
SUnionStore(destination string, keys ...string) *IntCmd
|
SUnionStore(destination string, keys ...string) *IntCmd
|
||||||
XAdd(a *XAddArgs) *StringCmd
|
XAdd(a *XAddArgs) *StringCmd
|
||||||
|
XDel(stream string, ids ...string) *IntCmd
|
||||||
XLen(stream string) *IntCmd
|
XLen(stream string) *IntCmd
|
||||||
XRange(stream, start, stop string) *XMessageSliceCmd
|
XRange(stream, start, stop string) *XMessageSliceCmd
|
||||||
XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
|
XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
|
||||||
|
@ -1339,6 +1340,16 @@ func (c *cmdable) XAdd(a *XAddArgs) *StringCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cmdable) XDel(stream string, ids ...string) *IntCmd {
|
||||||
|
args := []interface{}{"xdel", stream}
|
||||||
|
for _, id := range ids {
|
||||||
|
args = append(args, id)
|
||||||
|
}
|
||||||
|
cmd := NewIntCmd(args...)
|
||||||
|
c.process(cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
func (c *cmdable) XLen(stream string) *IntCmd {
|
func (c *cmdable) XLen(stream string) *IntCmd {
|
||||||
cmd := NewIntCmd("xlen", stream)
|
cmd := NewIntCmd("xlen", stream)
|
||||||
c.process(cmd)
|
c.process(cmd)
|
||||||
|
|
|
@ -3405,6 +3405,12 @@ var _ = Describe("Commands", func() {
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should XDel", func() {
|
||||||
|
n, err := client.XDel("stream", "1-0", "2-0", "3-0").Result()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(n).To(Equal(int64(3)))
|
||||||
|
})
|
||||||
|
|
||||||
It("should XLen", func() {
|
It("should XLen", func() {
|
||||||
n, err := client.XLen("stream").Result()
|
n, err := client.XLen("stream").Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
Loading…
Reference in New Issue