cornucopia-rs / cornucopia

Generate type-checked Rust from your PostgreSQL.
Other
835 stars 38 forks source link

✨ Replace generated inner attrs with outer attrs. #144

Closed LouisGariepy closed 2 years ago

LouisGariepy commented 2 years ago

This is mostly a temporary measure until https://github.com/rust-lang/rfcs/issues/752 gets resolved. The gist is that files containing inner attributes don't work with include_str which some of users need as part of their workflow.

The fix applied here is simple: instead of applying to inner attributes to the whole file, we apply outer attributes to the two top-level generated modules: queries and types. This introduces 4 duplicated lines, so not really a big deal :smile:.

Closes #138.