forked from mirror/redis
ClientUnblock + ClientUnblockWithError
This commit is contained in:
parent
c6bf37c653
commit
b5aefa2f6a
14
commands.go
14
commands.go
|
@ -2068,12 +2068,14 @@ func (c *cmdable) ClientID() *IntCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmdable) ClientUnblock(id int64, isError bool) *IntCmd {
|
func (c *cmdable) ClientUnblock(id int64) *IntCmd {
|
||||||
args := []interface{}{"client", "unblock", id}
|
cmd := NewIntCmd("client", "unblock", id)
|
||||||
if isError {
|
c.process(cmd)
|
||||||
args = append(args, "error")
|
return cmd
|
||||||
}
|
}
|
||||||
cmd := NewIntCmd(args...)
|
|
||||||
|
func (c *cmdable) ClientUnblockWithError(id int64) *IntCmd {
|
||||||
|
cmd := NewIntCmd("client", "unblock", id, "error")
|
||||||
c.process(cmd)
|
c.process(cmd)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,14 @@ var _ = Describe("Commands", func() {
|
||||||
|
|
||||||
It("should ClientUnblock", func() {
|
It("should ClientUnblock", func() {
|
||||||
id := client.ClientID().Val()
|
id := client.ClientID().Val()
|
||||||
r, err := client.ClientUnblock(id, true).Result()
|
r, err := client.ClientUnblock(id).Result()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(r).To(Equal(int64(0)))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("should ClientUnblockWithError", func() {
|
||||||
|
id := client.ClientID().Val()
|
||||||
|
r, err := client.ClientUnblockWithError(id).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(r).To(Equal(int64(0)))
|
Expect(r).To(Equal(int64(0)))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue