Replies: 1 comment 1 reply
-
Hey! I've never used sea-orm, so I'm not actually sure.
Maybe the sea-orm CLI can be configured to emit a
Not at the moment. From briefly looking at their CLI, I was surprised to see a few mentions of ts-rs, but no way of including the table name inside custom attributes. The only thing I've found is this very creative script on discord. I do feel like having the ability to interpolate the table name in sea-orm is a feature they should consider adding - maybe something like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there!
I am dipping my toes into sea-orm. It can automatically generate structs for database entities, and can take command line arguments to attach
ts_rs::TS
derives to those models.However, there is a problem, these structs must be called
Model
, as there is a whole spider-web of interconnections for sea-orm's derives to work.Unfortunately this means that when
ts_rs
is generating typescript files, I end up with a singleModel.ts
file, which happens to be whichever entity was last generated.Is there an option, a flag, a feature, that will allow say, the module name of the model to be included within the type name of the exported type? For instance
crate::entities::users::Model
would beUsersModel.ts
with the typescript type ofUsersModel
.I have spent a bunch of time seeking an answer and feel lost at this point.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions