Rumamge.Ecto v1.2.0 Rummage.Ecto.Config

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

Summary

Functions

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

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

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

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

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

resolve_system_config returns a system variable set up with var_name key or returns the specified default value. Takes in arg whose first element is an atom :system

Functions

default_paginate()

:default_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.Hooks.Paginate):

iex> alias Rummage.Ecto.Config
iex> Config.default_paginate
Rummage.Ecto.Hooks.Paginate
default_per_page()

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

Examples

Returns default Repo set in the config (2 inrummage_ecto`’s test env): iex> alias Rummage.Ecto.Config iex> Config.default_per_page 2

default_repo()

:default_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.default_repo
Rummage.Ecto.Repo
default_search()

:default_search 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.Hooks.Search):

iex> alias Rummage.Ecto.Config
iex> Config.default_search
Rummage.Ecto.Hooks.Search
default_sort()

:default_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.Hooks.Sort):

iex> alias Rummage.Ecto.Config
iex> Config.default_sort
Rummage.Ecto.Hooks.Sort
resolve_system_config(arg, default)
resolve_system_config(Tuple.t, term) :: {term}

resolve_system_config returns a system variable set up with var_name key or returns the specified default value. Takes in arg whose first element is an atom :system.

Examples

Returns value corresponding to a system variable config or returns the default value:

iex> alias Rummage.Ecto.Config
iex> Config.resolve_system_config({:system, "some random config"}, "default")
"default"