View Source Pageantry.Field (Pageantry v0.5.2)

Field definition for sorting/filtering.

Fields

  • field : Field name (in schema), eg :inserted_at.
  • relation : If field is not directly in schema, how the field is related.
  • repo : HACK this can be removed when Pageantry.Page.build_subquery_condition/3 no longer needs it.
  • sort : True if sortable (defaults to true).
  • filter : Filter type:
    • :false: Cannot be used as filter.
    • :equal: Filter value must be exactly equal to field value.
    • :like: Filter value matched to field value with SQL LIKE.
    • :boolean: Filter and field values casted to boolean and matched. For cases where you want to filter on whether an optional field has been set (eg "has_address=yes").
  • all : True if included in special :ALL filter (defaults to true).

Summary

Types

@type filter() :: false | :equal | :like | :boolean
@type t() :: %Pageantry.Field{
  all: boolean(),
  field: atom(),
  filter: filter(),
  relation: Pageantry.FieldRelation.t(),
  repo: Ecto.Repo.t(),
  sort: boolean()
}