Introduce own Numeric type and revert to stdlib from pgx

This commit is contained in:
jacob1123 committed 2021-12-02 21:32:01 +00:00
1 parent 6f8a94ff5d
commit 4646356b2d
16 files changed
+136 -57

No files matched your search

+7 -1
View File
@@ -5,7 +5,13 @@ VALUES ($1, $2)
RETURNING *;
-- name: GetAccounts :many
SELECT accounts.id, accounts.name, SUM(transactions.amount) as balance FROM accounts
SELECT accounts.* FROM accounts
WHERE accounts.budget_id = $1;
-- name: GetAccountsWithBalance :many
SELECT accounts.id, accounts.name, SUM(transactions.amount)::decimal(12,2) as balance
FROM accounts
LEFT JOIN transactions ON transactions.account_id = accounts.id
WHERE accounts.budget_id = $1
AND transactions.date < NOW()
GROUP BY accounts.id, accounts.name;