diff --git a/src/sqlite/mod.rs b/src/sqlite/mod.rs index 597f62d..8a66c5e 100644 --- a/src/sqlite/mod.rs +++ b/src/sqlite/mod.rs @@ -1,12 +1,10 @@ +use uuid::Uuid; use std::path::PathBuf; -use sqlx::{ - sqlite::{ - SqlitePool, - SqliteConnectOptions, - SqliteQueryResult, - SqliteSynchronous, - }, - //Row, +use sqlx::sqlite::{ + SqlitePool, + SqliteConnectOptions, + SqliteQueryResult, + SqliteSynchronous, }; /// Prepare sqlite database connection @@ -30,6 +28,10 @@ pub async fn load_template(sqlite_handle: &SqlitePool) -> sqlx::Result Result { -// sqlx::query(query).fetch_one(sqlite_handle).await.unwrap().try_get(index) -//} \ No newline at end of file +/// Create message table from template +pub async fn create_chat(sqlite_handle: &SqlitePool, uuid: &Uuid) -> sqlx::Result { + sqlx::query(format!( + include_str!("msgdata_template.sql"), + chat_id = uuid.to_simple(), + ).as_str()).execute(sqlite_handle).await +} \ No newline at end of file