Send help, im stuck in life time hell
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use sqlx::prelude::FromRow;
|
||||
|
||||
use crate::db::CurrPool;
|
||||
use crate::db::{CurrPool, tables::TableMeta};
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[derive(Debug, Default, Clone, FromRow)]
|
||||
pub struct Training {
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
@@ -11,6 +12,11 @@ pub struct Training {
|
||||
pub modified_at: i64,
|
||||
}
|
||||
|
||||
impl TableMeta<'_> for Training {
|
||||
type PrimaryKey = i64;
|
||||
const TABLE: &'static str = "trainings";
|
||||
}
|
||||
|
||||
impl Training {
|
||||
pub async fn insert_new(&self, pool: &CurrPool) -> Result<Self> {
|
||||
let session = sqlx::query_as!(
|
||||
|
||||
Reference in New Issue
Block a user