FatEcto.Pagination.Helper (FatEcto v1.2.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_limit
anddefault_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:limit
value.options
: A keyword list or map containingmax_limit
anddefault_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:skip
value.
Examples
iex> FatEcto.Pagination.Helper.get_skip_value(skip: 20)
{20, []}