forked from mirror/redis
Fix ZStore Weight type. Fixes #206.
This commit is contained in:
parent
54a9acc11f
commit
83b8c0a9c0
12
commands.go
12
commands.go
|
@ -990,15 +990,15 @@ func (c *commandable) SUnionStore(destination string, keys ...string) *IntCmd {
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Sorted set member.
|
||||
// Z represents sorted set member.
|
||||
type Z struct {
|
||||
Score float64
|
||||
Member interface{}
|
||||
}
|
||||
|
||||
// Sorted set store operation.
|
||||
// ZStore is used as an arg to ZInterStore and ZUnionStore.
|
||||
type ZStore struct {
|
||||
Weights []int64
|
||||
Weights []float64
|
||||
// Can be SUM, MIN or MAX.
|
||||
Aggregate string
|
||||
}
|
||||
|
@ -1113,11 +1113,7 @@ func (c *commandable) ZIncrBy(key string, increment float64, member string) *Flo
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) ZInterStore(
|
||||
destination string,
|
||||
store ZStore,
|
||||
keys ...string,
|
||||
) *IntCmd {
|
||||
func (c *commandable) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd {
|
||||
args := make([]interface{}, 3+len(keys))
|
||||
args[0] = "ZINTERSTORE"
|
||||
args[1] = destination
|
||||
|
|
|
@ -2082,7 +2082,7 @@ var _ = Describe("Commands", func() {
|
|||
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
||||
|
||||
zInterStore := client.ZInterStore(
|
||||
"out", redis.ZStore{Weights: []int64{2, 3}}, "zset1", "zset2")
|
||||
"out", redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2")
|
||||
Expect(zInterStore.Err()).NotTo(HaveOccurred())
|
||||
Expect(zInterStore.Val()).To(Equal(int64(2)))
|
||||
|
||||
|
@ -2479,7 +2479,7 @@ var _ = Describe("Commands", func() {
|
|||
Expect(zAdd.Err()).NotTo(HaveOccurred())
|
||||
|
||||
zUnionStore := client.ZUnionStore(
|
||||
"out", redis.ZStore{Weights: []int64{2, 3}}, "zset1", "zset2")
|
||||
"out", redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2")
|
||||
Expect(zUnionStore.Err()).NotTo(HaveOccurred())
|
||||
Expect(zUnionStore.Val()).To(Equal(int64(3)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue