AshReplicant.Resource (AshReplicant v0.3.0)

Copy Markdown View Source

Spark resource extension marking a host AshPostgres resource as a CDC mirror target for ash_replicant.

Add it to a host mirror resource:

use Ash.Resource,
  domain: MyApp.Domain,
  data_layer: AshPostgres.DataLayer,
  extensions: [AshReplicant.Resource]

replicant do
  source_table "orders"
  tenant_attribute :org_id
  sensitive [:pan]
end

source_table / source_schema default to the resource's own AshPostgres.DataLayer.Info.table/1 / schema/1 via AshReplicant.Resource.Info.source_table/1 and source_schema/1. Every option is optional. Compile-time verifiers enforce that sensitive columns map to encrypted/binary targets (ValidateSensitive); that a declared tenant source is a plaintext discriminator backed by an Ash multitenancy block, and that the block's own :attribute is plaintext (ValidateMultitenancy); that a non-global multitenant resource declares a tenant source — tenant_attribute or tenant_mfa (ValidateTenantSource); that no sink-selected action bypasses tenancy (ValidateActionMultitenancy); and that an SCD2 resource's version-table shape is valid (ValidateHistory).

Summary

Functions

replicant(body)

(macro)