-
Notifications
You must be signed in to change notification settings - Fork 981
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(server): Support for LIMIT and REV in ZRANGE #422 #456
feat(server): Support for LIMIT and REV in ZRANGE #422 #456
Conversation
@@ -1251,42 +1297,18 @@ void ZSetFamily::ZRangeByLex(CmdArgList args, ConnectionContext* cntx) { | |||
return (*cntx)->SendError(kSyntaxErr); | |||
string_view os = ArgS(args, 5); | |||
string_view cs = ArgS(args, 6); | |||
if (!SimpleAtoi(os, &count) || !SimpleAtoi(cs, &count)) { | |||
if (!SimpleAtoi(os, &offset) || !SimpleAtoi(cs, &count)) { |
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.
thanks!
I made a mistake when handling parameters following the LIMIT group, the new commits should fix that |
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.
Looks really solid! 🎩
It looks like ParseRangeByScoreParams
has a similar issue. It doesn't allow inverse order: limit a b withscores
. If possible, could you fix it as well? And add a test, that makes sure it works for both your command and deprecated ZRangeByScore
@RedhaL i pinged you at discord :) |
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.
Thanks!
@dranikpg I just added the fix for zrangebyscore as well |
Closes #422
Since the new ZRange regroups all the other (now deprecated) ZRange functions, I did some refactoring to avoid duplicating code from these functions. This made it possible to have support for ZRevRangeByLex for free, since the visitor function already supported it.
Also spotted and corrected an error in ZRangeByLex when parsing the offset parameter.
There are some unrelated formatting changes that were added by clang-format.