Remove unused code and tests

This commit is contained in:
Erik Foris 2021-10-18 14:11:17 +02:00
parent 54461e7934
commit 684dde255a
2 changed files with 6 additions and 17 deletions

View File

@ -3,8 +3,7 @@ use std::{
boxed::Box,
error::Error,
};
use crate::{cli::Options, config::Config, sqlite::sqlite_out};
use crate::{cli::Options, config::Config};
mod cli;
mod config;
@ -39,13 +38,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
#[cfg(feature = "sqlite")]
sqlite::load_template(&sqlite_connection).await?;
sqlite::add_test_user(&sqlite_connection).await?;
println!("{}" ,sqlite_out(&sqlite_connection, "SELECT * FROM users;", 1).await?);
net::web(sqlite_connection).await;
Ok(())
Ok(())
}

View File

@ -6,7 +6,7 @@ use sqlx::{
SqliteQueryResult,
SqliteSynchronous,
},
Row,
//Row,
};
/// Prepare sqlite database connection
@ -30,10 +30,6 @@ pub async fn load_template(sqlite_handle: &SqlitePool) -> sqlx::Result<SqliteQue
)).execute(sqlite_handle).await
}
pub async fn add_test_user(sqlite_handle: &SqlitePool)-> sqlx::Result<SqliteQueryResult>{
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<String, sqlx::Error> {
sqlx::query(query).fetch_one(sqlite_handle).await.unwrap().try_get(index)
}
//pub async fn sqlite_out(sqlite_handle: &SqlitePool, query:&str, index:usize) -> Result<String, sqlx::Error> {
// sqlx::query(query).fetch_one(sqlite_handle).await.unwrap().try_get(index)
//}