Module sumo

Main module for sumo.

Copyright © Inaka <hello@inaka.net>

Description

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.

Data Types

condition()

condition() = {'and', [condition()]} | {'or', [condition()]} | {'not', condition()} | {field_name(), field_value()} | {field_name(), operator(), field_value()} | {field_name(), operator(), field_name()}

conditions()

conditions() = condition() | [condition()]

custom_attr()

custom_attr() = term()

field()

field() = sumo_internal:field()

field_attr()

field_attr() = id | unique | index | not_null | auto_increment | {length, integer()} | custom_attr()

field_attrs()

field_attrs() = [field_attr()]

field_name()

field_name() = atom()

field_type()

field_type() = integer | float | string | binary | boolean | date | datetime | custom

field_value()

field_value() = term()

model()

model() = #{field_name() => field_value()}

operator()

operator() = '<' | '>' | '==' | '=<' | '>=' | '/=' | like

schema()

schema() = sumo_internal:schema()

schema_name()

schema_name() = atom()

sort()

sort() = field_name() | {field_name(), sort_order()} | [{field_name(), sort_order()}]

sort_order()

sort_order() = asc | desc

user_doc()

user_doc() = term()

Function Index

call/2Calls the given custom function of a store.
call/3Calls the given custom function of a store with the given args.
count/1Counts the total number of docs in the given schema name DocName.
create_schema/0Creates the schema for all known (configured) docs.
create_schema/1Creates 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/2Deletes the doc identified by Id.
delete_all/1Deletes all docs of type DocName.
delete_by/2Deletes the doc identified by Conditions.
fetch/2Returns the doc identified by Id.
find_all/1Returns all docs from the given store.
find_all/4Returns Limit docs from the given store, starting at offset.
find_by/2Returns *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/2Returns 1 doc that matches the given Conditions.
new_field/2Returns a new field of the given type without attributes.
new_field/3Returns a new field of the given type and attributes.
new_schema/2Returns a new schema.
persist/1Creates or updates the given Doc.
persist/2Creates or updates the given Doc.

Function Details

call/2

call(DocName::schema_name(), Function::atom()) -> term()

Calls the given custom function of a store.

call/3

call(DocName::schema_name(), Function::atom(), Args::[term()]) -> term()

Calls the given custom function of a store with the given args.

count/1

count(DocName::schema_name()) -> non_neg_integer()

Counts the total number of docs in the given schema name DocName.

create_schema/0

create_schema() -> ok

Creates the schema for all known (configured) docs.

create_schema/1

create_schema(DocName::schema_name()) -> ok

Creates the schema for the docs of type DocName.

create_schema/2

create_schema(DocName::schema_name(), Store::atom()) -> ok

Creates the schema for the docs of type DocName using the given Store.

delete/2

delete(DocName::schema_name(), Id::user_doc()) -> boolean()

Deletes the doc identified by Id.

delete_all/1

delete_all(DocName::schema_name()) -> non_neg_integer()

Deletes all docs of type DocName.

delete_by/2

delete_by(DocName::schema_name(), Conditions::conditions()) -> non_neg_integer()

Deletes the doc identified by Conditions.

fetch/2

fetch(DocName::schema_name(), Id::field_value()) -> user_doc() | notfound

Returns the doc identified by Id.

find_all/1

find_all(DocName::schema_name()) -> [user_doc()]

Returns all docs from the given store.

find_all/4

find_all(DocName, SortFields0, Limit, Offset) -> Res

Returns Limit docs from the given store, starting at offset.

find_by/2

find_by(DocName::schema_name(), Conditions::conditions()) -> [user_doc()]

Returns *all* docs that match Conditions.

find_by/4

find_by(DocName, Conditions, Limit, Offset) -> Res

Returns Limit number of docs that match Conditions, starting at offset Offset.

find_by/5

find_by(DocName, Conditions, SortFields, Limit, Offset) -> Res

Returns Limit number of docs that match Conditions, starting at offset Offset.

find_one/2

find_one(DocName::schema_name(), Conditions::conditions()) -> user_doc() | notfound

Returns 1 doc that matches the given Conditions.

new_field/2

new_field(Name::field_name(), Type::field_type()) -> field()

Returns a new field of the given type without attributes.

new_field/3

new_field(Name::field_name(), Type::field_type(), Attributes::field_attrs()) -> field()

Returns a new field of the given type and attributes.

new_schema/2

new_schema(Name::schema_name(), Fields::[field()]) -> schema()

Returns a new schema.

persist/1

persist(Changeset) -> Return

Creates or updates the given Doc.

persist/2

persist(DocName::schema_name(), UserDoc::user_doc()) -> user_doc()

Creates or updates the given Doc.


Generated by EDoc, Jun 6 2017, 09:05:07.