You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OnlyContributorBranches->"AND b.contributor_id IS NOT NULL"
715
-
OnlyCoreBranches->"AND b.contributor_id IS NULL"
716
-
let contributorFilter =case mayContributorQuery of
717
-
Nothing->mempty
718
-
-- Allow null contributor here for the case where we're listing 'all' branch kinds.
719
-
Just (Left contributorId) -> [PG.sql| AND (b.contributor_id IS NULL OR (b.contributor_id = #{contributorId})) |]
720
-
Just (Right (Query contributorHandlePrefix)) -> [PG.sql| AND (contributor.handle IS NULL OR starts_with(contributor.handle, #{contributorHandlePrefix})) |]
721
-
let branchNameFilter =case mayBranchNamePrefix of
722
-
Nothing->mempty
723
-
Just (Query branchNamePrefix) -> [PG.sql| AND starts_with(b.name, #{branchNamePrefix}) |]
724
-
let cursorFilter =case mayCursor of
725
-
Nothing->mempty
726
-
Just (Cursor (beforeTime, branchId) Previous) -> [PG.sql| AND (b.updated_at, b.id) < (#{beforeTime}, #{branchId})|]
727
-
Just (Cursor (afterTime, branchId) Next) -> [PG.sql| AND (b.updated_at, b.id) > (#{afterTime}, #{branchId})|]
728
-
let sql =
729
-
intercalateMap
730
-
"\n"
731
-
id
732
-
[ ( [PG.sql|
733
-
SELECT
734
-
b.id,
735
-
b.project_id,
736
-
b.name,
737
-
b.contributor_id,
738
-
b.causal_id,
739
-
b.merge_target_branch_id,
740
-
b.created_at,
741
-
b.updated_at,
742
-
b.creator_id,
743
-
contributor.handle
744
-
FROM project_branches b
745
-
LEFT JOIN users AS contributor ON contributor.id = b.contributor_id
Just (Cursor (afterTime, branchId) Previous) -> [PG.sql| AND (b.updated_at, b.id) > (#{afterTime}, #{branchId})|]
723
+
Just (Cursor (beforeTime, branchId) Next) -> [PG.sql| AND (b.updated_at, b.id) < (#{beforeTime}, #{branchId})|]
724
+
kindFilter =case kind of
725
+
AllBranchKinds->""
726
+
OnlyContributorBranches->"AND b.contributor_id IS NOT NULL"
727
+
OnlyCoreBranches->"AND b.contributor_id IS NULL"
728
+
contributorFilter =case mayContributorQuery of
729
+
Nothing->mempty
730
+
-- Allow null contributor here for the case where we're listing 'all' branch kinds.
731
+
Just (Left contributorId) -> [PG.sql| AND (b.contributor_id IS NULL OR (b.contributor_id = #{contributorId})) |]
732
+
Just (Right (Query contributorHandlePrefix)) -> [PG.sql| AND (contributor.handle IS NULL OR starts_with(contributor.handle, #{contributorHandlePrefix})) |]
733
+
branchNameFilter =case mayBranchNamePrefix of
734
+
Nothing->mempty
735
+
Just (Query branchNamePrefix) -> [PG.sql| AND starts_with(b.name, #{branchNamePrefix}) |]
0 commit comments