git-hulk commented on code in PR #1468:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1468#discussion_r1206252921


##########
src/commands/cmd_zset.cc:
##########
@@ -266,6 +268,74 @@ class CommandZPopMax : public CommandZPop {
   CommandZPopMax() : CommandZPop(false) {}
 };
 
+class CommandZMPop : public Commander {
+ public:
+  CommandZMPop() = default;
+
+  Status Parse(const std::vector<std::string> &args) override {
+    CommandParser parser(args, 1);
+    numkeys_ = GET_OR_RET(parser.TakeInt<int>(NumericRange<int>{1, 
std::numeric_limits<int>::max()}));
+    for (int i = 0; i < numkeys_; ++i) {
+      keys_.emplace_back(GET_OR_RET(parser.TakeStr()));
+    }
+    bool has_min_flag = false;

Review Comment:
   It's a bit confusing, when the MAX was passed then we set the has_min_flag 
to true. I think we can an enum to represent this state:
   
   where = ZSET_NONE
   
   if (parser.EatEqICase("min")) {
     where = ZSET_MIN
   } else if (parser.EatEqICase("max")) {
     where = ZSET_MAX
   }
   if (where == ZSET_NONE) {
    // invalid syntax
   }



-- 
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]

Reply via email to