MCPcopy
hub / github.com/redis/go-redis / BitCount

Method BitCount

bitmap_commands.go:52–70  ·  view source on GitHub ↗
(ctx context.Context, key string, bitCount *BitCount)

Source from the content-addressed store, hash-verified

50const BitCountIndexBit string = "BIT"
51
52func (c cmdable) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd {
53 args := make([]any, 2, 5)
54 args[0] = "bitcount"
55 args[1] = key
56 if bitCount != nil {
57 args = append(args, bitCount.Start, bitCount.End)
58 if bitCount.Unit != "" {
59 if bitCount.Unit != BitCountIndexByte && bitCount.Unit != BitCountIndexBit {
60 cmd := NewIntCmd(ctx)
61 cmd.SetErr(errors.New("redis: invalid bitcount index"))
62 return cmd
63 }
64 args = append(args, bitCount.Unit)
65 }
66 }
67 cmd := NewIntCmd(ctx, args...)
68 _ = c(ctx, cmd)
69 return cmd
70}
71
72func (c cmdable) bitOp(ctx context.Context, op, destKey string, keys ...string) *IntCmd {
73 args := make([]interface{}, 3+len(keys))

Callers

nothing calls this directly

Calls 2

NewIntCmdFunction · 0.85
SetErrMethod · 0.65

Tested by

no test coverage detected