Compare commits

..

No commits in common. "962b8feae70fe1fcd58920e237662c66706c1937" and "be72fa7bc3dc9e809d1215bda6daf2ba11931a22" have entirely different histories.

2 changed files with 5 additions and 3 deletions

View File

@ -86,7 +86,10 @@ pub fn derive_table_meta(input: TokenStream) -> TokenStream {
impl TableMeta for #ident { impl TableMeta for #ident {
type PrimaryKey = #key_t; type PrimaryKey = #key_t;
const TABLE: &'static str = #table_name; const TABLE: &'static str = #table_name;
async fn update(&mut self, pool: &crate::db::CurrPool) -> anyhow::Result<Self> { }
impl #ident {
pub async fn update(&mut self, pool: &crate::db::CurrPool) -> anyhow::Result<Self> {
#modified_at #modified_at
let session = sqlx::query_as!( let session = sqlx::query_as!(
#ident, #ident,
@ -100,7 +103,7 @@ pub fn derive_table_meta(input: TokenStream) -> TokenStream {
} }
}; };
// eprintln!("{}", output.to_string()); eprintln!("{}", output.to_string());
output.into() output.into()
} }

View File

@ -16,7 +16,6 @@ pub mod user;
pub trait TableMeta: for<'r> sqlx::FromRow<'r, PgRow> { pub trait TableMeta: for<'r> sqlx::FromRow<'r, PgRow> {
type PrimaryKey: Type<super::CurrDb> + Clone; type PrimaryKey: Type<super::CurrDb> + Clone;
const TABLE: &'static str; const TABLE: &'static str;
async fn update(&mut self, pool: &crate::db::CurrPool) -> anyhow::Result<Self>;
} }
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]