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: mindersec#3720
  • Loading branch information
jhrozek committed Jun 27, 2024
1 parent 2ddd501 commit aa40ff6
Show file tree
Hide file tree
Showing 6 changed files with 519 additions and 0 deletions.
74 changes: 74 additions & 0 deletions database/mock/store.go

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

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.

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

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

139 changes: 139 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 aa40ff6

Please sign in to comment.