# `Tempo.Ecto.TempoMultirange`
[🔗](https://github.com/elixir-tempo/tempo_sql/blob/v0.4.0/lib/tempo/ecto/tempo_multirange.ex#L2)

Ecto.ParameterizedType for the PostgreSQL composite type
`tempo_multirange` — a `tstzmultirange` paired with a
resolution string and `jsonb` metadata that together round-
trip a set, or any expression of several spans with ISO 8601 text,
without information loss.

    CREATE TYPE tempo_multirange AS (
      ranges     tstzmultirange,
      resolution text,
      meta       jsonb
    );

A floating expression, with no zone and no time shift, is kept in
`tempo_floating_multirange`, the same with a `tsmultirange` for its
ranges: a field declared with `frame: :floating`.

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.

# `cast_type`

```elixir
@spec cast_type(keyword()) :: Ecto.Type.t()
```

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

* `options` is a keyword list of options.

### Options

* `:resolution` truncates the endpoints recorded in the composite to the given component. One of
  `:year`, `:month`, `:day`, `:hour`, `:minute`, or `:second`.
  Defaults to `:second`.

* `:frame` is `:utc` (the default) for a `tempo_multirange` column,
  or `:floating` for a `tempo_floating_multirange` column.

### Returns

* A `t:Ecto.ParameterizedType.opts/0` tuple.

### Examples

    iex> Tempo.Ecto.TempoMultirange.cast_type()
    {:parameterized, {Tempo.Ecto.TempoMultirange, %{frame: :utc, resolution: :second}}}

    iex> Tempo.Ecto.TempoMultirange.cast_type(resolution: :day, frame: :floating)
    {:parameterized, {Tempo.Ecto.TempoMultirange, %{frame: :floating, resolution: :day}}}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
