lieck commented on code in PR #1837:
URL: https://github.com/apache/kvrocks/pull/1837#discussion_r1365784027
##########
src/commands/cmd_json.cc:
##########
@@ -52,7 +52,35 @@ class CommandJsonGet : public Commander {
}
};
+class CommandJsonArrAppend : public Commander {
+ public:
+ Status Execute(Server *svr, Connection *conn, std::string *output) override {
+ redis::Json json(svr->storage, conn->GetNamespace());
+
+ std::vector<uint64_t> result_count;
+
+ auto s = json.ArrAppend(args_[1], args_[2], {args_.begin() + 3,
args_.end()}, &result_count);
+ if (!s.ok()) return {Status::RedisExecErr, s.ToString()};
+
+ if (result_count.empty()) {
Review Comment:
Thank you, using `MultiBulkString` will invoke `BulkString` for each element
in `results`, making the return result not an integer array.
```cpp
std::string MultiBulkString(const std::vector<std::string> &values, const
std::vector<rocksdb::Status> &statuses) {
std::string result = "*" + std::to_string(values.size()) + CRLF;
for (size_t i = 0; i < values.size(); i++) {
if (i < statuses.size() && !statuses[i].ok()) {
result += NilString();
} else {
result += BulkString(values[i]);
}
}
return result;
}
```
--
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]