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

refactor: change ListElementCmd to KeyValuesCmd. (#2443)

* refactor: change ListElementCmd to KeyValuesCmd

Signed-off-by: monkey92t <golang@88.com>

* KeyValuesCmd.val are modified to pointers

Signed-off-by: monkey92t <golang@88.com>

* recover KeyValuesCmd API

Signed-off-by: monkey92t <golang@88.com>

---------

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
Monkey
2023-02-14 21:52:56 +08:00
committed by GitHub
parent 3532f2a414
commit d2c53bd2a5
3 changed files with 20 additions and 20 deletions

View File

@ -2279,25 +2279,25 @@ var _ = Describe("Commands", func() {
err = client.LPush(ctx, "list2", "a", "b", "c", "d", "e").Err()
Expect(err).NotTo(HaveOccurred())
key, elems, err := client.LMPop(ctx, "left", 3, "list1", "list2").Result()
key, val, err := client.LMPop(ctx, "left", 3, "list1", "list2").Result()
Expect(err).NotTo(HaveOccurred())
Expect(key).To(Equal("list1"))
Expect(elems).To(Equal([]string{"five", "four", "three"}))
Expect(val).To(Equal([]string{"five", "four", "three"}))
key, elems, err = client.LMPop(ctx, "right", 3, "list1", "list2").Result()
key, val, err = client.LMPop(ctx, "right", 3, "list1", "list2").Result()
Expect(err).NotTo(HaveOccurred())
Expect(key).To(Equal("list1"))
Expect(elems).To(Equal([]string{"one", "two"}))
Expect(val).To(Equal([]string{"one", "two"}))
key, elems, err = client.LMPop(ctx, "left", 1, "list1", "list2").Result()
key, val, err = client.LMPop(ctx, "left", 1, "list1", "list2").Result()
Expect(err).NotTo(HaveOccurred())
Expect(key).To(Equal("list2"))
Expect(elems).To(Equal([]string{"e"}))
Expect(val).To(Equal([]string{"e"}))
key, elems, err = client.LMPop(ctx, "right", 10, "list1", "list2").Result()
key, val, err = client.LMPop(ctx, "right", 10, "list1", "list2").Result()
Expect(err).NotTo(HaveOccurred())
Expect(key).To(Equal("list2"))
Expect(elems).To(Equal([]string{"a", "b", "c", "d"}))
Expect(val).To(Equal([]string{"a", "b", "c", "d"}))
err = client.LMPop(ctx, "left", 10, "list1", "list2").Err()
Expect(err).To(Equal(redis.Nil))