-
Notifications
You must be signed in to change notification settings - Fork 111
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 to float64 conversion doesn't work #27
Comments
could be fixed with following code
|
As far as it not working, do you have an example? There is a passing test for assigning to float: Line 255 in ab5e597
|
Hi Jack, Sorry for being vague, it's an accuracy issue, so if I have 10.06 in my database:
output: Also the AssignTo method returning an error isn't as easy to use as when the dev just wants a float representation of the Big.Int, the same way I can get a .String or .Int from varchar/int4 types. |
Should be fixed now. As far as convenience goes Beyond that, pgtype.Numeric provides just enough functionality to transcode numeric values. https://github.com/shopspring/decimal provides a real decimal type in Go. pgtype.Numeric doesn't use it to avoid forcing an external dependency on everyone. But if you are using numerics you can use https://github.com/jackc/pgtype/tree/master/ext/shopspring-numeric to integrate with a real decimal type. |
The built in method AssignTo() for converting a postgresql numeric such as Numeric(5,2) to float64 does not work.
The text was updated successfully, but these errors were encountered: