Add SQL Query for update status

This commit is contained in:
Jan Bader 2022-02-27 20:01:35 +00:00
parent eb9fc722aa
commit d7058a49b0
2 changed files with 16 additions and 0 deletions

View File

@ -17,6 +17,11 @@ SET date = $1,
category_id = $5 category_id = $5
WHERE id = $6; WHERE id = $6;
-- name: SetTransactionReconciled :exec
UPDATE transactions
SET status = 'Reconciled'
WHERE id = $1;
-- name: DeleteTransaction :exec -- name: DeleteTransaction :exec
DELETE FROM transactions DELETE FROM transactions
WHERE id = $1; WHERE id = $1;

View File

@ -289,6 +289,17 @@ func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.
return items, nil return items, nil
} }
const setTransactionReconciled = `-- name: SetTransactionReconciled :exec
UPDATE transactions
SET status = 'Reconciled'
WHERE id = $1
`
func (q *Queries) SetTransactionReconciled(ctx context.Context, id uuid.UUID) error {
_, err := q.db.ExecContext(ctx, setTransactionReconciled, id)
return err
}
const updateTransaction = `-- name: UpdateTransaction :exec const updateTransaction = `-- name: UpdateTransaction :exec
UPDATE transactions UPDATE transactions
SET date = $1, SET date = $1,