From 620e5593e0ef39217507a61dc1f23ef700c6dfa2 Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Mon, 18 Jul 2022 17:24:45 -0400 Subject: [PATCH] Made Database the mtt engine. --- src/main.rs | 6 +++--- src/{database/mod.rs => morethantext/graphql.rs} | 0 src/{database/database.rs => morethantext/mod.rs} | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) rename src/{database/mod.rs => morethantext/graphql.rs} (100%) rename src/{database/database.rs => morethantext/mod.rs} (97%) diff --git a/src/main.rs b/src/main.rs index 8c179d2..98c5002 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,10 +4,10 @@ use tide::{ Request, Response, }; -mod database; +mod morethantext; mod settings; -use database::MoreThanText; +use morethantext::MoreThanText; use settings::Settings; #[async_std::main] @@ -20,7 +20,7 @@ async fn main() -> tide::Result<()> { } async fn app_setup() -> tide::Server { - let db = MoreThanText::new(); + let db = MoreThanText::new().await; let mut app = tide::with_state(db); app.at("/").get(home); app.with( diff --git a/src/database/mod.rs b/src/morethantext/graphql.rs similarity index 100% rename from src/database/mod.rs rename to src/morethantext/graphql.rs diff --git a/src/database/database.rs b/src/morethantext/mod.rs similarity index 97% rename from src/database/database.rs rename to src/morethantext/mod.rs index fd01edd..159828b 100644 --- a/src/database/database.rs +++ b/src/morethantext/mod.rs @@ -94,9 +94,10 @@ impl Table { } } -pub struct Database; +#[derive(Clone)] +pub struct MoreThanText; -impl Database { +impl MoreThanText { pub async fn new() -> Self { Self {} } @@ -177,12 +178,12 @@ mod databases { #[async_std::test] async fn new_database() { - Database::new().await; + MoreThanText::new().await; } #[async_std::test] async fn add_table() { - let db = Database::new().await; + let db = MoreThanText::new().await; db.add_table("fred".to_string()).await; } }