blob: 51665a358a24bcc7e84ee87da852d405efd2bc6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
use sqlx::SqlitePool;
use crate::error::AppError;
use async_trait::async_trait;
pub mod game;
pub mod product;
pub mod producttag;
pub mod story;
pub mod tag;
pub mod tool;
#[async_trait]
pub trait ProductDatabaseHandler {
async fn get_all(pool: &SqlitePool) -> Result<Vec<Self>, AppError>
where
Self: Sized;
async fn post(
&self,
pool: &SqlitePool,
name: String,
description: String,
tags: Vec<String>,
) -> Result<Self, AppError>
where
Self: Sized;
async fn delete(pool: &SqlitePool, id: i64) -> Result<(), AppError>
where
Self: Sized;
}
|