Crudry v0.3.1 Crudry.Query View Source
Generates Ecto Queries.
All functions in this module return an Ecto.Query
.
Link to this section Summary
Functions
Filters the query
Applies some restrictions to the query
Searches for the search_term
in the given fields
Link to this section Functions
Filters the query.
Examples
Crudry.Query.filter(MySchema, %{id: 5, name: "John"})
Crudry.Query.filter(MySchema, %{name: ["John", "Doe"]})
Applies some restrictions to the query.
Expects opts
to be a map containing some of these fields:
limit
: defaults tonil
offset
: defaults to0
sorting_order
: defaults to:asc
order_by
: defaults to:id
Examples
Crudry.Query.list(MySchema, %{limit: 10})
Crudry.Query.list(MySchema, %{limit: 10, offset: 3, sorting_order: :desc, order_by: :value})