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

Enum en-/decodings for sqlx should be re-done #566

Open
bitfl0wer opened this issue Oct 7, 2024 · 0 comments
Open

Enum en-/decodings for sqlx should be re-done #566

bitfl0wer opened this issue Oct 7, 2024 · 0 comments

Comments

@bitfl0wer
Copy link
Member

In #565, I discovered that my theoretically correct fix for en-/decoding enums for sqlx didn't work as intended. The fix simply added #[repr(i16)] to u8-repr'd enums when the sqlx feature was enabled. However, we store unsigned integers using the PgSQL NUMERIC type, which Pg (or sqlx) will not auto-convert from or to.

The improved fix is to provide a custom implementation of Type, Encode and Decode for the enums which are to be represented as unsigned integers. Perhaps this could be done via a macro derive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant