FatEcto.Pagination.Helper (FatEcto v1.3.0)
View SourceProvides utility functions for FatEcto, including handling pagination limits, skip values, dynamic binding, and preloading associations.
Summary
Functions
Returns the maximum and default limit values based on the provided options.
Extracts and validates the limit value from the given parameters.
Extracts and validates the skip value from the given parameters.
Functions
Returns the maximum and default limit values based on the provided options.
Parameters
options: A keyword list or map containingmax_limitanddefault_limit.
Examples
iex> FatEcto.Pagination.Helper.get_limit_bounds(max_limit: 50, default_limit: 10)
{50, 10}
Extracts and validates the limit value from the given parameters.
Parameters
params: A keyword list containing the:limitvalue.options: A keyword list or map containingmax_limitanddefault_limit.
Examples
iex> FatEcto.Pagination.Helper.get_limit_value([limit: 15], max_limit: 50, default_limit: 10)
{15, []}
Extracts and validates the skip value from the given parameters.
Parameters
params: A keyword list containing the:skipvalue.
Examples
iex> FatEcto.Pagination.Helper.get_skip_value(skip: 20)
{20, []}