This commit is contained in:
@ -91,6 +91,24 @@ func (q *Queries) GetCategories(ctx context.Context, budgetID uuid.UUID) ([]GetC
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getCategoryGroupByName = `-- name: GetCategoryGroupByName :one
|
||||
SELECT category_groups.id, category_groups.budget_id, category_groups.name FROM category_groups
|
||||
WHERE category_groups.budget_id = $1
|
||||
AND category_groups.name = $2
|
||||
`
|
||||
|
||||
type GetCategoryGroupByNameParams struct {
|
||||
BudgetID uuid.UUID
|
||||
Name string
|
||||
}
|
||||
|
||||
func (q *Queries) GetCategoryGroupByName(ctx context.Context, arg GetCategoryGroupByNameParams) (CategoryGroup, error) {
|
||||
row := q.db.QueryRowContext(ctx, getCategoryGroupByName, arg.BudgetID, arg.Name)
|
||||
var i CategoryGroup
|
||||
err := row.Scan(&i.ID, &i.BudgetID, &i.Name)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getCategoryGroups = `-- name: GetCategoryGroups :many
|
||||
SELECT category_groups.id, category_groups.budget_id, category_groups.name FROM category_groups
|
||||
WHERE category_groups.budget_id = $1
|
||||
|
@ -8,6 +8,11 @@ RETURNING *;
|
||||
SELECT category_groups.* FROM category_groups
|
||||
WHERE category_groups.budget_id = $1;
|
||||
|
||||
-- name: GetCategoryGroupByName :one
|
||||
SELECT category_groups.* FROM category_groups
|
||||
WHERE category_groups.budget_id = $1
|
||||
AND category_groups.name = $2;
|
||||
|
||||
-- name: CreateCategory :one
|
||||
INSERT INTO categories
|
||||
(name, category_group_id)
|
||||
|
Reference in New Issue
Block a user