bazzar/crates/account_manager/src/db/mod.rs

29 lines
654 B
Rust
Raw Normal View History

2022-11-04 18:40:14 +01:00
pub mod accounts;
pub mod addresses;
pub use accounts::*;
pub use addresses::*;
use config::SharedAppConfig;
#[derive(Clone)]
pub struct Database {
pub pool: sqlx::PgPool,
_config: SharedAppConfig,
}
impl Database {
pub async fn build(config: SharedAppConfig) -> Self {
let url = config.lock().account_manager().database_url.clone();
let pool = sqlx::PgPool::connect(&url).await.unwrap_or_else(|e| {
tracing::error!("Failed to connect to database. {e:?}");
std::process::exit(1);
});
Self {
pool,
_config: config,
}
}
pub fn pool(&self) {}
}