macro_rules! init_db_pool {
() => { ... };
}Expand description
Macro to initialize the global database pool.
This macro wraps the asynchronous function from the db module:
$crate::db::init_db_pool().await. It should be called early in your application
(e.g., in your main function) to set up the database connection pool.
ยงExample
use zirv_db_sqlx::init_db_pool;
use zirv_config::register_config;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
struct DatabaseConfig {
url: String,
max_connections: u32,
}
register_config!("database", DatabaseConfig {
url: "mysql://root:password@localhost".to_owned(),
max_connections: 10,
});
init_db_pool!();