sfackler / rust-postgres

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

feat(derive): add `#[postgres(allow_mismatch)]` #1026

Closed viniciusth closed 1 year ago

viniciusth commented 1 year ago

As discussed on #1023, this PR implements an override/attribute that allows mismatching Rust and Postgres enums.

Example

#[derive(ToSql, FromSql)]
#[postgres(allow_mismatch)]
enum Mood {
    Sad,
    Happy,
    Meh,
}
viniciusth commented 1 year ago

Hey @sfackler could you please review this PR?