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

[BUG] Enum_def macro errror #793

Open
RichardWGNR opened this issue Jul 13, 2024 · 2 comments
Open

[BUG] Enum_def macro errror #793

RichardWGNR opened this issue Jul 13, 2024 · 2 comments

Comments

@RichardWGNR
Copy link

RichardWGNR commented Jul 13, 2024

Description

Hi,

Do I understand correctly that the enum_def macro casts the r#type structure field to a similar column name?

Unfortunately, I haven't found a way in the source code to achieve renaming the Iden value to a custom value when using the enum_def macro.

So I'm going to tell you all that it's a bug.

p.s. the error in the second screenshot says that the r#type column is not found in the referrals_rewards table.

Expected Behavior

Raw field: r#type
Iden column name: Type
Query column name (iden str value): type

Actual Behavior

Raw field: r#type
Iden field name: RType
Query column name (iden str value): r#type

Reproduces How Often

always, when escaping Rust reserved words via r#.

Versions

last

Alternative text
Alternative text

@RichardWGNR RichardWGNR changed the title Enum_def macro errror [BUG] Enum_def macro errror Jul 13, 2024
RichardWGNR added a commit to RichardWGNR/sea-query that referenced this issue Jul 13, 2024
RichardWGNR added a commit to RichardWGNR/sea-query that referenced this issue Jul 13, 2024
@RichardWGNR
Copy link
Author

RichardWGNR commented Jul 13, 2024

Oh, there's also the exact same problem with the Iden trait
But it's not very critical there, because the variant can be renamed via attribute.

@doveq
Copy link

doveq commented Sep 18, 2024

hi, how can I use the attribute to rename r#type in the enum_def macro?

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.

2 participants