pgj commented on code in PR #4990:
URL: https://github.com/apache/couchdb/pull/4990#discussion_r1511956961


##########
src/mango/src/mango_execution_stats.erl:
##########
@@ -37,12 +37,23 @@
 -define(SHARD_STATS_KEY, mango_shard_execution_stats).
 
 to_json(Stats) ->
+    to_json(Stats, true).
+
+to_json(Stats, IncludeDbName) ->
+    Base =

Review Comment:
   There is no need to change the function's interface.  What I suggested is a 
semantical equivalent of your original definition.  This alternative syntax is 
based on how [list comprehensions in 
Erlang](https://www.erlang.org/doc/programming_examples/list_comprehensions) 
work.  The Boolean value on the right-hand side of the `||` symbol acts as a 
predicate and the value on the left-hand side is added to the resulting list if 
that is `true` otherwise omitted.
   
   For example, consider the following in the Erlang shell:
   
   ```
   > [1 || true].
   [1]
   > [1 || false].
   []
   ```
   
   List comprehensions do not require the use of variables, hence this 
formulation becomes a valid although unusual instance.



-- 
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: notifications-unsubscr...@couchdb.apache.org

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

Reply via email to