Ecto Filters v0.1.1 EctoFilters View Source

Adds function to transform request params into ecto query expressions.

Link to this section Summary

Functions

Applies filters to a queryable. Accepts an Ecto.Queryable and a map of with the "q" string key and returns an Ecto.Queryable.

Link to this section Functions

Link to this macro

__using__(opts) View Source (macro)

Applies filters to a queryable. Accepts an Ecto.Queryable and a map of with the "q" string key and returns an Ecto.Queryable.

Examples

iex> apply_filters(Post, %{"q" => %{"title" => "Ecto Filters"}}) |> MyRepo.all()
[%Post{title: "Ecto Filters"}, ...]