-
Notifications
You must be signed in to change notification settings - Fork 183
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 ProbabilisticCmdable to rueidiscompat #406
feat: add ProbabilisticCmdable to rueidiscompat #406
Conversation
TODO: CacheCompat
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #406 +/- ##
==========================================
- Coverage 97.52% 97.01% -0.51%
==========================================
Files 76 76
Lines 30866 31443 +577
==========================================
+ Hits 30101 30504 +403
- Misses 640 791 +151
- Partials 125 148 +23
☔ View full report in Codecov by Sentry. |
rueidiscompat/adapter.go
Outdated
} | ||
|
||
func (c *Compat) CFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd { | ||
cmd := c.client.B().CfLoadchunk().Key(key).Iterator(iterator).Data(fmt.Sprint(data)).Build() |
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.
cmd := c.client.B().CfLoadchunk().Key(key).Iterator(iterator).Data(fmt.Sprint(data)).Build() | |
cmd := c.client.B().CfLoadchunk().Key(key).Iterator(iterator).Data(str(data)).Build() |
rueidiscompat/adapter.go
Outdated
} | ||
|
||
func (c *Compat) BFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd { | ||
cmd := c.client.B().BfLoadchunk().Key(key).Iterator(iterator).Data(fmt.Sprint(data)).Build() |
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.
cmd := c.client.B().BfLoadchunk().Key(key).Iterator(iterator).Data(fmt.Sprint(data)).Build() | |
cmd := c.client.B().BfLoadchunk().Key(key).Iterator(iterator).Data(str(data)).Build() |
rueidiscompat/adapter.go
Outdated
func (c *Compat) CMSIncrBy(ctx context.Context, key string, elements ...interface{}) *IntSliceCmd { | ||
_cmd := c.client.B().CmsIncrby().Key(key) | ||
for i := 0; i < len(elements); i += 2 { | ||
_cmd.Item(fmt.Sprint(elements[i])).Increment((int64)(elements[i+1].(int))) |
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.
_cmd.Item(fmt.Sprint(elements[i])).Increment((int64)(elements[i+1].(int))) | |
_cmd.Item(str(elements[i])).Increment((int64)(elements[i+1].(int))) |
Thank you for this great work @unknowntpo! |
@rueian Thanks for reviewing. |
This PR introduced generic
rueidiscompat.baseCmd
to avoid writing boilerplate code like.Val()
,.Err()
,Result()
for commands.And used
rueidiscompat.Scan
to scan result intogo-redis
structure.