Flicker.Query.Invalid (Flicker v0.1.0)

Copy Markdown View Source

A facet token whose key and operator were both recognised but whose value would not cast (ADR-012).

Such a token is neither a filter nor free text. It is recorded in Flicker.Query's :invalid list so a component can render it as an error with a real message — status:activ names a facet Flicker knows about, with an operator it allows, and got the value wrong, which is enough information to say precisely what was expected. Degrading it to free text (the fate of an unknown key) would discard all of that and search for the literal text instead, which matches nothing and explains nothing.

Fields

  • :key — the facet key that was recognised.
  • :operator — the operator that was recognised, already resolved through the facet's :default_op for the bare : form.
  • :raw — the value exactly as typed, before any casting.
  • :token — the whole key<op>value token as typed, for rendering the error against what the user actually wrote.
  • :reason — a machine-readable atom (:not_in_values, :reversed_range, ...). Rendered through Flicker.Messages (ADR-009); the parser never produces user-facing English.
  • :params — the details that reason needs (%{values: [...]}, %{min: 0, max: 500}), also for the message and, in Spec 023, for computing a correction.

Summary

Types

t()

A recognised facet whose value failed to cast.

Types

t()

@type t() :: %Flicker.Query.Invalid{
  key: atom(),
  operator: Flicker.Facet.operator(),
  params: map(),
  raw: String.t(),
  reason: atom(),
  token: String.t()
}

A recognised facet whose value failed to cast.