The resolved configuration behind use StatifierPersistence.Ecto.
ADR-0002 decision 3 requires that the generated schemas and the
migrations helper take the same options and cannot disagree. This module
is the single definition site that makes that true: __using__/1 builds
a Config at the host's compile time, and the migrations helper reads
the same struct (via for: HostModule) or funnels literal options
through the same new/1.
Options:
:repo- required, the host'sEcto.Repomodule:key- the surrogate-key scheme,:uxid(default),:uuid,:bigserial, or{module, opts}implementingStatifierPersistence.Ecto.KeyGenerator:table_prefix- prefix for the generated table names, default"statifier_":tables- per-table override map with keys:charts,:positions,:runs,:inputs; an override replaces the whole name, prefix included:prefix- the Postgres schema (Ecto's@schema_prefix), defaultnil:blob_type- the Ecto type applied to the payload blob columns (identity_blob,chart_blob,position_blob,outcome_blob, andinput_blobsince ADR-0010 decision 4), default:binary(the built-inbyteabehaviour, unchanged). Pass a module implementingEcto.Typeforfield(name, Mod), or a{module, opts}tuple for anEcto.ParameterizedTypeforfield(name, Mod, opts)- the shape Ecto itself uses to declare a parameterized field. Keys and lookup columns (content_hash,session_id,run_id,status,failure,seq,door) are never affected; only the payload blob columns reach this option. Resolved and stored on the struct as:binary(bare) or{module, opts}(normalized, so a bare custom module becomes{module, []}) - one shape for downstream code to read.
Unknown options and unknown table keys raise ArgumentError - at the
host's compile time when reached through use.
Summary
Functions
The resolved field/3 arguments for a blob column under this
configuration: [name, :binary] for the default, or
[name, module, opts] for a custom :blob_type (opts is [] for
a bare custom module, since field/3 treats an empty-opts
parameterized call and a plain Ecto.Type call identically).
Validates and resolves the options use StatifierPersistence.Ecto
accepts. Raises ArgumentError on anything malformed.
The table name (source) for table under this configuration: the
per-table override when one was given, otherwise the table prefix plus
the table's own name.
Types
@type t() :: %StatifierPersistence.Ecto.Config{ blob_type: :binary | {module(), keyword()}, key: {module(), keyword()}, prefix: String.t() | nil, repo: module(), table_prefix: String.t(), tables: %{ optional(StatifierPersistence.Ecto.KeyGenerator.table()) => String.t() } }
Resolved configuration for one host module.
Functions
The resolved field/3 arguments for a blob column under this
configuration: [name, :binary] for the default, or
[name, module, opts] for a custom :blob_type (opts is [] for
a bare custom module, since field/3 treats an empty-opts
parameterized call and a plain Ecto.Type call identically).
Validates and resolves the options use StatifierPersistence.Ecto
accepts. Raises ArgumentError on anything malformed.
@spec table(t(), StatifierPersistence.Ecto.KeyGenerator.table()) :: String.t()
The table name (source) for table under this configuration: the
per-table override when one was given, otherwise the table prefix plus
the table's own name.