Rumamge.Ecto v1.0.0 Rummage.Ecto

Rummage.Ecto is a light weight, but powerful framework that can be used to alter Ecto queries with Search, Sort and Paginate operations.

It accomplishes the above operations by using Hooks, which are modules that implement Rumamge.Ecto.Hook behavior. Each operation: Search, Sort and Paginate have their hooks defined in Rummage. By doing this, we have made rummage completely configurable. For example, if you don’t like one of the implementations of Rummage, but like the other two, you can configure Rummage to not use it.

If you want to check a sample application that uses Rummage, please check this link.

Usage:

defmodule Rummage.Ecto.Product do
  use Ecto.Schema
  use Rummage.Ecto # Can pass options if need be
end

This allows you to do:

iex> rummage = %{"search" => %{"name" => %{"assoc" => [], "search_type" => "ilike", "search_term" => "field_!"}}}
iex> {queryable, rummage} = Rummage.Ecto.Product.rummage(Rummage.Ecto.Product, rummage)
iex> queryable
#Ecto.Query<from p in Rummage.Ecto.Product, where: ilike(p.name, ^"%field_!%")>
iex> rummage
%{"search" => %{"name" => %{"assoc" => [], "search_term" => "field_!", "search_type" => "ilike"}}}