Replies: 2 comments 2 replies
-
This has also been bothering me. Why not just generate a type alias in the entity file itself? Like this: type User = Entity; Auto-generated preludes are awkward, because the usual (unspoken?) convention is to place a single prelude on the crate level. So if your entity module lives in the same crate the rest your project is in, it kinda sticks out like a sore thumb. Worst if your project is not using the |
Beta Was this translation helpful? Give feedback.
-
Greetings! Thank you for the great ORM for Rust that you are creating (so far I only dream of contributing). Completely agree, that this cli option is useful If you agree that this will be a good improvement, then may I help somehow? |
Beta Was this translation helpful? Give feedback.
-
So essentially I'm currently running
sea-orm-cli generate entity -o api/src/entities --with-serde=both
to generate Rust structs for my tables, my problem is it generates an unnecessary fileprelude.rs
that contains the followingI don't need the file since I use for instance
users::Entity
as it better works with my VS Code settings and import automatically, while prelude aliases don't do that, so I don't use them anyway, and the unused prelude import flooded my terminal with warnings:I double checked latest version docs, GitHub discussions/issues, and there is nothing on how to skip generating such file.
I have 2 suggestions here:
#![allow(unused)]
on its top, that way these preludes are there for future use, and no warnings on not using them, in fact I believe this option should be default, but you might know better on this.At the end, I place my special thanks to you guys for such automation tool, it really saved me hours of my days.
Update
I created a PR #2322 that allows customizing the
prelude.rs
generation through CLI arguments.Beta Was this translation helpful? Give feedback.
All reactions