Skip to content

Commit 83f29c7

Browse files
committed
fix: fix query and add comments
1 parent 9a5a74b commit 83f29c7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

coderd/database/queries.sql.go

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

coderd/database/queries/users.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,23 @@ WHERE
7676
)
7777
ELSE true
7878
END
79+
-- Start filters
80+
-- Filter by name, email or username
7981
AND CASE
8082
WHEN @search :: text != '' THEN (
8183
email LIKE concat('%', @search, '%')
8284
OR username LIKE concat('%', @search, '%')
8385
)
8486
ELSE true
87+
END
88+
-- Filter by status
8589
AND CASE
8690
WHEN @status :: user_status != '' THEN (
8791
status = @status
8892
)
8993
ELSE true
9094
END
95+
-- End of filters
9196
ORDER BY
9297
-- Deterministic and consistent ordering of all users, even if they share
9398
-- a timestamp. This is to ensure consistent pagination.

0 commit comments

Comments
 (0)