Copyright © Inaka <hello@inaka.net>
Main module for sumo. Use this one from your own applications.
Copyright 2012 Inaka <hello@inaka.net>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.condition() = {'and', [condition()]} | {'or', [condition()]} | {'not', condition()} | {field_name(), field_value()} | {field_name(), operator(), field_value()} | {field_name(), operator(), field_name()}
conditions() = condition() | [condition()]
custom_attr() = term()
field() = sumo_internal:field()
field_attr() = id | unique | index | not_null | auto_increment | {length, integer()} | custom_attr()
field_attrs() = [field_attr()]
field_name() = atom()
field_type() = integer | float | string | binary | boolean | date | datetime | custom
field_value() = term()
model() = #{field_name() => field_value()}
operator() = '<' | '>' | '==' | '=<' | '>=' | '/=' | like
schema() = sumo_internal:schema()
schema_name() = atom()
sort() = field_name() | {field_name(), sort_order()} | [{field_name(), sort_order()}]
sort_order() = asc | desc
user_doc() = term()
call/2 | Calls the given custom function of a store. |
call/3 | Calls the given custom function of a store with the given args. |
count/1 | Counts the total number of docs in the given schema name DocName . |
count_by/2 | Counts the total number of docs matching the provided Conditions. |
create_schema/0 | Creates the schema for all known (configured) docs. |
create_schema/1 | Creates the schema for the docs of type DocName. |
create_schema/2 |
Creates the schema for the docs of type DocName using the given Store . |
delete/2 | Deletes the doc identified by Id. |
delete_all/1 | Deletes all docs of type DocName. |
delete_by/2 | Deletes the doc identified by Conditions. |
fetch/2 | Returns the doc identified by Id. |
find_all/1 | Returns all docs from the given store. |
find_all/4 | Returns Limit docs from the given store, starting at offset. |
find_by/2 | Returns *all* docs that match Conditions. |
find_by/4 | Returns Limit number of docs that match Conditions, starting at offset Offset. |
find_by/5 | Returns Limit number of docs that match Conditions, starting at offset Offset. |
find_one/2 | Returns 1 doc that matches the given Conditions. |
new_field/2 | Returns a new field of the given type without attributes. |
new_field/3 | Returns a new field of the given type and attributes. |
new_schema/2 | Returns a new schema. |
persist/1 | Creates or updates the given Doc. |
persist/2 | Creates or updates the given Doc. |
call(DocName::schema_name(), Function::atom()) -> term()
Calls the given custom function of a store.
call(DocName::schema_name(), Function::atom(), Args::[term()]) -> term()
Calls the given custom function of a store with the given args.
count(DocName::schema_name()) -> non_neg_integer()
Counts the total number of docs in the given schema name DocName
.
count_by(DocName::schema_name(), Conditions::conditions()) -> non_neg_integer()
Counts the total number of docs matching the provided Conditions.
create_schema() -> ok
Creates the schema for all known (configured) docs.
create_schema(DocName::schema_name()) -> ok
Creates the schema for the docs of type DocName.
create_schema(DocName::schema_name(), Store::atom()) -> ok
Creates the schema for the docs of type DocName
using the given Store
.
delete(DocName::schema_name(), Id::user_doc()) -> boolean()
Deletes the doc identified by Id.
delete_all(DocName::schema_name()) -> non_neg_integer()
Deletes all docs of type DocName.
delete_by(DocName::schema_name(), Conditions::conditions()) -> non_neg_integer()
Deletes the doc identified by Conditions.
fetch(DocName::schema_name(), Id::field_value()) -> user_doc() | notfound
Returns the doc identified by Id.
find_all(DocName::schema_name()) -> [user_doc()]
Returns all docs from the given store.
find_all(DocName, SortFields0, Limit, Offset) -> Res
Returns Limit docs from the given store, starting at offset.
find_by(DocName::schema_name(), Conditions::conditions()) -> [user_doc()]
Returns *all* docs that match Conditions.
find_by(DocName, Conditions, Limit, Offset) -> Res
Returns Limit number of docs that match Conditions, starting at offset Offset.
find_by(DocName, Conditions, SortFields, Limit, Offset) -> Res
Returns Limit number of docs that match Conditions, starting at offset Offset.
find_one(DocName::schema_name(), Conditions::conditions()) -> user_doc() | notfound
Returns 1 doc that matches the given Conditions.
new_field(Name::field_name(), Type::field_type()) -> field()
Returns a new field of the given type without attributes.
new_field(Name::field_name(), Type::field_type(), Attributes::field_attrs()) -> field()
Returns a new field of the given type and attributes.
new_schema(Name::schema_name(), Fields::[field()]) -> schema()
Returns a new schema.
persist(Changeset) -> Return
Creates or updates the given Doc.
persist(DocName::schema_name(), UserDoc::user_doc()) -> user_doc()
Creates or updates the given Doc.
Generated by EDoc, Jul 19 2017, 12:55:45.