Module sumo_store

Main interface for stores.

Copyright © Inaka <hello@inaka.net>

Behaviours: gen_server.

This module defines the sumo_store behaviour.
Required callback functions: init/1, persist/2, fetch/3, delete_by/3, delete_all/2, find_by/3, find_by/5, find_by/6, find_all/2, find_all/5, create_schema/2.

Description

Main interface for stores.

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

affected_rows()

affected_rows() = unknown | non_neg_integer()

result()

result(S) = {ok, S} | {error, term(), S}

result()

result(R, S) = {ok, R, S} | {error, term(), S}

Function Index

call/4Calls a custom function in the given store name.
create_schema/2Creates the schema of the given docs in the given store name.
delete_all/2Deletes all docs in the given store name.
delete_by/3Deletes the docs identified by the given conditions.
fetch/3Fetch a single doc by its Id.
find_all/2Returns all docs from the given store name.
find_all/5 Returns Limit docs starting at Offset from the given store name, ordered by OrderField.
find_by/3 Finds documents that match the given conditions in the given store name.
find_by/5 Finds documents that match the given conditions in the given store name.
find_by/6 Finds documents that match the given conditions in the given store name.
persist/2Persist the given doc with the given store name.
start_link/3Starts and links a new process for the given store implementation.

Function Details

call/4

call(Name, DocName, Function, Args) -> Res

Calls a custom function in the given store name.

create_schema/2

create_schema(Name::atom(), Schema::sumo:schema()) -> ok | {error, term()}

Creates the schema of the given docs in the given store name.

delete_all/2

delete_all(Name, DocName) -> Res

Deletes all docs in the given store name.

delete_by/3

delete_by(Name, DocName, Conditions) -> Res

Deletes the docs identified by the given conditions.

fetch/3

fetch(Name, DocName, Id) -> Res

Fetch a single doc by its Id.

find_all/2

find_all(Name, DocName) -> Res

Returns all docs from the given store name.

find_all/5

find_all(Name, DocName, SortFields, Limit, Offset) -> Res

Returns Limit docs starting at Offset from the given store name, ordered by OrderField. OrderField may be 'undefined'.

find_by/3

find_by(Name, DocName, Conditions) -> Res

Finds documents that match the given conditions in the given store name.

find_by/5

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

Finds documents that match the given conditions in the given store name.

find_by/6

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

Finds documents that match the given conditions in the given store name.

persist/2

persist(Name, Doc) -> Res

Persist the given doc with the given store name.

start_link/3

start_link(Name::atom(), Module::module(), Options::[term()]) -> {ok, pid()}

Starts and links a new process for the given store implementation.


Generated by EDoc, Sep 29 2016, 11:57:22.