Skip to content

Commit 660f886

Browse files
committed
fix changeset
1 parent 06ce14b commit 660f886

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

macros/src/lib.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ pub fn derive_insertable(input: proc_macro::TokenStream) -> proc_macro::TokenStr
4747
#[derive(FromDeriveInput, Debug)]
4848
#[darling(attributes(medici))]
4949
struct ChangesetOpts {
50-
pub table_name: String,
5150
pub table_struct: String,
52-
pub primary_key: Option<String>,
5351
}
5452

5553
#[proc_macro_derive(Changeset, attributes(medici))]
@@ -66,21 +64,16 @@ pub fn derive_changeset(input: proc_macro::TokenStream) -> proc_macro::TokenStre
6664
let fields_to_stringify = fields.iter().map(|field| field.unraw());
6765
let number_of_fields = fields.len();
6866

69-
let table_name = opts.table_name;
7067
let table_struct = parse_table_struct(opts.table_struct);
7168

72-
let primary_key_column = opts.primary_key.unwrap_or("id".into());
73-
74-
let expanded = quote! {
69+
quote! {
7570
#[::async_trait::async_trait]
7671
#[automatically_derived]
7772
impl Changeset<#number_of_fields> for #name {
7873
type T = #table_struct;
7974

8075
const COLUMNS: [&'static str; #number_of_fields] =
8176
[#(stringify!(#fields_to_stringify)),*];
82-
const TABLE_NAME: &'static str = #table_name;
83-
const PRIMARY_KEY_COLUMN: &'static str = #primary_key_column;
8477

8578
fn bind(
8679
self,
@@ -113,9 +106,7 @@ pub fn derive_changeset(input: proc_macro::TokenStream) -> proc_macro::TokenStre
113106
other == self
114107
}
115108
}
116-
};
117-
118-
expanded.into()
109+
}.into()
119110
}
120111

121112
fn filtered_struct_fields<T>(

0 commit comments

Comments
 (0)