You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/10/12 21:26:56 UTC
[2/3] couch commit: updated refs/heads/add-filter-revs-limit to
6198f80
Add specs to document validate_doc_update/5
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/a316f9b5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/a316f9b5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/a316f9b5
Branch: refs/heads/add-filter-revs-limit
Commit: a316f9b5d71911366ed0f96dbf94e790c1477e85
Parents: 07e5eac
Author: Russell Branca <ch...@apache.org>
Authored: Mon Oct 12 19:26:05 2015 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Mon Oct 12 19:26:05 2015 +0000
----------------------------------------------------------------------
include/couch_db.hrl | 7 +++++++
src/couch_query_servers.erl | 8 ++++++++
2 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a316f9b5/include/couch_db.hrl
----------------------------------------------------------------------
diff --git a/include/couch_db.hrl b/include/couch_db.hrl
index 3c4eacf..a7a1fdb 100644
--- a/include/couch_db.hrl
+++ b/include/couch_db.hrl
@@ -229,3 +229,10 @@
atts = []
}).
+
+-type doc() :: #doc{}.
+-type ddoc() :: #doc{}.
+-type user_ctx() :: #user_ctx{}.
+-type sec_props() :: [tuple()].
+-type sec_obj() :: {sec_props()}.
+
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a316f9b5/src/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couch_query_servers.erl b/src/couch_query_servers.erl
index 72d2329..cf3e18b 100644
--- a/src/couch_query_servers.erl
+++ b/src/couch_query_servers.erl
@@ -256,7 +256,15 @@ get_number(Key, Props) ->
throw({invalid_value, iolist_to_binary(Msg)})
end.
+
% use the function stored in ddoc.validate_doc_update to test an update.
+-spec validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) -> ok when
+ DDoc :: ddoc(),
+ EditDoc :: doc(),
+ DiskDoc :: doc() | nil,
+ Ctx :: user_ctx(),
+ SecObj :: sec_obj().
+
validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) ->
JsonEditDoc = couch_doc:to_json_obj(EditDoc, [revs]),
JsonDiskDoc = json_doc(DiskDoc),