AshReplicant.Resource.Info (AshReplicant v0.2.0)

Copy Markdown View Source

Introspection for the AshReplicant.Resource extension.

Generates the replicant_<option>/1 ({:ok, value} | :error) and replicant_<option>!/1 accessors for every option, plus the reflection-fallback helpers source_table/1 and source_schema/1.

Summary

Functions

Policy for an upstream schema change: :halt_destructive (halt on destructive DDL) or :ignore.

Policy for an upstream schema change: :halt_destructive (halt on destructive DDL) or :ignore.

Policy for an upstream TRUNCATE: :halt (fail-closed) or :mirror (bulk-destroy the mirror rows in-txn).

Policy for an upstream TRUNCATE: :halt (fail-closed) or :mirror (bulk-destroy the mirror rows in-txn).

replicant DSL options

Source columns classified as sensitive. Verifier-enforced to map to an AshCloak-encrypted / binary-storage attribute, or to be listed in skip.

Source columns classified as sensitive. Verifier-enforced to map to an AshCloak-encrypted / binary-storage attribute, or to be listed in skip.

Source columns excluded from the mirror write.

Source columns excluded from the mirror write.

Source schema name. Defaults to the resource's own AshPostgres schema, else "public".

Source schema name. Defaults to the resource's own AshPostgres schema, else "public".

Source table name. Defaults to the resource's own AshPostgres table via reflection.

Source table name. Defaults to the resource's own AshPostgres table via reflection.

Source column carrying the tenant. Resolved per row and passed as tenant: to the mirror action. The source table must be REPLICA IDENTITY FULL so a delete's / PK-changing update's old_record carries the tenant column (key-only under the default identity → fail-closed :tenant_required).

Source column carrying the tenant. Resolved per row and passed as tenant: to the mirror action. The source table must be REPLICA IDENTITY FULL so a delete's / PK-changing update's old_record carries the tenant column (key-only under the default identity → fail-closed :tenant_required).

{m, f, a} where a is a list of extra args, applied as apply(m, f, [record | a]) yielding the tenant for a row.

{m, f, a} where a is a list of extra args, applied as apply(m, f, [record | a]) yielding the tenant for a row.

Identity name used for the upsert-by-PK mirror write.

Identity name used for the upsert-by-PK mirror write.

The source schema for the resource: the explicit source_schema, else the resource's own AshPostgres schema via reflection, else "public".

The source table for the resource: the explicit source_table, else the resource's own AshPostgres table via reflection.

Functions

replicant_on_schema_change(dsl_or_extended)

@spec replicant_on_schema_change(dsl_or_extended :: module() | map()) ::
  {:ok, :ignore | :halt_destructive} | :error

Policy for an upstream schema change: :halt_destructive (halt on destructive DDL) or :ignore.

replicant_on_schema_change!(dsl_or_extended)

@spec replicant_on_schema_change!(dsl_or_extended :: module() | map()) ::
  (:ignore | :halt_destructive) | no_return()

Policy for an upstream schema change: :halt_destructive (halt on destructive DDL) or :ignore.

replicant_on_truncate(dsl_or_extended)

@spec replicant_on_truncate(dsl_or_extended :: module() | map()) ::
  {:ok, :mirror | :halt} | :error

Policy for an upstream TRUNCATE: :halt (fail-closed) or :mirror (bulk-destroy the mirror rows in-txn).

replicant_on_truncate!(dsl_or_extended)

@spec replicant_on_truncate!(dsl_or_extended :: module() | map()) ::
  (:mirror | :halt) | no_return()

Policy for an upstream TRUNCATE: :halt (fail-closed) or :mirror (bulk-destroy the mirror rows in-txn).

replicant_options(dsl_or_extended)

@spec replicant_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

replicant DSL options

Returns a map containing the and any configured or default values.

replicant_sensitive(dsl_or_extended)

@spec replicant_sensitive(dsl_or_extended :: module() | map()) ::
  {:ok, [atom()]} | :error

Source columns classified as sensitive. Verifier-enforced to map to an AshCloak-encrypted / binary-storage attribute, or to be listed in skip.

replicant_sensitive!(dsl_or_extended)

@spec replicant_sensitive!(dsl_or_extended :: module() | map()) ::
  [atom()] | no_return()

Source columns classified as sensitive. Verifier-enforced to map to an AshCloak-encrypted / binary-storage attribute, or to be listed in skip.

replicant_skip(dsl_or_extended)

@spec replicant_skip(dsl_or_extended :: module() | map()) :: {:ok, [atom()]} | :error

Source columns excluded from the mirror write.

replicant_skip!(dsl_or_extended)

@spec replicant_skip!(dsl_or_extended :: module() | map()) :: [atom()] | no_return()

Source columns excluded from the mirror write.

replicant_source_schema(dsl_or_extended)

@spec replicant_source_schema(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Source schema name. Defaults to the resource's own AshPostgres schema, else "public".

replicant_source_schema!(dsl_or_extended)

@spec replicant_source_schema!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Source schema name. Defaults to the resource's own AshPostgres schema, else "public".

replicant_source_table(dsl_or_extended)

@spec replicant_source_table(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Source table name. Defaults to the resource's own AshPostgres table via reflection.

replicant_source_table!(dsl_or_extended)

@spec replicant_source_table!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Source table name. Defaults to the resource's own AshPostgres table via reflection.

replicant_tenant_attribute(dsl_or_extended)

@spec replicant_tenant_attribute(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error

Source column carrying the tenant. Resolved per row and passed as tenant: to the mirror action. The source table must be REPLICA IDENTITY FULL so a delete's / PK-changing update's old_record carries the tenant column (key-only under the default identity → fail-closed :tenant_required).

replicant_tenant_attribute!(dsl_or_extended)

@spec replicant_tenant_attribute!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()

Source column carrying the tenant. Resolved per row and passed as tenant: to the mirror action. The source table must be REPLICA IDENTITY FULL so a delete's / PK-changing update's old_record carries the tenant column (key-only under the default identity → fail-closed :tenant_required).

replicant_tenant_mfa(dsl_or_extended)

@spec replicant_tenant_mfa(dsl_or_extended :: module() | map()) ::
  {:ok, {atom(), atom(), [any()]}} | :error

{m, f, a} where a is a list of extra args, applied as apply(m, f, [record | a]) yielding the tenant for a row.

replicant_tenant_mfa!(dsl_or_extended)

@spec replicant_tenant_mfa!(dsl_or_extended :: module() | map()) ::
  {atom(), atom(), [any()]} | no_return()

{m, f, a} where a is a list of extra args, applied as apply(m, f, [record | a]) yielding the tenant for a row.

replicant_upsert_identity(dsl_or_extended)

@spec replicant_upsert_identity(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error

Identity name used for the upsert-by-PK mirror write.

replicant_upsert_identity!(dsl_or_extended)

@spec replicant_upsert_identity!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()

Identity name used for the upsert-by-PK mirror write.

source_schema(resource)

@spec source_schema(module() | map()) :: String.t()

The source schema for the resource: the explicit source_schema, else the resource's own AshPostgres schema via reflection, else "public".

source_table(resource)

@spec source_table(module() | map()) :: String.t() | nil

The source table for the resource: the explicit source_table, else the resource's own AshPostgres table via reflection.