Skip to content

Commit

Permalink
Add DB methods for selector management
Browse files Browse the repository at this point in the history
Adds the needed SQL methods to manage profile selectors

Fixes: #3720
  • Loading branch information
jhrozek committed Jun 27, 2024
1 parent 2ddd501 commit f92fc4e
Show file tree
Hide file tree
Showing 5 changed files with 464 additions and 0 deletions.
24 changes: 24 additions & 0 deletions database/query/selectors.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- name: CreateSelector :one
INSERT INTO profile_selectors (profile_id, entity, selector, comment)
VALUES ($1, $2, $3, $4)
RETURNING id, profile_id, entity, selector, comment;

-- name: GetSelectorsByProfileID :many
SELECT id, profile_id, entity, selector, comment
FROM profile_selectors
WHERE profile_id = $1;

-- name: UpdateSelector :one
UPDATE profile_selectors
SET entity = $2, selector = $3, comment = $4
WHERE id = $1
RETURNING id, profile_id, entity, selector, comment;

-- name: DeleteSelector :exec
DELETE FROM profile_selectors
WHERE id = $1;

-- name: GetSelectorByID :one
SELECT id, profile_id, entity, selector, comment
FROM profile_selectors
WHERE id = $1;
8 changes: 8 additions & 0 deletions internal/db/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions internal/db/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 155 additions & 0 deletions internal/db/selectors.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f92fc4e

Please sign in to comment.