-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
Expected Behavior
I expect bitpos to take start and end prefixes as bits and as bytes
Current Behavior
The interface does not allow to give the last argument bit
or byte
Possible Solution
Change the interface to support bit and byte. i.e. with
diff --git a/commands.go b/commands.go
index ac93f39..03a3030 100644
--- a/commands.go
+++ b/commands.go
@@ -192,7 +192,7 @@ type Cmdable interface {
BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd
BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd
BitOpNot(ctx context.Context, destKey string, key string) *IntCmd
- BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd
+ BitPos(ctx context.Context, key string, args ...interface{}) *IntCmd
BitField(ctx context.Context, key string, args ...interface{}) *IntSliceCmd
Steps to Reproduce
Below is the syntax using redis-cli:
$ redis-cli
127.0.0.1:6379> Set mykey '\xff\xf0\x00'
OK
127.0.0.1:6379> bitpos mykey 0 0 2 byte
(integer) 0
127.0.0.1:6379> bitpos mykey 0 0 2 bit
(integer) 0
127.0.0.1:6379>
Context (Environment)
My code is more complex then it needs to be because offsets in bits are not supported.
Metadata
Metadata
Assignees
Labels
No labels