forked from mirror/redis
Merge pull request #180 from go-redis/fix/client-set-name-comment
Fix names and add comments.
This commit is contained in:
commit
96fcac6a43
|
@ -1367,13 +1367,15 @@ func (c *commandable) ClientPause(dur time.Duration) *BoolCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandable) SetName(name string) *StatusCmd {
|
// ClientSetName assigns a name to the one of many connections in the pool.
|
||||||
cmd := NewStatusCmd("CLIENT", "SETNAME", name)
|
func (c *commandable) ClientSetName(name string) *BoolCmd {
|
||||||
|
cmd := NewBoolCmd("CLIENT", "SETNAME", name)
|
||||||
c.Process(cmd)
|
c.Process(cmd)
|
||||||
return 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")
|
cmd := NewStringCmd("CLIENT", "GETNAME")
|
||||||
c.Process(cmd)
|
c.Process(cmd)
|
||||||
return cmd
|
return cmd
|
||||||
|
|
|
@ -90,12 +90,12 @@ var _ = Describe("Commands", func() {
|
||||||
}, "1s").ShouldNot(HaveOccurred())
|
}, "1s").ShouldNot(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should SetName", func() {
|
It("should ClientSetName and ClientGetName", func() {
|
||||||
isSet, err := client.SetName("theclientname").Result()
|
isSet, err := client.ClientSetName("theclientname").Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
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(err).NotTo(HaveOccurred())
|
||||||
Expect(val).To(Equal("theclientname"))
|
Expect(val).To(Equal("theclientname"))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue