From ce99469b3d4541a140b715c378594147962d2198 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 4 Oct 2021 14:05:40 +0000 Subject: [PATCH] streamline code --- src/main.rs | 2 +- src/sqlite/mod.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4233a2d..f0fa7f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ async fn main() -> Result<(), Box> { sqlite::load_template(&sqlite_connection).await?; sqlite::add_test_user(&sqlite_connection).await?; - println!("{}" ,sqlite::sqlite_out(&sqlite_connection, "SELECT * FROM users;", 1).await?); + println!("{}" ,sqlite_out(&sqlite_connection, "SELECT * FROM users;", 1).await?); net::web(sqlite_connection).await; diff --git a/src/sqlite/mod.rs b/src/sqlite/mod.rs index b336b53..2fe5076 100644 --- a/src/sqlite/mod.rs +++ b/src/sqlite/mod.rs @@ -30,11 +30,10 @@ pub async fn load_template(sqlite_handle: &SqlitePool) -> sqlx::Result sqlx::Result{ +pub async fn add_test_user(sqlite_handle: &SqlitePool)-> sqlx::Result{ sqlx::query("insert into users values('1923123','Elierik','erikeli',1,2,3);").execute(sqlite_handle).await } pub async fn sqlite_out(sqlite_handle: &SqlitePool, query:&str, index:usize) -> Result { sqlx::query(query).fetch_one(sqlite_handle).await.unwrap().try_get(index) -} - +} \ No newline at end of file