diff --git a/persmgr_derive/src/lib.rs b/persmgr_derive/src/lib.rs index d46b726..985c51f 100644 --- a/persmgr_derive/src/lib.rs +++ b/persmgr_derive/src/lib.rs @@ -86,10 +86,7 @@ pub fn derive_table_meta(input: TokenStream) -> TokenStream { impl TableMeta for #ident { type PrimaryKey = #key_t; const TABLE: &'static str = #table_name; - } - - impl #ident { - pub async fn update(&mut self, pool: &crate::db::CurrPool) -> anyhow::Result { + async fn update(&mut self, pool: &crate::db::CurrPool) -> anyhow::Result { #modified_at let session = sqlx::query_as!( #ident, diff --git a/src/db/tables/mod.rs b/src/db/tables/mod.rs index b049f84..939ded9 100644 --- a/src/db/tables/mod.rs +++ b/src/db/tables/mod.rs @@ -16,6 +16,7 @@ pub mod user; pub trait TableMeta: for<'r> sqlx::FromRow<'r, PgRow> { type PrimaryKey: Type + Clone; const TABLE: &'static str; + async fn update(&mut self, pool: &crate::db::CurrPool) -> anyhow::Result; } #[derive(Debug, Clone, Default)]