| 50 | const BitCountIndexBit string = "BIT" |
| 51 | |
| 52 | func (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 | |
| 72 | func (c cmdable) bitOp(ctx context.Context, op, destKey string, keys ...string) *IntCmd { |
| 73 | args := make([]interface{}, 3+len(keys)) |