-
|
Is there a recommended way to handle Decimal values? Error: |
Beta Was this translation helpful? Give feedback.
Answered by
mbrandonw
Nov 9, 2025
Replies: 1 comment 4 replies
-
|
My current approach is as follows, but wondering if there is a better way: |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Jerland2, modeling currency as an integer is a common way to do things, and provides a completely lossless representation in the database (as long as you don't need fractional cents). You should even be able to bundle both the
subunitandcurrencyinto a single@Selectiontype that can be reused in many places:That allows you to treat
Transaction.amountas a single unit, while secretly it is powered by two columns in the table. This means you can select, filter, order and even join on it: