...

Source file src/github.com/redis/go-redis/v9/hyperloglog_commands.go

Documentation: github.com/redis/go-redis/v9

     1  package redis
     2  
     3  import "context"
     4  
     5  type HyperLogLogCmdable interface {
     6  	PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd
     7  	PFCount(ctx context.Context, keys ...string) *IntCmd
     8  	PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd
     9  }
    10  
    11  func (c cmdable) PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd {
    12  	args := make([]interface{}, 2, 2+len(els))
    13  	args[0] = "pfadd"
    14  	args[1] = key
    15  	args = appendArgs(args, els)
    16  	cmd := NewIntCmd(ctx, args...)
    17  	_ = c(ctx, cmd)
    18  	return cmd
    19  }
    20  
    21  func (c cmdable) PFCount(ctx context.Context, keys ...string) *IntCmd {
    22  	args := make([]interface{}, 1+len(keys))
    23  	args[0] = "pfcount"
    24  	for i, key := range keys {
    25  		args[1+i] = key
    26  	}
    27  	cmd := NewIntCmd(ctx, args...)
    28  	_ = c(ctx, cmd)
    29  	return cmd
    30  }
    31  
    32  func (c cmdable) PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd {
    33  	args := make([]interface{}, 2+len(keys))
    34  	args[0] = "pfmerge"
    35  	args[1] = dest
    36  	for i, key := range keys {
    37  		args[2+i] = key
    38  	}
    39  	cmd := NewStatusCmd(ctx, args...)
    40  	_ = c(ctx, cmd)
    41  	return cmd
    42  }
    43  

View as plain text