Skip to content

Commit

Permalink
fix: use - instead of _ to separate identifiers to avoid mixups
Browse files Browse the repository at this point in the history
  • Loading branch information
jreppnow committed Mar 30, 2024
1 parent 7983c47 commit a7bfac9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sea-orm-macros/src/derives/from_query_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> ToTokens for TryFromQueryResultCheck<'a> {
ItemType::Nested => {
let name = ident.unraw().to_string();
tokens.extend(quote! {
let #ident = match sea_orm::FromQueryResult::from_query_result_nullable(row, &format!("{pre}{}_", #name)) {
let #ident = match sea_orm::FromQueryResult::from_query_result_nullable(row, &format!("{pre}{}-", #name)) {
Err(v @ sea_orm::TryGetError::DbErr(_)) => {
return Err(v);
}
Expand Down
5 changes: 2 additions & 3 deletions sea-orm-macros/src/derives/partial_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ impl DerivePartialModel {
quote!(let #select_ident =
if let Some(prefix) = pre {
let ident = format!("{prefix}{}", #ident_stringified);
eprintln!("{ident}");
sea_orm::SelectColumns::select_column_as(#select_ident, #col_value, ident)
} else {
sea_orm::SelectColumns::select_column_as(#select_ident, #col_value, #ident_stringified)
Expand Down Expand Up @@ -200,9 +199,9 @@ impl DerivePartialModel {
quote!(let #select_ident =
<#typ as sea_orm::PartialModelTrait>::select_cols_nested(#select_ident,
Some(&if let Some(prefix) = pre {
format!("{prefix}{}_", #field_name) }
format!("{prefix}{}-", #field_name) }
else {
format!("{}_", #field_name)
format!("{}-", #field_name)
}
));
)
Expand Down

0 comments on commit a7bfac9

Please sign in to comment.