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

feat: implement ToSqlText for Decimal #186

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

aalexandrov
Copy link
Contributor

The rust_decimal crate provides a Decimal type that implements the ToSQL trait required for integration with rust-postgres.

This is one of the recommended ways1 of exposing NUMERIC and DECIMAL columns in rust-postgres / tokio-postgres results.

This commit introduces rust_decimal as an optional dependency and adds a ToSqlText implementation (similar to how the chrono types are pulled in and used to provide support for DATE/TIME/DATETIME Postgres types).

Footnotes

  1. https://stackoverflow.com/a/72626605

The `rust_decimal` crate provides a `Decimal` type that implements
the `ToSQL` trait required for integration with `rust-postgres`.

This is one of the recommended ways[^1] of exposing `NUMERIC` and
`DECIMAL` columns in `rust-postgres` / `tokio-postgres` results.

This commit introduces `rust_decimal` as an optional dependency and
adds a `ToSqlText` implementation (similar to how the `chrono` types
are pulled in and used to provide support for `DATE`/`TIME`/`DATETIME`
Postgres types).

[^1]: https://stackoverflow.com/a/72626605
@sunng87 sunng87 merged commit aa798b3 into sunng87:master Jun 25, 2024
6 checks passed
@aalexandrov aalexandrov deleted the add_decimal branch June 25, 2024 11:50
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

Successfully merging this pull request may close these issues.

2 participants