1use crate::types::Pool;
2use std::sync::OnceLock;
3
4pub static DB_POOL: OnceLock<Pool> = OnceLock::new();
5
6#[inline(always)]
7#[tracing::instrument(skip(pool), level = "trace")]
8pub fn initialize_db_pool(pool: Pool) {
9 DB_POOL.set(pool).expect("Failed to set DB_POOL")
10}
11
12#[inline(always)]
13#[tracing::instrument(level = "trace")]
14pub fn get_db_pool() -> &'static Pool {
15 DB_POOL.get().expect("DB_POOL is not initialized, please call `initialize_db_pool` before using it, preferably as early as possible in your program!")
16}