Skip to content

Commit

Permalink
Change ZWithKey
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Nov 3, 2018
1 parent 6809e07 commit 58f22c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
5 changes: 2 additions & 3 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 20 additions & 12 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}))
})

Expand All @@ -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
}()
Expand Down Expand Up @@ -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",
}))
})

Expand All @@ -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
}()
Expand Down

0 comments on commit 58f22c5

Please sign in to comment.