use super::AnyDatabase;
pub struct DatabaseInitializer {
db: AnyDatabase,
}
impl DatabaseInitializer {
#[cfg(feature = "mysql")]
pub fn new(db: yang_db::mysql::Database) -> Self {
Self::from_any(AnyDatabase::mysql(db))
}
#[cfg(feature = "postgres")]
pub fn new_postgres(db: yang_db::postgres::Database) -> Self {
Self::from_any(AnyDatabase::postgres(db))
}
pub fn from_any(db: AnyDatabase) -> Self {
Self { db }
}
pub(crate) fn db(&self) -> &AnyDatabase {
&self.db
}
}