Skip to main content

Crate persistant_sqlx

Crate persistant_sqlx 

Source
Expand description

PersistAnt’s relational driver over sqlx (PostgreSQL first).

PgBackend implements persistant_relational::RelationalBackend. The concrete sqlx::PgPool is available through PgBackend::pool, so a program that wants compile-time-checked sqlx::query! keeps it (D1, C+): this crate does not hide sqlx.

Failures are classified from the server’s SQLSTATE into persistant_relational::RelError.

Structs§

Bounded
A RelationalBackend whose every call is cut off after bound.
BoundedTx
A transaction on a Bounded backend. After any call times out it is poisoned: the statement that timed out has an unknown outcome inside the transaction, so nothing more is run in it and commit refuses; dropping it rolls it back.
ConnectOptions
Settings for PgBackend::connect_with (and MysqlBackend::connect_with, feature mysql).
MigrateReport
What a successful run did.
Migration
One migration: a version, a description and the SQL text. The text is hashed; changing a migration that has been applied is an error, never a silent re-run.
PgBackend
A PostgreSQL database behind an sqlx pool.
PgTx
A PostgreSQL transaction.

Enums§

FromSqlxError
Why an sqlx Migrator cannot be run by Migrates::migrate as it stands.
MigrateError
Why a migration run stopped.
TlsPolicy
How a connection is secured. A typed setting, not a sslmode= string someone has to remember.

Traits§

Migrates
A relational backend that keeps a migration ledger.

Functions§

call_bound_from_env
Read a per-call bound, in milliseconds, from the environment variable var. None when it is unset, empty, 0 or not a number: no bound, the default. The caller decides the variable’s name.
migrations_from_sqlx
The migrations of an sqlx Migrator (sqlx::migrate!("./migrations") or Migrator::new(path)) as Migrations for Migrates::migrate, in the order sqlx would run them.
parse_bound
"1500" is 1.5 s; anything that is not a positive whole number of milliseconds is no bound.