Replies: 1 comment 1 reply
-
The following works for me. var numericDiscountPercentage pgtype.Numeric if err := numericDiscountPercentage.Scan(strconv.FormatFloat(customerObj.DiscountPercentage, 'f', 2, 64)); err != nil { Is this the best approach? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I migrated to v 5.0 recently. Earlier I used like this:
numericDiscountPercentage := new(pgtype.Numeric)
numericDiscountPercentage.Set(updateCustomerObj.DiscountPercentage)
sqlc.UpdateCustomersParams{
SetDiscountPercentage: !(updateCustomerObj.DiscountPercentage == 0),
DiscountPercentage: *numericDiscountPercentage
}
Please help.
I Murugesan
Beta Was this translation helpful? Give feedback.
All reactions