Skip to content

Commit 2542dcd

Browse files
committed
add comment
1 parent 8b1bc7f commit 2542dcd

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

coderd/database/querier.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 14 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/organizationmembers.sql

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
-- name: OrganizationMembers :many
2+
-- Arguments are optional with uuid.Nil to ignore.
3+
-- - Use just 'organization_id' to get all members of an org
4+
-- - Use just 'user_id' to get all orgs a user is a member of
5+
-- - Use both to get a specific org member row
26
SELECT
37
sqlc.embed(organization_members),
48
users.username
@@ -7,18 +11,17 @@ FROM
711
INNER JOIN
812
users ON organization_members.user_id = users.id
913
WHERE
10-
true
11-
-- Filter by organization id
12-
AND CASE
13-
WHEN @organization_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
14-
organization_id = @organization_id
15-
ELSE true
14+
-- Filter by organization id
15+
CASE
16+
WHEN @organization_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
17+
organization_id = @organization_id
18+
ELSE true
1619
END
17-
-- Filter by user id
18-
AND CASE
19-
WHEN @user_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
20-
user_id = @user_id
21-
ELSE true
20+
-- Filter by user id
21+
AND CASE
22+
WHEN @user_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
23+
user_id = @user_id
24+
ELSE true
2225
END;
2326

2427
-- name: InsertOrganizationMember :one

0 commit comments

Comments
 (0)