summaryrefslogtreecommitdiff
path: root/src/db/mod.rs
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2024-10-30 17:04:26 +0100
committerWriterV2 <primary-v2@protonmail.com>2024-10-30 17:04:26 +0100
commit61f784a5fb437489d5dd3f629618d49279ff15a5 (patch)
treed92110ca3016c6c1417085d0a8fb9d2ec894a468 /src/db/mod.rs
parent977c93ef0568aa488c226915d14e6f164519fd98 (diff)
Feat: Add db handler method to get all records from table + implement for story
Diffstat (limited to 'src/db/mod.rs')
-rw-r--r--src/db/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 01111d8..2f2aaeb 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -1,3 +1,8 @@
+use sqlx::SqlitePool;
+
+use crate::error::AppError;
+use async_trait::async_trait;
+
pub mod game;
pub mod gametag;
pub mod product;
@@ -6,3 +11,10 @@ pub mod storytag;
pub mod tag;
pub mod tool;
pub mod tooltag;
+
+#[async_trait]
+pub trait DatabaseHandler {
+ async fn get_all(pool: SqlitePool) -> Result<Vec<Self>, AppError>
+ where
+ Self: Sized;
+}