diff options
author | Melody Horn / boringcactus <melody@boringcactus.com> | 2021-06-16 12:36:47 -0600 |
---|---|---|
committer | Melody Horn / boringcactus <melody@boringcactus.com> | 2021-06-16 12:36:47 -0600 |
commit | 685b47247aad71468f190c42929ca6f0dce843fa (patch) | |
tree | 7adf64a4c00b9ca8893fab26367ec01a30e24ad9 /src/cli/mod.rs | |
parent | 92bf14bb7cc0c10f67a9a67e7512138c15db6ec0 (diff) | |
download | tosin-685b47247aad71468f190c42929ca6f0dce843fa.tar.gz tosin-685b47247aad71468f190c42929ca6f0dce843fa.zip |
make database backends generic
Diffstat (limited to 'src/cli/mod.rs')
-rw-r--r-- | src/cli/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cli/mod.rs b/src/cli/mod.rs index c656c1c..a11fd48 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,23 +1,26 @@ use structopt::StructOpt; -use crate::{Settings, UrlMap}; +use crate::{Settings, UrlMap, db::backend::Connectable}; +mod migrate; mod run_server; #[derive(StructOpt)] enum Command { + Migrate(migrate::Migrate), RunServer(run_server::RunServer), } impl Command { - fn execute(self, urls: UrlMap, settings: Settings) { + fn execute(self, urls: UrlMap, settings: Settings<impl Connectable>) { match self { + Command::Migrate(command) => command.execute(urls, settings), Command::RunServer(command) => command.execute(urls, settings), } } } -pub fn main(urls: UrlMap, settings: Settings) { +pub fn main(urls: UrlMap, settings: Settings<impl Connectable>) { let command = Command::from_args(); command.execute(urls, settings); } |