Ecto.ParameterizedType for the PostgreSQL composite type
tempo_multirange — a tstzmultirange paired with a
resolution string and jsonb metadata that together round-
trip a full %Tempo.IntervalSet{} without information loss.
CREATE TYPE tempo_multirange AS (
ranges tstzmultirange,
resolution text,
meta jsonb
);The meta column stores the set as a JSON document keyed by member index, so qualifications, recurrence state, and other per-member facts survive the round-trip.
See Tempo.Ecto.TempoRange for the setup and query
conventions.
Summary
Functions
Builds the parameterized-type tuple for use outside a schema.
Functions
Builds the parameterized-type tuple for use outside a schema.
See Tempo.Ecto.Interval.cast_type/1 for the schema-side
equivalent and the full discussion.
Arguments
optionsis a keyword list of options.
Options
:resolutiontruncates the endpoints recorded in the composite to the given component. One of:year,:month,:day,:hour,:minute, or:second. Defaults to:second.
Returns
- A
Ecto.ParameterizedType.opts/0tuple.
Examples
iex> Tempo.Ecto.TempoMultirange.cast_type()
{:parameterized, {Tempo.Ecto.TempoMultirange, %{resolution: :second}}}
iex> Tempo.Ecto.TempoMultirange.cast_type(resolution: :day)
{:parameterized, {Tempo.Ecto.TempoMultirange, %{resolution: :day}}}