Flop.Filter (Flop v0.11.0) View Source

Defines a filter.

Link to this section Summary

Types

Represents valid filter operators.

t()

Represents filter query parameters.

Link to this section Types

Specs

op() ::
  :==
  | :!=
  | :=~
  | :<=
  | :<
  | :>=
  | :>
  | :in
  | :like
  | :like_and
  | :like_or
  | :ilike
  | :ilike_and
  | :ilike_or

Represents valid filter operators.

OperatorValueWHERE clause
:=="Salicaceae"WHERE column = 'Salicaceae'
:!="Salicaceae"WHERE column != 'Salicaceae'
:=~"cyth"WHERE column ILIKE '%cyth%'
:<=10WHERE column <= 10
:<10WHERE column < 10
:>=10WHERE column >= 10
:>10WHERE column > 10
:in["pear", "plum"]WHERE column IN ('pear', 'plum')
:like"cyth"WHERE column LIKE '%cyth%'
:like_and"Rubi Rosa"WHERE column LIKE '%Rubi%' AND column LIKE '%Rosa%'
:like_or"Rubi Rosa"WHERE column LIKE '%Rubi%' OR column LIKE '%Rosa%'
:ilike"cyth"WHERE column ILIKE '%cyth%'
:ilike_and"Rubi Rosa"WHERE column ILIKE '%Rubi%' AND column ILIKE '%Rosa%'
:ilike_or"Rubi Rosa"WHERE column ILIKE '%Rubi%' OR column ILIKE '%Rosa%'

Specs

t() :: %Flop.Filter{field: atom() | String.t(), op: op(), value: any()}

Represents filter query parameters.

Fields

  • field: The field the filter is applied to. The allowed fields can be restricted by deriving Flop.Schema in your Ecto schema.
  • op: The filter operator.
  • value: The comparison value of the filter.