Proc macro parsing with darling and test
Still Working need feedback
PR Info
Fixes Problem discussed at https://github.com/SeaQL/sea-orm/issues/394#issuecomment-1396947927.
Related PR
https://github.com/SeaQL/sea-orm/pull/1560
Tasks
- [x] Replace manually parsing with
darling - [x] Write test for parser
File Changed
-
sea-orm-macros/Cargo.tomladdeddarlingdependency -
sea-orm-macros/src/derives/model.rsmodified parser and added test
Thanks for the feedback.
I will look after replacing DeriveModel with DeriveModelDarling. This will lead to changes in impl_from_query_result impl_model_trait as they both depend on struct DeriveModel.
Wow, interesting. I have never used darling. Seems like it can make the code much cleaner!
Yep, wanna get rid of the parsing mess ASAP loll
Hey @Diwakar-Gupta, I think you leave a comment here yesterday night but it's now gone. Anything I could help?
@billy1624 The comment was a report of changes done; Then I did some more changes and it became irrelevant. Here is the latest summary.
All this are also commented in code.
-
Previously
DeriveModelhad processed data, removing it has introduced some extra processing inimpl_from_query_resultandimpl_model_traitfunctions. But it is manageable at least in my opinion. -
struct is only supported this is ensured by
darlingnow, and default darling error message is shown to user for now. cant give custom error message unlessdarlingmakes some necessary module public.
Thanks @billy1624 I will study the reference you have given.
hey @billy1624 i have used your pr https://github.com/SeaQL/sea-orm/pull/1560 and fixed the merge conflict.