streamline code
This commit is contained in:
parent
55557b604b
commit
ce99469b3d
@ -40,7 +40,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
sqlite::load_template(&sqlite_connection).await?;
|
sqlite::load_template(&sqlite_connection).await?;
|
||||||
|
|
||||||
sqlite::add_test_user(&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;
|
net::web(sqlite_connection).await;
|
||||||
|
@ -30,11 +30,10 @@ pub async fn load_template(sqlite_handle: &SqlitePool) -> sqlx::Result<SqliteQue
|
|||||||
)).execute(sqlite_handle).await
|
)).execute(sqlite_handle).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn add_test_user(sqlite_handle: & SqlitePool)-> sqlx::Result<SqliteQueryResult>{
|
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
|
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> {
|
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)
|
sqlx::query(query).fetch_one(sqlite_handle).await.unwrap().try_get(index)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user