-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add unit field to bitcount #538
feat: add unit field to bitcount #538
Conversation
@rueian |
Yes, we should support the Unit there too. |
rueidiscompat/adapter.go
Outdated
resp = c.client.Do(ctx, c.client.B().Bitcount().Key(key).Build()) | ||
} else { | ||
resp = c.client.Do(ctx, c.client.B().Bitcount().Key(key).Start(bitCount.Start).End(bitCount.End).Build()) | ||
resp := c.client.Do(ctx, c.client.B().Bitcount().Key(key).Bit().Build()) // Default to BIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @SoulPancake,
We can't use .Bit() as default because it is only supported on Redis >= 7. We should keep the original behavior.
rueidiscompat/adapter.go
Outdated
switch bitCount.Unit { | ||
case BitCountIndexByte: | ||
resp = c.client.Do(ctx, builder.Byte().Build()) // Handling for BYTE | ||
case BitCountIndexBit, "": // Default to BIT if not specified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. we can't use .Bit() as default in the case of "".
Hi @SoulPancake, would you like to continue on this? |
yes give me some time I will address it tonight @rueian |
@rueian I was thinking whether I should continue here or on valkey-go |
Hi @SoulPancake, Here is ok. I will sync commits between them. |
Will that make me a contributor there too? As I would like to be so @rueian |
Yes of course |
6c7e253
to
7b1c162
Compare
…om/SoulPancake/rueidis into ab/feature/add-unit-field-bitcount
rueidiscompat/command.go
Outdated
@@ -1959,6 +1959,7 @@ type SetArgs struct { | |||
|
|||
type BitCount struct { | |||
Start, End int64 | |||
Unit *string // Stores BIT or BYTE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @SoulPancake,
Could we keep using string
instead of *string
? We'd like to make the interface as close to go-redis'.
Please review @rueian :) |
LGTM. Thanks @SoulPancake! |
fixes