davisp commented on a change in pull request #2585: Mango Indexes on 
FoundationDB
URL: https://github.com/apache/couchdb/pull/2585#discussion_r393756997
 
 

 ##########
 File path: src/fabric/src/fabric2_util.erl
 ##########
 @@ -298,3 +301,39 @@ encode_all_doc_key(N) when is_number(N) -> <<>>;
 encode_all_doc_key(B) when is_binary(B) -> B;
 encode_all_doc_key(L) when is_list(L) -> <<255>>;
 encode_all_doc_key({O}) when is_list(O) -> <<255>>.
+
+
+all_docs_view_opts(#mrargs{} = Args) ->
+    NS = couch_util:get_value(namespace, Args#mrargs.extra),
+    StartKey = case Args#mrargs.start_key of
+        undefined -> Args#mrargs.start_key_docid;
+        SKey -> SKey
+    end,
+    EndKey = case Args#mrargs.end_key of
+        undefined -> Args#mrargs.end_key_docid;
+        EKey -> EKey
+    end,
+    StartKeyOpts = case StartKey of
+        undefined -> [];
+        _ -> [{start_key, encode_all_doc_key(StartKey)}]
+    end,
+    EndKeyOpts = case {EndKey, Args#mrargs.inclusive_end} of
+        {undefined, _} -> [];
+        {_, false} -> [{end_key_gt, encode_all_doc_key(EndKey)}];
+        {_, true} -> [{end_key, encode_all_doc_key(EndKey)}]
+    end,
+
+    DocOpts = case Args#mrargs.conflicts of
+        true -> [conflicts | Args#mrargs.doc_options];
+        _ -> Args#mrargs.doc_options
+    end,
+
+    [
+        {dir, Args#mrargs.direction},
+        {limit, Args#mrargs.limit},
+        {skip, Args#mrargs.skip},
+        {update_seq, Args#mrargs.update_seq},
+        {namespace, NS},
+        {include_docs, Args#mrargs.include_docs},
+        {doc_opts, DocOpts}
+] ++ StartKeyOpts ++ EndKeyOpts.
 
 Review comment:
   Missing indentation on this line.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to