Modules§
- sqlx
- Compatibility shim that exposes a
sqlx-shaped API by re-exporting fromsqlx-core+sqlx-postgresdirectly.
Structs§
- Create
Default - Create
Record - Delete
Record - Field
Ref - Filter
- Find
Many - Find
Unique - Migration
- A single migration step. Banks store these in source control alongside
the schema; the runner applies any rows in
migrationsnot yet present incratestack_migrations.downis recorded but the runner doesn’t call it — irreversible-by-default is the safe banking posture. - Migration
State - Model
Column - Model
Delegate - Model
Descriptor - Order
Clause - Read
Policy - Relation
Filter - Scoped
Create Record - Scoped
Delete Record - Scoped
Find Many - Scoped
Find Unique - Scoped
Model Delegate - Scoped
Update Record - Scoped
Update Record Set - Scoped
Upsert Record - SqlColumn
Value - Sqlx
Idempotency Store - Sqlx
Runtime - Update
Record - Update
Record Set - Upsert
Record
Enums§
- Create
Default Type - Filter
Expr - Migration
Status - Policy
Expr - Policy
Literal - Read
Predicate - Relation
Quantifier - Sort
Direction - SqlValue
Constants§
- AUDIT_
TABLE_ DDL - DDL for the audit log table. Banks typically run migrations through their
own tooling — this DDL is exposed so the
crate::SqlxRuntimecan idempotently ensure the table exists during bootstrap. - MIGRATIONS_
TABLE_ DDL
Traits§
- Create
Model Input - Into
SqlValue - Update
Model Input - Upsert
Model Input - Input shape for the upsert primitive —
INSERT … ON CONFLICT (<pk>) DO UPDATE ….sql_values()must include the primary-key column (so the backend can target the conflict), andprimary_key_value()exposes the PK separately so the runtime can issue aSELECT … FOR UPDATEbefore the upsert to driveCreatedvs.Updatedevent / audit semantics.
Functions§
- apply_
pending - Apply every pending migration in the input slice, in order. Each migration runs inside its own transaction; checksum drift aborts the whole apply (banks treat drift as a release-process failure to be resolved by humans, not silently overwritten).
- create_
record_ with_ executor - ensure_
migrations_ table - expiry_
from - Compute when a record originally captured at
created_atwill expire. Pulled out for unit-test reach; the SystemTime arithmetic is otherwise awkward to assert against without a clock injection point. - primary_
key_ from_ snapshot - Extract the primary-key field from a serialized model snapshot. Used to stamp audit events with a stable identifier even when the schema doesn’t surface the PK column verbatim in the response (e.g. policy-stripped).
- run_
in_ isolated_ tx - Begin a transaction at the requested isolation level, run
bodyagainst the live transaction, and commit. On40001(serialization_failure) or40P01(deadlock_detected) the transaction is rolled back and the body runs again, up toMAX_RETRIES_DEFAULTtimes. Other errors propagate immediately. - run_
in_ isolated_ tx_ with_ retries - Same as
run_in_isolated_txbut with a caller-chosen retry budget. Banks running long-tail contended writes sometimes want a higher cap (5–10); single-row CAS workflows can drop to 1 to fail fast. - snapshot_
model - Convert a model into the JSON snapshot used by the audit log. Returns
Noneif the model isn’t serializable; that should never happen for generated models which deriveSerialize, but we degrade gracefully rather than panic. - status
- Inspect each migration in
migrationsagainstcratestack_migrationsand report which are pending / applied / drifted. Use beforeapplyto surface drift to the operator without changing state. - update_
record_ with_ executor