cornucopia-rs / cornucopia

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

derive `ToSql` trait by default or via flag #149

Open xoac opened 1 year ago

xoac commented 1 year ago

The code generated by cornucopia 0.8.2 do not add ToSql trait to all generated items and as far as I see there is no way to force it. I some places I use structures generated by this library and for example I got this error:

the trait `ToSql` is not implemented for `db::cornucopia08::types::public::CollectionT
LouisGariepy commented 1 year ago

We could add this in a similar way to what's done with Serialize (i.e. a flag for the CLI and a CodegenSettings field for the API).