git-hulk commented on code in PR #1875:
URL: https://github.com/apache/kvrocks/pull/1875#discussion_r1382403159


##########
src/types/json.h:
##########
@@ -211,6 +211,17 @@ struct JsonValue {
     return types;
   }
 
+  Status Toggle(std::string_view path) {
+    try {
+      jsoncons::jsonpath::json_replace(value, path, [&](const std::string & 
/*path*/, jsoncons::json &val) {
+        if (val.is_bool()) val = !val.as_bool();

Review Comment:
   > JSON.TOGGLE returns an array of integer replies for each path, the new 
value (0 if false or 1 if true), or nil for JSON values matching the path that 
are not Boolean. 
   
   The return value should be an array of integers. That said if there are two 
paths matched and one of them is NOT a boolean value, then it should return an 
array with:
   
   1) 0(or 1)
   2) nil



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