Module mekao

Data Types

b_query()

b_query() = query(iolist())

column()

column() = #mekao_column{}

entity()

entity() = tuple() | [term() | '$skip']

iotriple()

iotriple() = iodata() | {iodata(), iodata(), iodata()}

p_query()

p_query() = query(#mekao_insert{} | #mekao_select{} | #mekao_update{} | #mekao_delete{})

predicate()

predicate(Val) = Val | {'$predicate', between, Val, Val} | {'$predicate', in, [Val, ...]} | {'$predicate', '=' | '<>' | '>' | '>=' | '<' | '<=' | like, Val} | {'$predicate', 'not', predicate(Val)}

query()

query(Body) = #mekao_query{body = Body}

s()

s() = #mekao_settings{}

select_opt()

select_opt() = {limit, {RowCount::non_neg_integer(), Offset::non_neg_integer()}}

selector()

selector() = tuple() | [predicate(term()) | '$skip']

table()

table() = #mekao_table{}

Function Index

build/1
count/3Selects COUNT(*) with WHERE clause based on selector().
delete/3Deletes entities, composes WHERE clause from Selector non $skip fields.
delete_pk/3Deletes entity by primary key.
exists/3Selects one column called exists with value 1 or 0, depends on EXISTS clause return.
exists_pk/3Same as exists/3 but checks only primary key in EXISTS clause.
insert/3Inserts entity, omits columns with $skip value.
insert_all/3Inserts entities, places DEFAULT keyword when column with $skip value occurs.
prepare_count/3
prepare_delete/3
prepare_exists/3
prepare_insert/3
prepare_insert_all/3
prepare_select/3
prepare_select/4
prepare_update/4
select/3Selects several entities, omits columns with $skip value.
select/4
select_pk/3Reads entity by it's primary key.
update/4Updates entities, composes WHERE clause from Selector non $skip fields.
update_pk/3Updates entity by it's primary key, omits columns with $skip value.
update_pk_diff/4Updates only changed fields by primary key.

Function Details

build/1

build(Q::p_query()) -> b_query()

count/3

count(E::selector(), Table::table(), S::s()) -> {ok, b_query()}

Selects COUNT(*) with WHERE clause based on selector().

delete/3

delete(Selector::selector(), Table::table(), S::s()) -> {ok, b_query()}

Deletes entities, composes WHERE clause from Selector non $skip fields.

delete_pk/3

delete_pk(E::selector(), Table::table(), S::s()) -> {ok, b_query()} | {error, pk_miss}

Deletes entity by primary key.

exists/3

exists(E::selector(), Table::table(), S::s()) -> {ok, b_query()}

Selects one column called exists with value 1 or 0, depends on EXISTS clause return.

exists_pk/3

exists_pk(E::selector(), Table::table(), S::s()) -> {ok, b_query()} | {error, pk_miss}

Same as exists/3 but checks only primary key in EXISTS clause.

insert/3

insert(E::entity(), Table::table(), S::s()) -> {ok, b_query()} | {error, empty_insert}

Inserts entity, omits columns with $skip value.

insert_all/3

insert_all(Es::[entity(), ...], Table::table(), S::s()) -> {ok, b_query()}

Inserts entities, places DEFAULT keyword when column with $skip value occurs.

prepare_count/3

prepare_count(E::selector(), Table::table(), S::s()) -> p_query()

prepare_delete/3

prepare_delete(E::selector(), Table::table(), S::s()) -> p_query()

prepare_exists/3

prepare_exists(E::selector(), Table::table(), S::s()) -> p_query()

prepare_insert/3

prepare_insert(E::entity(), Table::table(), S::s()) -> p_query()

prepare_insert_all/3

prepare_insert_all(Es::[entity(), ...], Table::table(), S::s()) -> p_query()

prepare_select/3

prepare_select(E::selector(), Table::table(), S::s()) -> p_query()

prepare_select/4

prepare_select(E::selector(), Opts::[select_opt()], Table::table(), S::s()) -> p_query()

prepare_update/4

prepare_update(SetE::entity(), WhereE::selector(), Table::table(), S::s()) -> p_query()

select/3

select(E::selector(), Table::table(), S::s()) -> {ok, b_query()}

Selects several entities, omits columns with $skip value.

select/4

select(E::selector(), Opts::[select_opt()], Table::table(), S::s()) -> {ok, b_query()}

select_pk/3

select_pk(E::selector(), Table::table(), S::s()) -> {ok, b_query()} | {error, pk_miss}

Reads entity by it's primary key.

update/4

update(E::entity(), Selector::selector(), Table::table(), S::s()) -> {ok, b_query()} | {error, empty_update}

Updates entities, composes WHERE clause from Selector non $skip fields. This is possible to update PK as well if it is not ro = true.

update_pk/3

update_pk(E::selector(), Table::table(), S::s()) -> {ok, b_query()} | {error, pk_miss} | {error, empty_update}

Updates entity by it's primary key, omits columns with $skip value.

update_pk_diff/4

update_pk_diff(Old::entity(), New::entity(), Table::table(), S::s()) -> {ok, b_query()} | {error, pk_miss} | {error, empty_update}

Updates only changed fields by primary key. This is possible to update PK as well if it is not ro = true.


Generated by EDoc, Sep 12 2016, 22:00:10.