This commit is contained in:
JMARyA 2024-12-18 14:33:53 +01:00
parent 3299d3cc4c
commit 5f9eec00bf
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
13 changed files with 484 additions and 192 deletions

View file

@ -1,14 +1,26 @@
use tokio::sync::OnceCell;
pub mod result;
pub mod request;
pub mod user;
pub mod auth;
pub mod format;
pub mod page;
pub mod request;
pub mod result;
// Postgres
pub static PG: OnceCell<sqlx::PgPool> = OnceCell::const_new();
/// A macro to retrieve or initialize the PostgreSQL connection pool.
///
/// This macro provides a convenient way to access the `PgPool`. If the pool is not already initialized,
/// it creates a new pool using the connection string from the `$DATABASE_URL` environment variable.
///
/// # Example
/// ```ignore
/// use based::get_pg;
///
/// let pool = get_pg!();
/// ```
#[macro_export]
macro_rules! get_pg {
() => {