Skip to content

Conversation

@mnpw
Copy link

@mnpw mnpw commented Aug 8, 2022

db::Type -> Enum defining which all database variants are supported
db::Insertor -> Trait specifying insert related methods that will be required by any new db we wish to plug
db::Database -> Enum to hold database objects corresponding to db::Type

Support for a NewDb would look like following

    pub enum Type {
        ...
+       NewDb,
    }
    
    pub enum Database {
        ...
+       NewDb,
    }
    
    impl Database {
        pub fn new(db_type: &Type, options: ClientOptions, table: &str) -> Database {
            match db_type {
                ...
+               Type::NewDb => Self::NewDb(NewDb::new(options, table)),
            }
        }
    }
    
+   struct NewDb {
+       ...
+   }
+   
+   impl NewDb {
+       pub fn new(...) -> NewDb {
+           ...
+       }
+   }
+   
+   impl Inserter for NewDb {
+       ...
+   }

mnpw added 3 commits August 8, 2022 01:24
- Add `db::Type` enum: holds supported database variants
- Add `db::Databse` enum: holds database connection
- Add `db::Inserter` trait: defines behavior of database inserter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants