16 lines
452 B
SQL
16 lines
452 B
SQL
-- name: GetTalkgroupsWithAnyTags :many
|
|
SELECT talkgroup_id FROM talkgroups_tags
|
|
WHERE tags @> ARRAY[$1];
|
|
|
|
-- name: GetTalkgroupsWithAllTags :many
|
|
SELECT talkgroup_id FROM talkgroups_tags
|
|
WHERE tags && ARRAY[$1];
|
|
|
|
-- name: GetTalkgroupTags :one
|
|
SELECT tags FROM talkgroups_tags
|
|
WHERE talkgroup_id = $1;
|
|
|
|
-- name: SetTalkgroupTags :exec
|
|
INSERT INTO talkgroups_tags(talkgroup_id, tags) VALUES($1, $2)
|
|
ON CONFLICT (talkgroup_id) DO UPDATE SET tags = $2;
|
|
|