View Source Pageantry.Validation (Pageantry v0.6.0)

Definitions and restrictions for paging/sorting/filtering.

Fields

  • schema : Ecto schema to be paged.
  • max_off : Maximum page offset, 0 for unlimited (the default).
  • max_max : Maximum max-items-per-page, eg 1000.
  • max_pages : Maximum pages to display in UI paging control, eg 10 for a control like "<< 1 2 3 4 5 6 7 8 9 10 >>".
  • base_sort : Sort always applied after user-supplied sort, eg [asc: :id] to always sort by id field as the last item of the SQL ORDER clause.
  • base_filter : Filter always applied in addition to user-supplied filter, eg [active: true] to restrict results to active items only.
  • fields : Keyword list of fields that can be used for sorting/filtering. The field keywords represent the name of the field exposed to the user, and don't have to match the field name in the schema. For example, user_id can be used for the id field of the User schema and org_id can be used for the id field of the Organization schema, etc.

Summary

Types

t()

@type t() :: %Pageantry.Validation{
  base_filter: keyword(atom()),
  base_sort: keyword(atom()),
  fields: keyword(Pageantry.Field.t()),
  max_max: integer(),
  max_off: integer(),
  max_pages: integer(),
  schema: Ecto.Schema.t()
}