Skip to main content

architect_sdk/db/
pool.rs

1//! Feature-gated type aliases for the active database pool and connection.
2//!
3//! Only one dialect feature may be active at a time (enforced by build.rs).
4//! Code that imports `db::pool::Pool` compiles to the concrete sqlx type with zero overhead.
5
6#[cfg(feature = "postgres")]
7pub use sqlx::postgres::PgRow as DbRow;
8#[cfg(feature = "postgres")]
9pub use sqlx::PgConnection as Connection;
10#[cfg(feature = "postgres")]
11pub use sqlx::PgPool as Pool;
12#[cfg(feature = "postgres")]
13pub type DbConnection = sqlx::pool::PoolConnection<sqlx::Postgres>;
14
15#[cfg(feature = "mysql")]
16pub use sqlx::mysql::MySqlRow as DbRow;
17#[cfg(feature = "mysql")]
18pub use sqlx::MySqlConnection as Connection;
19#[cfg(feature = "mysql")]
20pub use sqlx::MySqlPool as Pool;
21#[cfg(feature = "mysql")]
22pub type DbConnection = sqlx::pool::PoolConnection<sqlx::MySql>;
23
24#[cfg(feature = "sqlite")]
25pub use sqlx::sqlite::SqliteRow as DbRow;
26#[cfg(feature = "sqlite")]
27pub use sqlx::SqliteConnection as Connection;
28#[cfg(feature = "sqlite")]
29pub use sqlx::SqlitePool as Pool;
30#[cfg(feature = "sqlite")]
31pub type DbConnection = sqlx::pool::PoolConnection<sqlx::Sqlite>;