1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

Add latency based routing to Redis Cluster client.

This commit is contained in:
Joris Minjat
2016-05-06 11:12:31 -07:00
committed by Vladimir Mihailenco
parent 3972f28066
commit 487feebef1
11 changed files with 760 additions and 509 deletions

View File

@ -2729,6 +2729,7 @@ var _ = Describe("Commands", func() {
})
Describe("json marshaling/unmarshaling", func() {
BeforeEach(func() {
value := &numberStruct{Number: 42}
err := client.Set("key", value, 0).Err()
@ -2744,12 +2745,30 @@ var _ = Describe("Commands", func() {
It("should scan custom values using json", func() {
value := &numberStruct{}
err := client.Get("key").Scan(value)
Expect(err).To(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(value.Number).To(Equal(42))
})
})
Describe("Command", func() {
It("returns map of commands", func() {
cmds, err := client.Command().Result()
Expect(err).NotTo(HaveOccurred())
Expect(len(cmds)).To(BeNumerically("~", 173, 5))
cmd := cmds["mget"]
Expect(cmd.Name).To(Equal("mget"))
Expect(cmd.Arity).To(Equal(int8(-2)))
Expect(cmd.Flags).To(Equal([]string{"readonly"}))
Expect(cmd.FirstKeyPos).To(Equal(int8(1)))
Expect(cmd.LastKeyPos).To(Equal(int8(-1)))
Expect(cmd.StepCount).To(Equal(int8(1)))
})
})
})
type numberStruct struct {