blob: 1aae1020e79030d4965a14a0b977e9c11db66889 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# frozen_string_literal: true
module Gitlab
module Graphql
module Pagination
module Keyset
module Conditions
class NullCondition < BaseCondition
def build
[first_attribute_condition, final_condition].join
end
private
# ex: "(relative_position IS NULL AND id > 500)"
def first_attribute_condition
<<~SQL
(
#{table_condition(order_list.first, nil, 'is_null').to_sql}
AND
#{table_condition(order_list[1], values[1], operators[1]).to_sql}
)
SQL
end
# ex: " OR (relative_position IS NOT NULL)"
def final_condition
if before_or_after == :before
<<~SQL
OR (#{table_condition(order_list.first, nil, 'is_not_null').to_sql})
SQL
end
end
end
end
end
end
end
end
|