Skip to main content

Crate fastauth_sqlx

Crate fastauth_sqlx 

Source
Expand description

The sqlx adapter for fastauth: Postgres and SQLite, with migrations. See docs/06-database.md.

use fastauth_sqlx::{Sqlx, SqlitePool};

let pool = SqlitePool::connect("sqlite://acme.db?mode=rwc").await?;
let db = Sqlx::new(pool).table_prefix("fa_"); // Sqlx<Sqlite>

Re-exports§

pub use sqlx;

Structs§

Pool
An asynchronous pool of SQLx database connections.
Postgres
PostgreSQL database driver.
SharedTx
An app’s sqlx transaction that fastauth server API calls can join with InTx::in_tx. The rows those calls write commit or roll back with the app’s own, and their events fire after commit, never on rollback.
Sqlite
Sqlite database driver.
Sqlx
The fastauth adapter over a sqlx pool. Sqlx::new(pool) infers the database from the pool: a PgPool gives Sqlx<Postgres>, a SqlitePool gives Sqlx<Sqlite>.
SqlxTx
A transaction from Adapter::begin: a new one on a pool connection, or a savepoint when the adapter is bound to an app transaction. Dropping it without commit rolls back.

Traits§

Dialect
A database this crate supports: Postgres or Sqlite, each behind the feature of the same name. Sealed.
InTx
auth.api().in_tx(&tx): server API calls on an app’s SharedTx.

Type Aliases§

PgPool
An alias for Pool, specialized for Postgres.
SqlitePool
An alias for Pool, specialized for SQLite.