sumo_sql_builder
Small and simple SQL builder.
Small and simple SQL builder.
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.Types
condition() =
{'and', [condition()]} |
{'or', [condition()]} |
{field(), term()}
field() = string() | atom()
Functions
s_count(TableName::string(), SelectFields::[field()], Conditions::condition(), ExtraWhere::string()) -> {iolist(), [term()]}
Returns number of results, useful for pagination.
s(TableName::string(), SelectFields::[field()], Conditions::condition(), ExtraWhere::string(), Page::non_neg_integer(), PageSize::non_neg_integer(), OrderBy::string()) -> {iolist(), [term()]}
Generic select function.
i(TableName::atom() | string(), Proplist::proplist() (see module proplists)) -> {iodata(), [term()]}
INSERT.
u(TableName::atom() | string(), UpdateFields::proplist() (see module proplists), Conditions::condition()) -> {iodata(), [term()], [term()]}
UPDATE.
d(TableName::string(), Conditions::condition()) -> {iolist(), [term()]}
DELETE.