Rummage.Ecto v2.0.0 Rummage.Ecto.Config View Source

This module encapsulates all the Rummage's runtime configurations that can be set in the config.exs file.

This configuration is optional, as Rummage.Ecto can accept the same arguments as optional arguments to the function Rummage.Ecto.rummage/3

Usage:

A basic example without overriding default hooks:

config.exs:

config :app_name, Rummage.Ecto,

per_page: 10,
repo: AppName.Repo

This is a more advanced usage where you can specify the default hooks:

config.exs:

config :app_name, Rummage.Ecto,

per_page: 10,
repo: AppName.Repo,
search: Rummage.Ecto.Hook.Search,
sort: Rummage.Ecto.Hook.Sort,
paginate: Rummage.Ecto.Hook.Paginate

Link to this section Summary

Functions

:paginate hook can also be set at run time in the config.exs file

:per_page can also be set at run time in the config.exs file

:repo can also be set at run time in the config.exs file

:search hook can also be set at run time in the config.exs file. This pulls the configuration assocated with the application, application. When no application is given this defaults to rummage_ecto.

:sort hook can also be set at run time in the config.exs file

Link to this section Functions

Link to this function

paginate(application \\ :rummage_ecto)

View Source

:paginate hook can also be set at run time in the config.exs file

Examples

When no config is set, if returns the default hook (Rummage.Ecto.Hook.Paginate):

iex> alias Rummage.Ecto.Config
iex> Config.paginate
Rummage.Ecto.Hook.Paginate
Link to this function

per_page(application \\ :rummage_ecto)

View Source

:per_page can also be set at run time in the config.exs file

Examples

Returns default Repo set in the config (2 in rummage_ecto's test env):

iex> alias Rummage.Ecto.Config
iex> Config.per_page
2
Link to this function

repo(application \\ :rummage_ecto)

View Source

:repo can also be set at run time in the config.exs file

Examples

Returns default Repo set in the config (Rummage.Ecto.Repo in rummage_ecto's test env):

iex> alias Rummage.Ecto.Config
iex> Config.repo
Rummage.Ecto.Repo
Link to this function

search(application \\ :rummage_ecto)

View Source

:search hook can also be set at run time in the config.exs file. This pulls the configuration assocated with the application, application. When no application is given this defaults to rummage_ecto.

Examples

When no config is set, if returns the default hook (Rummage.Ecto.Hook.Search):

iex> alias Rummage.Ecto.Config
iex> Config.search
Rummage.Ecto.Hook.Search
Link to this function

sort(application \\ :rummage_ecto)

View Source

:sort hook can also be set at run time in the config.exs file

Examples

When no config is set, if returns the default hook (Rummage.Ecto.Hook.Sort):

iex> alias Rummage.Ecto.Config
iex> Config.sort
Rummage.Ecto.Hook.Sort