Implement new budget with transaction to be able to satisfy not null columns
This commit is contained in:
@ -102,3 +102,19 @@ func (q *Queries) GetFirstActivity(ctx context.Context, budgetID uuid.UUID) (tim
|
||||
err := row.Scan(&min_date)
|
||||
return min_date, err
|
||||
}
|
||||
|
||||
const setInflowCategory = `-- name: SetInflowCategory :exec
|
||||
UPDATE budgets
|
||||
SET income_category_id = $1
|
||||
WHERE budgets.id = $2
|
||||
`
|
||||
|
||||
type SetInflowCategoryParams struct {
|
||||
IncomeCategoryID uuid.UUID
|
||||
ID uuid.UUID
|
||||
}
|
||||
|
||||
func (q *Queries) SetInflowCategory(ctx context.Context, arg SetInflowCategoryParams) error {
|
||||
_, err := q.db.ExecContext(ctx, setInflowCategory, arg.IncomeCategoryID, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user