stillbox/sql/postgres/queries/talkgroups.sql

17 lines
500 B
MySQL
Raw Normal View History

2024-07-17 19:30:16 -04:00
-- name: GetTalkgroupsWithAnyTags :many
2024-07-17 19:45:46 -04:00
SELECT system_id, talkgroup_id FROM talkgroups_tags
2024-07-17 19:30:16 -04:00
WHERE tags @> ARRAY[$1];
-- name: GetTalkgroupsWithAllTags :many
2024-07-17 19:45:46 -04:00
SELECT system_id, talkgroup_id FROM talkgroups_tags
2024-07-17 19:30:16 -04:00
WHERE tags && ARRAY[$1];
-- name: GetTalkgroupTags :one
SELECT tags FROM talkgroups_tags
WHERE talkgroup_id = $1;
-- name: SetTalkgroupTags :exec
2024-07-17 19:49:50 -04:00
INSERT INTO talkgroups_tags(system_id, talkgroup_id, tags) VALUES($1, $2, $3)
ON CONFLICT (system_id, talkgroup_id) DO UPDATE SET tags = $3;
2024-07-17 19:30:16 -04:00