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

Numeric type to use Decimal #302

Open
wolframm opened this issue Feb 19, 2024 · 1 comment
Open

Numeric type to use Decimal #302

wolframm opened this issue Feb 19, 2024 · 1 comment

Comments

@wolframm
Copy link
Contributor

wolframm commented Feb 19, 2024

IMO when one uses the expensive numeric type in Postgres one would do so because one would want it to behave like a Decimal as opposed to int,double or String. It would seem obvious to use the Dart type Decimal (i.e. GenericType<Decimal> from the decimal lib because it closely resembles the intent of numeric.

The encoding/decoding logic wouldn't change much, since Decimal can parse a String. But even if one added new Type.decimal and kept the current Type.numeric instead of changing it, this looks like a breaking change since PostgresBinaryDecoder wouldn't be able to tell the difference (as far as I can tell). Unless, one adds an optional useDecimalForNumeric flag in ConnectionSettings, but that seems messy.

What are your thoughts?

@wolframm
Copy link
Contributor Author

wolframm commented Feb 19, 2024

I am asking this also in light of implementing numrange, which would either end up being a range of String (which makes no sense, I think) or be a range of Decimal, which would make more sense, but use an element type that is different than Type.numeric's.

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

1 participant