Skip to content

Commit

Permalink
Merge pull request redis#180 from go-redis/fix/client-set-name-comment
Browse files Browse the repository at this point in the history
Fix names and add comments.
  • Loading branch information
vmihailenco committed Oct 22, 2015
2 parents f04e787 + 2bf0ea5 commit 96fcac6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1367,13 +1367,15 @@ func (c *commandable) ClientPause(dur time.Duration) *BoolCmd {
return cmd
}

func (c *commandable) SetName(name string) *StatusCmd {
cmd := NewStatusCmd("CLIENT", "SETNAME", name)
// ClientSetName assigns a name to the one of many connections in the pool.
func (c *commandable) ClientSetName(name string) *BoolCmd {
cmd := NewBoolCmd("CLIENT", "SETNAME", name)
c.Process(cmd)
return cmd
}

func (c *Client) GetName() *StringCmd {
// ClientGetName returns the name of the one of many connections in the pool.
func (c *Client) ClientGetName() *StringCmd {
cmd := NewStringCmd("CLIENT", "GETNAME")
c.Process(cmd)
return cmd
Expand Down
8 changes: 4 additions & 4 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ var _ = Describe("Commands", func() {
}, "1s").ShouldNot(HaveOccurred())
})

It("should SetName", func() {
isSet, err := client.SetName("theclientname").Result()
It("should ClientSetName and ClientGetName", func() {
isSet, err := client.ClientSetName("theclientname").Result()
Expect(err).NotTo(HaveOccurred())
Expect(isSet).To(Equal("OK"))
Expect(isSet).To(BeTrue())

val, err := client.GetName().Result()
val, err := client.ClientGetName().Result()
Expect(err).NotTo(HaveOccurred())
Expect(val).To(Equal("theclientname"))
})
Expand Down

0 comments on commit 96fcac6

Please sign in to comment.