System-versioned temporal tables for Ecto and PostgreSQL.
See SysTime.Schema, SysTime.Repo, and SysTime.Migration for
setup. Explicit temporal reads are available through SysTime.Query.
Summary
Functions
Returns the active travel instant, or nil outside travel.
Rewrites live sources to temporal views while travelling, changing names only.
Returns whether schema was defined with temporal_schema/2.
Runs fun in a read-only transaction resolving temporal schemas at instant.
Returns the repository transaction result.
Runs travel/4 and returns the callback result.
Returns whether the calling process is inside travel/4.
Functions
@spec as_of() :: DateTime.t() | nil
Returns the active travel instant, or nil outside travel.
@spec rewrite(Ecto.Query.t()) :: Ecto.Query.t()
Rewrites live sources to temporal views while travelling, changing names only.
Returns whether schema was defined with temporal_schema/2.
@spec travel(Ecto.Repo.t(), DateTime.t(), (-> result), keyword()) :: {:ok, result} | {:error, term()} when result: term()
Runs fun in a read-only transaction resolving temporal schemas at instant.
Returns the repository transaction result.
@spec travel!(Ecto.Repo.t(), DateTime.t(), (-> result), keyword()) :: result when result: term()
Runs travel/4 and returns the callback result.
Raises SysTime.RollbackError if the callback explicitly rolls back the
read-only transaction.
@spec travelling?() :: boolean()
Returns whether the calling process is inside travel/4.