Replies: 1 comment 1 reply
-
I'd use a custom scalar type for this, plus conversion functions:
|
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
-
We've usually used an
int
field in a DB when storing a currency value, mostly because currency only need a precision of "upto two decimal places".The schema for a currency property (price) could be an
int32
in edgedbBut before we INSERT or SELECT the data, we have to either multiple by 100 or divide by 100 (in the specific currency usecase). If this could be defined as getters and setters in the schema that would be an amazing feature.
This is how Kotlin does it
Proposal
Beta Was this translation helpful? Give feedback.
All reactions