Home

Awesome

RummageEctoExample

This app demonstrates the usage of Rummage.Ecto

This app currently uses rummage_ecto, 1.3.0-rc.0

Setup

Things to Try out (in the console):

{query, rummage} = Product.rummage(%{paginate: %{per_page: 1, page: 2},
  sort: %{field: :name, order: :desc},
  search: %{name: %{search_type: :ilike, search_term: "product"}}})

Repo.all(query)
{query, rummage} = Product.rummage(%{paginate: %{per_page: 10, page: 1},
  sort: %{field: :category_name, assoc: [inner: :category], order: :desc},
  search: %{name: %{search_type: :ilike, search_term: "product"}}})

Repo.all(query)
{query, rummage} = Product.rummage(%{paginate: %{per_page: 10, page: 1},
  sort: %{field: :category_name, assoc: [inner: :category], order: :desc},
  search: %{category_name: %{assoc: [inner: :category], search_type: :ilike,
    search_term: "1"}}})

Repo.all(query)
{query, rummage} = Product.rummage(%{paginate: %{per_page: 10, page: 1},
  sort: %{field: :category_name, assoc: [inner: :category], order: :desc},
  search: %{category_name: %{assoc: [inner: :category, inner: :category], search_type: :ilike,
    search_term: "1"}}})

Repo.all(query)
{query, rummage} = Product.rummage(%{paginate: %{per_page: 10, page: 1},
  sort: %{field: :category_name, assoc: [inner: :category, inner: :category], order: :desc},
  search: %{name: %{search_type: :ilike, search_term: "product"}}})

Repo.all(query)
opts = [paginate: Rummage.Ecto.CustomHooks.KeysetPaginate,
  sort: Rummage.Ecto.CustomHooks.SimpleSort,
  search: Rummage.Ecto.CustomHooks.SimpleSearch]

{query, rummage} = Product.rummage(%{paginate: %{per_page: 10, page: 1},
  sort: %{field: :name, order: :desc},
  search: %{name: %{search_type: :ilike, search_term: "1"}}}, opts)

Repo.all(query)