Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different case-trasform systems used results in different naming #262

Closed
nappa85 opened this issue Oct 20, 2021 · 4 comments · Fixed by #264
Closed

Different case-trasform systems used results in different naming #262

nappa85 opened this issue Oct 20, 2021 · 4 comments · Fixed by #264
Assignees

Comments

@nappa85
Copy link
Contributor

nappa85 commented Oct 20, 2021

If you name a field in a Model with a number but not followed by an underscore, e.g. md5sum, some macro will trasform it into Md5sum and some other Md5Sum, haven't had time to look deeply into it but probably the difference is in my DeriveEntityModel macro that uses convert_case crate, while other macros uses other systems.

This obviously causes an error like

no variant or associated item named `Md5hash` found for enum `Column` in the current scope
variant or associated item `Md5hash` not found here rustc(E0599)
there is a variant with a similar name: `Md5Hash`
@tyt2y3
Copy link
Member

tyt2y3 commented Oct 20, 2021

let mut field_name = Ident::new(
&trim_starting_raw_identifier(&ident).to_case(Case::Pascal),
Span::call_site(),
);

So other macros use heck

@billy1624
Copy link
Member

All old macros use heck to transform between case. While new macros use convert_case.

@billy1624
Copy link
Member

Seems that only entity_model uses convert_case.

@tyt2y3
Copy link
Member

tyt2y3 commented Oct 23, 2021

0.3.1

arpancodes pushed a commit to arpancodes/sea-orm that referenced this issue Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants