SeaQL / sea-query

🔱 A dynamic SQL query builder for MySQL, Postgres and SQLite
https://www.sea-ql.org
Other
1.16k stars 192 forks source link

[BUG] Enum_def macro errror #793

Open RichardWGNR opened 3 months ago

RichardWGNR commented 3 months ago

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 commented 3 months ago

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 commented 4 weeks ago

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