docbox_database/
lib.rs

1#![forbid(unsafe_code)]
2
3// Pool re-exports
4pub use pool::{
5    DatabasePoolCache, DatabasePoolCacheConfig, DatabasePoolCacheConfigError, DbConnectErr,
6    DbSecrets,
7};
8
9/// SQLx re-exports for other projects
10pub use sqlx::{
11    self, PgExecutor as DbExecutor, PgPool, Postgres, Transaction,
12    postgres::{PgConnectOptions, PgPoolOptions},
13};
14
15pub mod create;
16pub mod migrations;
17pub mod models;
18pub mod pool;
19pub mod utils;
20
21/// Type of the database connection pool
22pub type DbPool = PgPool;
23
24/// Short type alias for a database error
25pub type DbErr = sqlx::Error;
26
27/// Type alias for a result where the error is a [DbErr]
28pub type DbResult<T> = Result<T, DbErr>;
29
30/// Type of a database transaction
31pub type DbTransaction<'c> = Transaction<'c, Postgres>;
32
33/// Name of the root database
34pub const ROOT_DATABASE_NAME: &str = "docbox";