From c6bf37c653d85f187229ef27276c68960988af65 Mon Sep 17 00:00:00 2001 From: Theo Date: Tue, 11 Dec 2018 20:26:48 +0000 Subject: [PATCH 1/2] Add Client Unblock --- commands.go | 10 ++++++++++ commands_test.go | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/commands.go b/commands.go index 6e925af..3953859 100644 --- a/commands.go +++ b/commands.go @@ -2068,6 +2068,16 @@ func (c *cmdable) ClientID() *IntCmd { return cmd } +func (c *cmdable) ClientUnblock(id int64, isError bool) *IntCmd { + args := []interface{}{"client", "unblock", id} + if isError { + args = append(args, "error") + } + cmd := NewIntCmd(args...) + c.process(cmd) + return cmd +} + // ClientSetName assigns a name to the connection. func (c *statefulCmdable) ClientSetName(name string) *BoolCmd { cmd := NewBoolCmd("client", "setname", name) diff --git a/commands_test.go b/commands_test.go index ea646be..70e6af7 100644 --- a/commands_test.go +++ b/commands_test.go @@ -127,6 +127,13 @@ var _ = Describe("Commands", func() { Expect(client.ClientID().Val()).To(BeNumerically(">=", 0)) }) + It("should ClientUnblock", func() { + id := client.ClientID().Val() + r, err := client.ClientUnblock(id, true).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(r).To(Equal(int64(0))) + }) + It("should ClientPause", func() { err := client.ClientPause(time.Second).Err() Expect(err).NotTo(HaveOccurred()) From b5aefa2f6ac50a63c0d59d7804cc13df3e660155 Mon Sep 17 00:00:00 2001 From: Theo Date: Fri, 14 Dec 2018 14:46:15 +0000 Subject: [PATCH 2/2] ClientUnblock + ClientUnblockWithError --- commands.go | 14 ++++++++------ commands_test.go | 9 ++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/commands.go b/commands.go index 3953859..2d8a28d 100644 --- a/commands.go +++ b/commands.go @@ -2068,12 +2068,14 @@ func (c *cmdable) ClientID() *IntCmd { return cmd } -func (c *cmdable) ClientUnblock(id int64, isError bool) *IntCmd { - args := []interface{}{"client", "unblock", id} - if isError { - args = append(args, "error") - } - cmd := NewIntCmd(args...) +func (c *cmdable) ClientUnblock(id int64) *IntCmd { + cmd := NewIntCmd("client", "unblock", id) + c.process(cmd) + return cmd +} + +func (c *cmdable) ClientUnblockWithError(id int64) *IntCmd { + cmd := NewIntCmd("client", "unblock", id, "error") c.process(cmd) return cmd } diff --git a/commands_test.go b/commands_test.go index 70e6af7..ef37b87 100644 --- a/commands_test.go +++ b/commands_test.go @@ -129,7 +129,14 @@ var _ = Describe("Commands", func() { It("should ClientUnblock", func() { 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(r).To(Equal(int64(0))) })