cornucopia-rs / cornucopia

Generate type-checked Rust from your PostgreSQL.
Other
755 stars 31 forks source link

New codegen architecture #211

Open Virgiel opened 1 year ago

Virgiel commented 1 year ago

A new codegen architecture generating a whole crate instead of a single file #186.

Changes

Current problems

Remaining improvements

Deferred to future PR

Virgiel commented 1 year ago

@LouisGariepy Although it is not completely ready for a merge, the core logic is already there and works. This is already a huge PR in itself, so I deferred some of the work for later. I didn't add any new features or made any logical changes to the generated code.

LouisGariepy commented 1 year ago

@Virgiel Thanks for the awesome work! I'm reviewing the code as I'm writing this. Might take a bit since there's a lot to look at, but what I have seen so far is promising.

LouisGariepy commented 1 year ago

Oh I just realized this was still a draft :sweat_smile:

Virgiel commented 1 year ago

I still need to add some error handling, but the new architecture is ready for review !

Virgiel commented 7 months ago

I've been using this PR in productions for a few weeks and it works very well !

Virgiel commented 7 months ago

A final pain point is that we generate too much code and it makes the PRs hard to read, I suggest putting the examples and reference codegen in gitignore and relying on cargo px to generate them on demand. We will continue to check that the codegen works and that the examples run.