git-hulk commented on code in PR #1865:
URL: https://github.com/apache/kvrocks/pull/1865#discussion_r1387398239
##########
src/commands/cmd_json.cc:
##########
@@ -291,6 +291,64 @@ class CommandJsonArrPop : public Commander {
int64_t index_ = -1;
};
+class CommanderJsonArrIndex : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ if (args.size() < 4 || args.size() > 6) {
+ return {Status::RedisExecErr, errWrongNumOfArguments};
+ }
+ start_ = 0;
+ end_ = std::numeric_limits<ssize_t>::max();
+
+ if (args.size() > 4) {
+ auto parse_start = ParseInt<ssize_t>(args[4], 10);
+ if (parse_start.IsOK()) {
+ start_ = parse_start.GetValue();
+ } else {
+ return {Status::RedisParseErr, errValueNotInteger};
+ }
Review Comment:
```suggestion
start_ = GET_OR_RET(ParseInt<ssize_t>(args[4], 10));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]