forked from mirror/redis
Add Client Id
This commit is contained in:
parent
1d1269e0cf
commit
2672a0fbf2
|
@ -231,6 +231,7 @@ type Cmdable interface {
|
||||||
ClientKillByFilter(keys ...string) *IntCmd
|
ClientKillByFilter(keys ...string) *IntCmd
|
||||||
ClientList() *StringCmd
|
ClientList() *StringCmd
|
||||||
ClientPause(dur time.Duration) *BoolCmd
|
ClientPause(dur time.Duration) *BoolCmd
|
||||||
|
ClientId() *IntCmd
|
||||||
ConfigGet(parameter string) *SliceCmd
|
ConfigGet(parameter string) *SliceCmd
|
||||||
ConfigResetStat() *StatusCmd
|
ConfigResetStat() *StatusCmd
|
||||||
ConfigSet(parameter, value string) *StatusCmd
|
ConfigSet(parameter, value string) *StatusCmd
|
||||||
|
@ -2061,6 +2062,12 @@ func (c *cmdable) ClientPause(dur time.Duration) *BoolCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cmdable) ClientId() *IntCmd {
|
||||||
|
cmd := NewIntCmd("client", "id")
|
||||||
|
c.process(cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
// ClientSetName assigns a name to the connection.
|
// ClientSetName assigns a name to the connection.
|
||||||
func (c *statefulCmdable) ClientSetName(name string) *BoolCmd {
|
func (c *statefulCmdable) ClientSetName(name string) *BoolCmd {
|
||||||
cmd := NewBoolCmd("client", "setname", name)
|
cmd := NewBoolCmd("client", "setname", name)
|
||||||
|
|
|
@ -121,6 +121,12 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(r.Val()).To(Equal(int64(0)))
|
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() {
|
It("should ClientPause", func() {
|
||||||
err := client.ClientPause(time.Second).Err()
|
err := client.ClientPause(time.Second).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
@ -222,7 +228,7 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(tm).To(BeTemporally("~", time.Now(), 3*time.Second))
|
Expect(tm).To(BeTemporally("~", time.Now(), 3*time.Second))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Should Command", func() {
|
It("should Command", func() {
|
||||||
cmds, err := client.Command().Result()
|
cmds, err := client.Command().Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(len(cmds)).To(BeNumerically("~", 200, 20))
|
Expect(len(cmds)).To(BeNumerically("~", 200, 20))
|
||||||
|
|
Loading…
Reference in New Issue