Skip to content

Commit

Permalink
Add Client Id
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo committed Dec 11, 2018
1 parent 1d1269e commit 2672a0f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ type Cmdable interface {
ClientKillByFilter(keys ...string) *IntCmd
ClientList() *StringCmd
ClientPause(dur time.Duration) *BoolCmd
ClientId() *IntCmd
ConfigGet(parameter string) *SliceCmd
ConfigResetStat() *StatusCmd
ConfigSet(parameter, value string) *StatusCmd
Expand Down Expand Up @@ -2061,6 +2062,12 @@ func (c *cmdable) ClientPause(dur time.Duration) *BoolCmd {
return cmd
}

func (c *cmdable) ClientId() *IntCmd {
cmd := NewIntCmd("client", "id")
c.process(cmd)
return cmd
}

// ClientSetName assigns a name to the connection.
func (c *statefulCmdable) ClientSetName(name string) *BoolCmd {
cmd := NewBoolCmd("client", "setname", name)
Expand Down
8 changes: 7 additions & 1 deletion commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ var _ = Describe("Commands", func() {
Expect(r.Val()).To(Equal(int64(0)))
})

It("should ClientId", func() {
err := client.ClientId().Err()
Expect(err).NotTo(HaveOccurred())
Expect(client.ClientId().Val()).To(BeNumerically(">=", 0))
})

It("should ClientPause", func() {
err := client.ClientPause(time.Second).Err()
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -222,7 +228,7 @@ var _ = Describe("Commands", func() {
Expect(tm).To(BeTemporally("~", time.Now(), 3*time.Second))
})

It("Should Command", func() {
It("should Command", func() {
cmds, err := client.Command().Result()
Expect(err).NotTo(HaveOccurred())
Expect(len(cmds)).To(BeNumerically("~", 200, 20))
Expand Down

0 comments on commit 2672a0f

Please sign in to comment.