Merge pull request #178 from wjessop/setname_getname

Implement SetName and GetName
This commit is contained in:
Vladimir Mihailenco 2015-10-22 14:00:52 +03:00
commit 799deba407
2 changed files with 22 additions and 0 deletions

View File

@ -1367,6 +1367,18 @@ func (c *commandable) ClientPause(dur time.Duration) *BoolCmd {
return cmd
}
func (c *commandable) SetName(name string) *StatusCmd {
cmd := NewStatusCmd("CLIENT", "SETNAME", name)
c.Process(cmd)
return cmd
}
func (c *Client) GetName() *StringCmd {
cmd := NewStringCmd("CLIENT", "GETNAME")
c.Process(cmd)
return cmd
}
func (c *commandable) ConfigGet(parameter string) *SliceCmd {
cmd := NewSliceCmd("CONFIG", "GET", parameter)
cmd._clusterKeyPos = 0

View File

@ -90,6 +90,16 @@ var _ = Describe("Commands", func() {
}, "1s").ShouldNot(HaveOccurred())
})
It("should SetName", func() {
isSet, err := client.SetName("theclientname").Result()
Expect(err).NotTo(HaveOccurred())
Expect(isSet).To(Equal("OK"))
val, err := client.GetName().Result()
Expect(err).NotTo(HaveOccurred())
Expect(val).To(Equal("theclientname"))
})
It("should ConfigGet", func() {
r := client.ConfigGet("*")
Expect(r.Err()).NotTo(HaveOccurred())