Replies: 2 comments 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 |
|
I'm also working with Sea-ORM and ran into this issue. For now I'm just using manual However, before realizing this was happening, I noticed some random content in the Model.ts when generating the contents, as which definition ends up there was a bit random, due to the race condition. I don't think it's desirable to have conflicting definitions overwriting the same file, so I've implemented this main...jtwaleson:ts-rs:no-overwrites A bit sloppy but it is working for me. Would it be a good idea to block this? Then I can polish my implementation and open a PR. |
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::TSderives 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_rsis generating typescript files, I end up with a singleModel.tsfile, 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::Modelwould beUsersModel.tswith the typescript type ofUsersModel.I have spent a bunch of time seeking an answer and feel lost at this point.
Thanks
All reactions