Skip to content
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

Merged
merged 29 commits into from
Nov 12, 2023

Conversation

unknowntpo
Copy link
Contributor

This PR introduced generic rueidiscompat.baseCmd to avoid writing boilerplate code like .Val(), .Err(), Result() for commands.

And used rueidiscompat.Scan to scan result into go-redis structure.

@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2023

Codecov Report

Attention: 173 lines in your changes are missing coverage. Please review.

Comparison is base (73f72b4) 97.52% compared to head (4dfac21) 97.01%.
Report is 8 commits behind head on main.

❗ 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     
Files Coverage Δ
rueidiscompat/hscan.go 97.93% <ø> (ø)
rueidiscompat/command.go 76.69% <54.76%> (-2.14%) ⬇️
rueidiscompat/adapter.go 92.18% <76.28%> (-2.89%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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()

}

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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()

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)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_cmd.Item(fmt.Sprint(elements[i])).Increment((int64)(elements[i+1].(int)))
_cmd.Item(str(elements[i])).Increment((int64)(elements[i+1].(int)))

@rueian
Copy link
Collaborator

rueian commented Nov 12, 2023

Thank you for this great work @unknowntpo!

@rueian rueian added the feature label Nov 12, 2023
@rueian rueian merged commit 72146ca into redis:main Nov 12, 2023
@unknowntpo
Copy link
Contributor Author

@rueian Thanks for reviewing.

@rueian rueian changed the title Feat: Align go-redis ProbabilisticCmdable feat: add ProbabilisticCmdable to rueidiscompat to align go-redis Nov 19, 2023
@rueian rueian changed the title feat: add ProbabilisticCmdable to rueidiscompat to align go-redis feat: add ProbabilisticCmdable to rueidiscompat Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants