begin implementing repository for accessing database
This commit is contained in:
@@ -27,8 +27,10 @@ async fn db_version(app_handle: tauri::AppHandle) -> Result<String, String> {
|
|||||||
.await
|
.await
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
|
||||||
sqlx::migrate!("./migrations").run(&pool).await.map_err(|e| e.to_string())?;
|
sqlx::migrate!("./migrations").run(&pool).await.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
|
||||||
let row: (String,) = sqlx::query_as("SELECT sqlite_version()")
|
let row: (String,) = sqlx::query_as("SELECT sqlite_version()")
|
||||||
.fetch_one(&pool)
|
.fetch_one(&pool)
|
||||||
.await
|
.await
|
||||||
|
|||||||
0
src-tauri/src/repositories/mod.rs
Normal file
0
src-tauri/src/repositories/mod.rs
Normal file
11
src-tauri/src/repositories/path_repository.rs
Normal file
11
src-tauri/src/repositories/path_repository.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
use sqlx::sqlite::{SqlitePool};
|
||||||
|
|
||||||
|
pub struct PathRepository<'a> {
|
||||||
|
pub pool: &'a SqlitePool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> PathRepository<'a> {
|
||||||
|
pub fn get_path_by_id(&self, id: i32) -> Result<Path>{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user