DEV Community

Discussion on: An async & dynamic ORM for Rust!

Collapse
 
blfpd profile image
Baptiste Darthenay

Hi! I’m wondering why the column name start with a capital letter (Column::Name), when it was define lowercase (name):

Cake::find().filter(cake::Column::Name.contains("chocolate"))
Enter fullscreen mode Exit fullscreen mode
Collapse
 
billy1624 profile image
Billy Chan

Good questions! Column is a Enum in Rust and its Enum variants (e.g. Column::Name) are conventionally defined in pascal case. Hence, Column::Name.

Thread Thread
 
blfpd profile image
Baptiste Darthenay

Thanks, makes sense! Where this is done? In SeaORM or SQLx, and I guess it’s done in a macro?

Thread Thread
 
billy1624 profile image
Billy Chan

It's done by SeaORM via prodedual macros. See the entity structure docs for details.