feat(macros): permit passing custom derives to Model or ModelEx#2933
feat(macros): permit passing custom derives to Model or ModelEx#2933Huliiiiii merged 3 commits intoSeaQL:masterfrom
Conversation
|
Thank you, I think the design is nice |
…ttrs(..))] syntax
tyt2y3
left a comment
There was a problem hiding this comment.
thank you. can you add a test case under tests, like https://github.com/SeaQL/sea-orm/blob/master/tests/derive_iden_tests.rs ?
we can call it derive_model_tests. we don't have to use the actual ts-rs crate, may be some built-in derive macros like Hash can work too?
Thanks for the suggestion! I have added the test case in tests/derive_model_tests.rs as requested. Regarding the derive macros, I chose to use Practical Validation: It effectively demonstrates that model_attrs and model_ex_attrs can correctly pass nested attributes to the generated structs, which is a primary use case for this feature. No New Dependencies: Since serde and serde_json are already used in existing tests , this doesn't introduce any new external dependencies to the workspace. |
🎉 Released In 2.0.0-rc.32 🎉Huge thanks for the contribution! |
PR Info
New Features
ModelorModelEx.Motivation
This change allows for granular control over the attributes on both
ModelandModelEx. For instance, it enables users to customize the generated TypeScript interface names when usingts-rswithModelEx.Usage
The code above expands to:
ts-rs does not yet supportHasOneandHasManyrelations for SeaORM 2.0. We are currently waiting for the official release of SeaORM 2.0.