1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-18 00:20:57 +03:00

feat: add zintercard cmd

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
monkey92t
2023-01-07 23:05:04 +08:00
parent 09fcdbe6e4
commit bb65dcdf09
2 changed files with 43 additions and 0 deletions

View File

@ -268,6 +268,7 @@ type Cmdable interface {
ZIncrBy(ctx context.Context, key string, increment float64, member string) *FloatCmd
ZInter(ctx context.Context, store *ZStore) *StringSliceCmd
ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd
ZInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd
ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd
ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd
ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd
@ -2346,6 +2347,22 @@ func (c cmdable) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd
return cmd
}
func (c cmdable) ZInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd {
args := make([]interface{}, 4+len(keys))
args[0] = "zintercard"
numkeys := int64(0)
for i, key := range keys {
args[2+i] = key
numkeys++
}
args[1] = numkeys
args[2+numkeys] = "limit"
args[3+numkeys] = limit
cmd := NewIntCmd(ctx, args...)
_ = c(ctx, cmd)
return cmd
}
func (c cmdable) ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd {
args := make([]interface{}, 2+len(members))
args[0] = "zmscore"