Skip to main content

get_db_pool

Macro get_db_pool 

Source
macro_rules! get_db_pool {
    () => { ... };
}
Expand description

Macro to retrieve a reference to the global database pool.

This macro wraps the call to $crate::db::get_db_pool(), which returns a reference to the initialized pool. It panics if the pool has not been initialized yet (i.e., if init_db_pool!() has not been called).

ยงExample

use zirv_db_sqlx::get_db_pool;
 
fn perform_db_operations() {
   let pool = get_db_pool!();
  // Use `pool` for database operations...
}