Skip to content

Commit

Permalink
Change table_iden to table_name
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Apr 14, 2024
1 parent dc27eb0 commit e4391f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sea-query-attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct GenEnumArgs {
#[darling(default)]
pub crate_name: Option<String>,
#[darling(default)]
pub table_iden: Option<String>,
pub table_name: Option<String>,
}

const DEFAULT_PREFIX: &str = "";
Expand All @@ -33,7 +33,7 @@ impl Default for GenEnumArgs {
prefix: Some(DEFAULT_PREFIX.to_string()),
suffix: Some(DEFAULT_SUFFIX.to_string()),
crate_name: Some(DEFAULT_CRATE_NAME.to_string()),
table_iden: None,
table_name: None,
}
}
}
Expand Down Expand Up @@ -69,7 +69,7 @@ pub fn enum_def(args: TokenStream, input: TokenStream) -> TokenStream {
.collect();

let table_name = Ident::new(
args.table_iden
args.table_name
.unwrap_or_else(|| input.ident.to_string().to_snake_case())
.as_str(),
input.ident.span(),
Expand Down
2 changes: 1 addition & 1 deletion sea-query-attr/tests/pass/table_iden.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sea_query::Iden;
use sea_query_attr::enum_def;

#[enum_def(table_iden = "HelloTable")]
#[enum_def(table_name = "HelloTable")]
pub struct Hello {
pub name: String,
}
Expand Down

0 comments on commit e4391f7

Please sign in to comment.