Changelog
View SourceAll notable changes to ex_tempo_sql are documented here, following Keep a Changelog.
[0.1.0] — 2026-07-05
Highlights
Tempo SQL persists Tempo intervals and interval sets as PostgreSQL range types, wiring the half-open
[from, to)convention through totstzrange/tstzmultirangenatively.Ecto types.
Tempo.Ecto.Intervalstores a%Tempo.Interval{}aststzrange;Tempo.Ecto.IntervalSetstores a%Tempo.IntervalSet{}aststzmultirange(PG 14+);Tempo.Ecto.Tempomaterialises a bare%Tempo{}implicit span before delegating to the interval type.Storage contract. Each type is explicit about what it refuses to store: recurrence rules, qualifications, non-Gregorian calendars, multi-valued token slots, and ordinal/week-date endpoints all return
:errorfromdump/1rather than silently losing information. See the "Storage contract" section of the README.Migration helpers.
Tempo.SQL.Migrationexposesadd_interval/2,add_interval_set/2, andcreate_interval_index/3. Range queries require GiST indexes for speed; the helper handles that.Query API.
Tempo.Ecto.QueryAPIwraps Postgres range operators (@>,&&,-|-,<<,>>) under Allen's interval-algebra names —contains,overlaps,meets,strictly_before,strictly_after.Round-trip note. The plain-range types (
Tempo.Ecto.Interval,.IntervalSet,.Tempo) are lossy on metadata — qualifications, recurrence rules, calendars, zone identifiers, and the implicit-vs-explicit-span distinction are dropped on store. Partial resolution is recoverable via the:resolutionfield option. For full round-trip fidelity, use the composite types below.Composite
tempo_range/tempo_multirangetypes.Tempo.Ecto.TempoRangeandTempo.Ecto.TempoMultirangepersist the full Tempo shape byte-for-byte via a PostgreSQL composite type pairing atstzrange/tstzmultirangewith ajsonbmeta column. One-time migration creates the types (Tempo.SQL.Migration.create_tempo_types/0); field helpers (add_tempo_range/2,add_tempo_multirange/2) declare the columns;Tempo.Ecto.QueryAPI.Compositeprovides auto-unwrapping query macros. Uses Erlang's built-in:json(OTP 27+) via theTempo.SQL.PostgresTypesmodule — no Jason dependency.