From 58f22c56fdbdf07f5d6f5e397a6e134b94c65b0c Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Sat, 3 Nov 2018 12:07:25 +0200 Subject: [PATCH] Change ZWithKey --- commands.go | 5 ++--- commands_test.go | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/commands.go b/commands.go index e4cd677..4ef8ccf 100644 --- a/commands.go +++ b/commands.go @@ -1554,9 +1554,8 @@ type Z struct { // ZWithKey represents sorted set member including the name of the key where it was popped. type ZWithKey struct { - Score float64 - Member interface{} - Key string + Z + Key string } // ZStore is used as an arg to ZInterStore and ZUnionStore. diff --git a/commands_test.go b/commands_test.go index ba59727..9e8e2ef 100644 --- a/commands_test.go +++ b/commands_test.go @@ -2138,9 +2138,11 @@ var _ = Describe("Commands", func() { member, err := client.BZPopMax(0, "zset1", "zset2").Result() Expect(err).NotTo(HaveOccurred()) Expect(member).To(Equal(redis.ZWithKey{ - Score: 3, - Member: "three", - Key: "zset1", + Z: redis.Z{ + Score: 3, + Member: "three", + }, + Key: "zset1", })) }) @@ -2154,9 +2156,11 @@ var _ = Describe("Commands", func() { bZPopMax := client.BZPopMax(0, "zset") Expect(bZPopMax.Err()).NotTo(HaveOccurred()) Expect(bZPopMax.Val()).To(Equal(redis.ZWithKey{ - Member: "a", - Score: 1, - Key: "zset", + Z: redis.Z{ + Member: "a", + Score: 1, + }, + Key: "zset", })) done <- true }() @@ -2216,9 +2220,11 @@ var _ = Describe("Commands", func() { member, err := client.BZPopMin(0, "zset1", "zset2").Result() Expect(err).NotTo(HaveOccurred()) Expect(member).To(Equal(redis.ZWithKey{ - Score: 1, - Member: "one", - Key: "zset1", + Z: redis.Z{ + Score: 1, + Member: "one", + }, + Key: "zset1", })) }) @@ -2232,9 +2238,11 @@ var _ = Describe("Commands", func() { bZPopMin := client.BZPopMin(0, "zset") Expect(bZPopMin.Err()).NotTo(HaveOccurred()) Expect(bZPopMin.Val()).To(Equal(redis.ZWithKey{ - Member: "a", - Score: 1, - Key: "zset", + Z: redis.Z{ + Member: "a", + Score: 1, + }, + Key: "zset", })) done <- true }()