Decant.Field (Decant v0.1.0-beta.2)

Copy Markdown View Source

A normalized searchable field.

Field specs accepted by Decant.dynamic/2:

  • {binding, column} — match column on the named binding binding.
  • {binding, column, opts} — with per-field opts:
    • :cast:string wraps the column in CAST(? AS TEXT).
    • :match:contains | :prefix | :suffix | :exact, overriding the call-wide :match for this field only.

binding is the atom passed to as: in the host query. column is the schema field atom.

Summary

Functions

Normalize a user field spec into a %Decant.Field{}.

Types

t()

@type t() :: %Decant.Field{
  binding: atom(),
  cast: :string | nil,
  column: atom(),
  match: :contains | :prefix | :suffix | :exact | nil
}

Functions

normalize(field)

@spec normalize(tuple() | t()) :: t()

Normalize a user field spec into a %Decant.Field{}.