Catalytic icon indicating copy to clipboard operation
Catalytic copied to clipboard

Macro-based code generation instead of using `build.rs`

Open HigherOrderLogic opened this issue 2 years ago • 1 comments

Hi,

First, thanks for your amazing crate. Although I really enjoy it, there's some notable difficulities while using it, mostly with the build.rs codegen.

My proposal for this problem is creating a macros that take similar data like the build.rs (query, transformer,...) and user would just need to derive that one trait. This idea is somewhat similar to sea-orm's DeriveEntityModel.

HigherOrderLogic avatar Dec 02 '23 12:12 HigherOrderLogic

Thanks for the idea. Which problems do you currently encounter with the build.rs way? The benefit of generating the whole datamodel based on your database is that it is always in sync. Seeing the build.rs of the example crate, I don't believe it is very difficult to implement (if you use the default Transformer, you can generate the whole datamodel in 1 line, just specify your output dir), if you got any trouble doing so please let me know!

Jasperav avatar Dec 02 '23 12:12 Jasperav