refactor: combine models and db crate together

This commit is contained in:
Paul Makles
2023-04-22 12:12:02 +01:00
parent f2bb388b3b
commit e43833c0ea
27 changed files with 306 additions and 147 deletions

View File

@@ -0,0 +1,22 @@
mod admin_migrations;
mod bots;
pub use admin_migrations::*;
pub use bots::*;
use crate::{Database, MongoDb, ReferenceDb};
pub trait AbstractDatabase: Sync + Send + admin_migrations::AbstractMigrations {}
impl AbstractDatabase for ReferenceDb {}
impl AbstractDatabase for MongoDb {}
impl std::ops::Deref for Database {
type Target = dyn AbstractDatabase;
fn deref(&self) -> &Self::Target {
match &self {
Database::Reference(dummy) => dummy,
Database::MongoDb(mongo) => mongo,
}
}
}