The repo, the schemas, and the migrations table that Mediate.Postgres
needs beyond the configuration.
- the mediated repo, whose connection carries the session settings
- the schemas whose tables the policies protect and read
- the name of the table that holds the migration numbers
bind/1 validates them and keeps them for the life of the VM, as
Mediate.Config.boot!/1 keeps the configuration. override/1 puts a
binding in the current process for the rest of its life. resolve/0
reads it from the current process, then from each process in its
$callers chain, and the nearest wins. So a test binds its own repo and
leaves the boot binding alone.
The schemas serve three lookups:
- an object type to the table and primary key its answers run against
- a table back to the schema whose declarations cover it
- the set of tables whose policies are the adapter's business
Summary
Types
The bound repo, the schemas whose tables its policies protect, and where the version comes from.
Functions
Validate once at boot and keep the binding for resolve/0.
bind/1, but it raises the error.
Validate the options into the struct.
The schema of the binding's options.
Override the binding's fields for the rest of the current process.
Override the binding's fields around a function, then put the previous override back.
The boot binding under the current process's overrides, or an error when neither exists.
The bound schema whose table is table, or nil.
The tables of the bound schemas, sorted.
The schema, table, and single primary key of an object type, or nil when no bound schema has one.
The binding as the keyword list new/1 accepts.
Types
Functions
@spec bind(keyword()) :: {:ok, t()} | {:error, Mediate.Error.t()}
Validate once at boot and keep the binding for resolve/0.
bind/1, but it raises the error.
@spec new(keyword()) :: {:ok, t()} | {:error, Mediate.Error.t()}
Validate the options into the struct.
@spec options_schema() :: NimbleOptions.t()
The schema of the binding's options.
@spec override(keyword()) :: :ok
Override the binding's fields for the rest of the current process.
Override the binding's fields around a function, then put the previous override back.
@spec resolve() :: {:ok, t()} | {:error, Mediate.Error.t()}
The boot binding under the current process's overrides, or an error when neither exists.
The bound schema whose table is table, or nil.
The tables of the bound schemas, sorted.
The schema, table, and single primary key of an object type, or nil when no bound schema has one.
The binding as the keyword list new/1 accepts.