Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: rename_all container attribute #934

Closed
allan2 opened this issue Aug 12, 2022 · 3 comments
Closed

Feature request: rename_all container attribute #934

allan2 opened this issue Aug 12, 2022 · 3 comments

Comments

@allan2
Copy link
Contributor

allan2 commented Aug 12, 2022

A Postgres type like so

CREATE TYPE mood AS ENUM ('sad', 'happy');

can be represented like this

#[derive(ToSql, Debug)]
#[postgres(name = "mood")]
enum Mood {
    #[postgres(name = "sad")]
    Sad,
    #[postgres(name = "happy")]
    Happy
}

This is a request for a container attribute like Serde's rename_all [1]

#[derive(ToSql, Debug)]
#[postgres(rename_all = "lowercase")]
enum Mood {
    Sad,
    Happy
}

What do you think?

--
#894 related

@sfackler
Copy link
Owner

Seems like a reasonable feature to me!

@jakubadamw
Copy link
Contributor

@allan2 @sfackler I made an attempt at an initial implementation in #952. Feedback would be welcome!

@allan2
Copy link
Contributor Author

allan2 commented Sep 12, 2023

Closing because merged in #1008 and released in postgres-types 0.2.6. Thanks @JaydenElliott @sfackler!

@allan2 allan2 closed this as completed Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants