For a database operation like the following I need to change the sign for a Money struct (because I need a decrement I need a negative value):
from(c in Customer,
where: c.id == ^customer.id,
update: [
inc: [
balance: ^Money.sub!(Money.zero(:EUR), order.total)
],
set: [updated_at: ^inserted_at]
]
)
Right now I am doing it like this:
Money.sub!(Money.zero(:EUR), order.total)
Is there any function do do this I might have missed?