cbickel commented on a change in pull request #3155: Support ?count on
collections
URL:
https://github.com/apache/incubator-openwhisk/pull/3155#discussion_r161218936
##########
File path:
common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
##########
@@ -329,6 +329,44 @@ class CouchDbRestStore[DocumentAbstraction <:
DocumentSerializer](dbProtocol: St
transid.failed(this, start, s"[QUERY] '$dbName' internal error,
failure: '${failure.getMessage}'", ErrorLevel))
}
+ protected[core] def count(table: String, startKey: List[Any], endKey:
List[Any], skip: Int, stale: StaleParameter)(
+ implicit transid: TransactionId): Future[Long] = {
+
+ val (realStartKey, realEndKey) = (startKey, endKey)
+ val parts = table.split("/")
+
+ val start = transid.started(this, LoggingMarkers.DATABASE_QUERY, s"[COUNT]
'$dbName' searching '$table")
+
+ val f = for (eitherResponse <- client.executeView(parts(0), parts(1))(
Review comment:
Is there a special reason why you are using a for-comprehension instead of
map?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services