query v0.3.0 Query.Builder.Page

Provides paging details for our Query.Builder.

Link to this section Summary

Functions

Provides paging details based on the provided params and options

Link to this section Functions

Link to this function new(params \\ %{}, options \\ [])

Provides paging details based on the provided params and options.

Parameters

  • params: A param map - most likely from a controller.
  • options: A list of options.

Options

  • :default_page - the default page if none is provided. Defaults to 1.
  • :default_limit - the default limit. Defaults to 20.
  • :limit_param - the param key to use for the limit. Deafults to “limit”.
  • :page_param - the param key to use for the page. Defaults to “page”.

Examples

iex> Query.Builder.Page.new(%{"page" => 2, "per" => 10}, %{"limit_param" => "per"})
{10, 20, 2}