# Tempo SQL v0.2.0 - Table of Contents

> Ecto types and migration helpers for persisting Tempo intervals and interval sets as PostgreSQL tstzrange/tstzmultirange values.

## Pages

- [Tempo SQL](readme.md)
- [Storage contract](storage-contract.md)
- [Changelog](changelog.md)
- [License](license.md)

## Modules

- [Tempo.Ecto.Interval](Tempo.Ecto.Interval.md): Ecto.ParameterizedType for persisting a `t:Tempo.Interval.t/0`
as a PostgreSQL `tstzrange` value.
- [Tempo.Ecto.IntervalSet](Tempo.Ecto.IntervalSet.md): Ecto.ParameterizedType for persisting a
`t:Tempo.IntervalSet.t/0` as a PostgreSQL `tstzmultirange`
value (PostgreSQL 14+).
- [Tempo.Ecto.QueryAPI](Tempo.Ecto.QueryAPI.md): Ecto query fragments for PostgreSQL range operators, named after
Allen's interval algebra so queries read as English sentences.
- [Tempo.Ecto.QueryAPI.Composite](Tempo.Ecto.QueryAPI.Composite.md): Ecto query fragments for the `tempo_range` and
`tempo_multirange` composite types — the same Allen-named
macros as `Tempo.Ecto.QueryAPI`, but auto-unwrapping the
`(column).range` / `(column).ranges` field so Postgres range
operators can apply.
- [Tempo.Ecto.Tempo](Tempo.Ecto.Tempo.md): Ecto.ParameterizedType for persisting a bare `t:Tempo.t/0` as
a PostgreSQL `tstzrange`.
- [Tempo.Ecto.TempoMultirange](Tempo.Ecto.TempoMultirange.md): 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.
- [Tempo.Ecto.TempoRange](Tempo.Ecto.TempoRange.md): Ecto.ParameterizedType for the PostgreSQL composite type
`tempo_range` — a `tstzrange` paired with a Tempo-resolution
string and a `jsonb` metadata column that together preserve
the full Tempo shape on round-trip.
- [Tempo.SQL](Tempo.SQL.md): Top-level namespace for `ex_tempo_sql` — Ecto types and migration
helpers that persist Tempo values as PostgreSQL range types.
- [Tempo.SQL.Conversion](Tempo.SQL.Conversion.md): Internal helpers that translate between `t:Tempo.Interval.t/0`
endpoints and the `DateTime` / `:unbound` values that
`Postgrex.Range` understands.
- [Tempo.SQL.JSON](Tempo.SQL.JSON.md): Shim module that adapts Erlang's built-in `:json` (OTP 27+) to
Postgrex's expected JSON-library interface.
- [Tempo.SQL.Meta](Tempo.SQL.Meta.md): JSON encoding and decoding for the `meta` column of the
`tempo_range` and `tempo_multirange` composite types.
- [Tempo.SQL.Migration](Tempo.SQL.Migration.md): Ecto migration helpers for the Tempo PostgreSQL range types.

- Exceptions
  - [Tempo.SQL.UnsupportedValueError](Tempo.SQL.UnsupportedValueError.md): Raised (or returned from `cast/2`) when a Tempo value cannot be
stored in a PostgreSQL range type.

