Decoder for numeric / decimal SQL Data type #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes stablekernel/postgresql-dart#50,
closes stablekernel/postgresql-dart#108,
closes stablekernel/postgresql-dart#112,
closes stablekernel/postgresql-dart#162,
Contributes to stablekernel/postgresql-dart#164
Encoder may follows, if I've time.
At least I wanted to give a decoding option to the users who need it.
I decided to use String as exact representation of BigDecimal. An alternative would be to use decimal package , but I don't know if its a good idea, to use third party package as datatype. If wanted the users can use the package and convert the string themselves with the
Decimal.parse
method, or usedouble.parse()
, if precision is not that important.I think BigInt isn't an option, as need to save the fractional digits and therefore would again need a new wrapper class.
I also implemented a less precise
numericToDouble
method, but I think we should stick to the String representation: