Current section
4 Versions
Jump to
Current section
4 Versions
Compare versions
5
files changed
+29
additions
-24
deletions
| @@ -1,5 +1,5 @@ | |
| 1 1 | {<<"name">>,<<"couchbeam_amuino">>}. |
| 2 | - {<<"version">>,<<"1.4.3-amuino.5">>}. |
| 2 | + {<<"version">>,<<"1.4.3-amuino.6">>}. |
| 3 3 | {<<"requirements">>, |
| 4 4 | #{<<"hackney">> => |
| 5 5 | #{<<"app">> => <<"hackney">>,<<"optional">> => false, |
| @@ -28,6 +28,9 @@ | |
| 28 28 | -type db_name() :: binary() | string(). |
| 29 29 | -type docid() :: binary() | string(). |
| 30 30 | |
| 31 | + -type design_name() :: binary() | string(). |
| 32 | + -type view_name() :: binary() | string(). |
| 33 | + |
| 31 34 | -type ejson() :: ejson_object() | ejson_array(). |
| 32 35 | |
| 33 36 | -type ejson_array() :: [ejson_term()]. |
| @@ -2,6 +2,8 @@ | |
| 2 2 | |
| 3 3 | {erl_opts, [debug_info]}. |
| 4 4 | |
| 5 | + {plugins, [rebar3_hex]}. |
| 6 | + |
| 5 7 | {deps, [ |
| 6 8 | {jsx, "2.8.0"}, |
| 7 9 | {hackney, "1.6.5"} |
| @@ -1,6 +1,6 @@ | |
| 1 1 | {application,couchbeam_amuino, |
| 2 2 | [{description,"Erlang CouchDB client + fixes"}, |
| 3 | - {vsn,"1.4.3-amuino.5"}, |
| 3 | + {vsn,"1.4.3-amuino.6"}, |
| 4 4 | {modules,[]}, |
| 5 5 | {registered,[couchbeam_sup]}, |
| 6 6 | {applications,[kernel,stdlib,asn1,crypto,public_key,ssl,idna, |
| @@ -36,16 +36,16 @@ all(Db, Options) -> | |
| 36 36 | fetch(Db) -> |
| 37 37 | fetch(Db, 'all_docs', []). |
| 38 38 | |
| 39 | - -spec fetch(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 40 | - ViewName::string()}) |
| 39 | + -spec fetch(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 40 | + ViewName::view_name()}) |
| 41 41 | -> {ok, Rows::list(ejson_object())} | {error, term()}. |
| 42 42 | %% @equiv fetch(Db, ViewName, []) |
| 43 43 | fetch(Db, ViewName) -> |
| 44 44 | fetch(Db, ViewName,[]). |
| 45 45 | |
| 46 46 | |
| 47 | - -spec fetch(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 48 | - ViewName::string()}, Options::view_options()) |
| 47 | + -spec fetch(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 48 | + ViewName::view_name()}, Options::view_options()) |
| 49 49 | -> {ok, Rows::list(ejson_object())} | {error, term()}. |
| 50 50 | %% @doc Collect view results |
| 51 51 | %% <p>Db: a db record</p> |
| @@ -72,15 +72,15 @@ fetch(Db, ViewName, Options) -> | |
| 72 72 | end. |
| 73 73 | |
| 74 74 | |
| 75 | - -spec stream(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 76 | - ViewName::string()}) -> {ok, StartRef::term(), |
| 75 | + -spec stream(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 76 | + ViewName::view_name()}) -> {ok, StartRef::term(), |
| 77 77 | ViewPid::pid()} | {error, term()}. |
| 78 78 | %% @equiv stream(Db, ViewName, Client, []) |
| 79 79 | stream(Db, ViewName) -> |
| 80 80 | stream(Db, ViewName, []). |
| 81 81 | |
| 82 | - -spec stream(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 83 | - ViewName::string()}, Options::view_options()) |
| 82 | + -spec stream(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 83 | + ViewName::view_name()}, Options::view_options()) |
| 84 84 | -> {ok, StartRef::term()} | {error, term()}. |
| 85 85 | %% @doc stream view results to a pid |
| 86 86 | %% <p>Db: a db record</p> |
| @@ -193,14 +193,14 @@ stream_next(Ref) -> | |
| 193 193 | count(Db) -> |
| 194 194 | count(Db, 'all_docs', []). |
| 195 195 | |
| 196 | - -spec count(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 197 | - ViewName::string()}) -> integer() | {error, term()}. |
| 196 | + -spec count(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 197 | + ViewName::view_name()}) -> integer() | {error, term()}. |
| 198 198 | %% @equiv count(Db, ViewName, []) |
| 199 199 | count(Db, ViewName) -> |
| 200 200 | count(Db, ViewName, []). |
| 201 201 | |
| 202 | - -spec count(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 203 | - ViewName::string()}, Options::view_options()) |
| 202 | + -spec count(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 203 | + ViewName::view_name()}, Options::view_options()) |
| 204 204 | -> integer() | {error, term()}. |
| 205 205 | %% @doc count number of doc in a view (or all docs) |
| 206 206 | count(Db, ViewName, Options)-> |
| @@ -224,16 +224,16 @@ count(Db, ViewName, Options)-> | |
| 224 224 | first(Db) -> |
| 225 225 | first(Db, 'all_docs', []). |
| 226 226 | |
| 227 | - -spec first(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 228 | - ViewName::string()}) |
| 227 | + -spec first(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 228 | + ViewName::view_name()}) |
| 229 229 | -> {ok, Row::ejson_object()} | {error, term()}. |
| 230 230 | %% @equiv first(Db, ViewName, []) |
| 231 231 | first(Db, ViewName) -> |
| 232 232 | first(Db, ViewName,[]). |
| 233 233 | |
| 234 234 | |
| 235 | - -spec first(Db::db(), ViewName::'all_docs' | {DesignName::string(), |
| 236 | - ViewName::string()}, Options::view_options()) |
| 235 | + -spec first(Db::db(), ViewName::'all_docs' | {DesignName::design_name(), |
| 236 | + ViewName::view_name()}, Options::view_options()) |
| 237 237 | -> {ok, Rows::ejson_object()} | {error, term()}. |
| 238 238 | %% @doc get first result of a view |
| 239 239 | %% <p>Db: a db record</p> |
| @@ -273,15 +273,15 @@ first(Db, ViewName, Options) -> | |
| 273 273 | end). |
| 274 274 | |
| 275 275 | -spec fold(Function::function(), Acc::any(), Db::db(), |
| 276 | - ViewName::'all_docs' | {DesignName::string(), ViewName::string()}) |
| 276 | + ViewName::'all_docs' | {DesignName::design_name(), ViewName::view_name()}) |
| 277 277 | -> list(term()) | {error, term()}. |
| 278 278 | %% @equiv fold(Function, Acc, Db, ViewName, []) |
| 279 279 | fold(Function, Acc, Db, ViewName) -> |
| 280 280 | fold(Function, Acc, Db, ViewName, []). |
| 281 281 | |
| 282 282 | -spec fold(Function::function(), Acc::any(), Db::db(), |
| 283 | - ViewName::'all_docs' | {DesignName::string(), |
| 284 | - ViewName::string()}, Options::view_options()) |
| 283 | + ViewName::'all_docs' | {DesignName::design_name(), |
| 284 | + ViewName::view_name()}, Options::view_options()) |
| 285 285 | -> list(term()) | {error, term()}. |
| 286 286 | %% @doc call Function(Row, AccIn) on succesive row, starting with |
| 287 287 | %% AccIn == Acc. Function/2 must return a new list accumultator or the |
| @@ -302,15 +302,15 @@ fold(Function, Acc, Db, ViewName, Options) -> | |
| 302 302 | end. |
| 303 303 | |
| 304 304 | -spec foreach(Function::function(), Db::db(), |
| 305 | - ViewName::'all_docs' | {DesignName::string(), ViewName::string()}) |
| 305 | + ViewName::'all_docs' | {DesignName::design_name(), ViewName::view_name()}) |
| 306 306 | -> list(term()) | {error, term()}. |
| 307 307 | %% @equiv foreach(Function, Db, ViewName, []) |
| 308 308 | foreach(Function, Db, ViewName) -> |
| 309 309 | foreach(Function, Db, ViewName, []). |
| 310 310 | |
| 311 311 | -spec foreach(Function::function(), Db::db(), |
| 312 | - ViewName::'all_docs' | {DesignName::string(), |
| 313 | - ViewName::string()}, Options::view_options()) |
| 312 | + ViewName::'all_docs' | {DesignName::design_name(), |
| 313 | + ViewName::view_name()}, Options::view_options()) |
| 314 314 | -> list(term()) | {error, term()}. |
| 315 315 | %% @doc call Function(Row) on succesive row. Example: |
| 316 316 | %% ``` |