mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: implement filters for the organizations query (#14468)
Required for organization sync. Allows fetching a filtered set of orgs.
This commit is contained in:
@ -12,7 +12,21 @@ LIMIT
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
organizations;
|
||||
organizations
|
||||
WHERE
|
||||
true
|
||||
-- Filter by ids
|
||||
AND CASE
|
||||
WHEN array_length(@ids :: uuid[], 1) > 0 THEN
|
||||
id = ANY(@ids)
|
||||
ELSE true
|
||||
END
|
||||
AND CASE
|
||||
WHEN @name::text != '' THEN
|
||||
LOWER("name") = LOWER(@name)
|
||||
ELSE true
|
||||
END
|
||||
;
|
||||
|
||||
-- name: GetOrganizationByID :one
|
||||
SELECT
|
||||
|
Reference in New Issue
Block a user