You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2023/07/08 14:16:43 UTC

[GitHub] [kvrocks] PragmaTwice commented on a diff in pull request #1565: Add the support of the HRANDFIELD command

PragmaTwice commented on code in PR #1565:
URL: https://github.com/apache/kvrocks/pull/1565#discussion_r1257277273


##########
src/commands/cmd_hash.cc:
##########
@@ -376,6 +376,52 @@ class CommandHScan : public CommandSubkeyScanBase {
     return Status::OK();
   }
 };
+class CommandHRandField : public Commander {
+ public:
+  Status Parse(const std::vector<std::string> &args) override {
+    if (args.size() >= 3) {
+      auto parse_result = ParseInt<int64_t>(args[2], 10);
+      if (!parse_result) {
+        return {Status::RedisParseErr, errValueNotInteger};
+      }
+      if (*parse_result >= 0) {
+        count_ = *parse_result;
+      } else {
+        count_ = -*parse_result;
+        uniq_ = false;
+      }
+      //如果有withvalue这个参数,就一定有前面的count

Review Comment:
   Please comment in English :)



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org