sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.49k stars 443 forks source link

Add a container-level `rename_all` attribute to `FromSql`/`ToSql` #952

Open jakubadamw opened 2 years ago

jakubadamw commented 2 years ago

It works both with composite types' fields and enum variants, although arguably it will be the most useful for the latter as that's where the naming conventions between Rust and a typical PostgreSQL schema differ.

Right now it supports the following casing styles, following serde:

Addresses #934.

jakubadamw commented 2 years ago

So this adds a few dependencies to keep the implementation concise. I, personally, subscribe to the “use as much of the crates.io ecosystem as you can possibly can” philosophy, but I can see how it may not be appropriate for the project. Still, that's what I did in the first version to gather feedback. Which dependency should be got rid of can perhaps be decided later.

allan2 commented 2 years ago

Since this is a library, I think it would be better to avoid introducing external dependencies to keep compile times down.

@sfackler thoughts?

The case conversion code in serde_derive might be helpful.

JaydenElliott commented 1 year ago

@jakubadamw are you still working on this, would love this feature

jakubadamw commented 1 year ago

@JaydenElliott hey, not really, no. I'll be happy for someone else to take over this. 🙂