update
This commit is contained in:
parent
3299d3cc4c
commit
5f9eec00bf
13 changed files with 484 additions and 192 deletions
18
src/lib.rs
18
src/lib.rs
|
@ -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 {
|
||||
() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue