Use date_trunc instead of splitting date into year and month
This commit is contained in:
@ -54,7 +54,7 @@ func (q *Queries) DeleteAllAssignments(ctx context.Context, budgetID uuid.UUID)
|
||||
}
|
||||
|
||||
const getAssignmentsByMonthAndCategory = `-- name: GetAssignmentsByMonthAndCategory :many
|
||||
SELECT year, month, category_id, budget_id, amount
|
||||
SELECT date, category_id, budget_id, amount
|
||||
FROM assignments_by_month
|
||||
WHERE assignments_by_month.budget_id = $1
|
||||
`
|
||||
@ -69,8 +69,7 @@ func (q *Queries) GetAssignmentsByMonthAndCategory(ctx context.Context, budgetID
|
||||
for rows.Next() {
|
||||
var i AssignmentsByMonth
|
||||
if err := rows.Scan(
|
||||
&i.Year,
|
||||
&i.Month,
|
||||
&i.Date,
|
||||
&i.CategoryID,
|
||||
&i.BudgetID,
|
||||
&i.Amount,
|
||||
|
Reference in New Issue
Block a user