Module: Gitlab::Pagination::Keyset

Defined in:
lib/gitlab/pagination/keyset.rb,
lib/gitlab/pagination/keyset/page.rb,
lib/gitlab/pagination/keyset/order.rb,
lib/gitlab/pagination/keyset/pager.rb,
lib/gitlab/pagination/keyset/iterator.rb,
lib/gitlab/pagination/keyset/paginator.rb,
lib/gitlab/pagination/keyset/cursor_pager.rb,
lib/gitlab/pagination/keyset/header_builder.rb,
lib/gitlab/pagination/keyset/request_context.rb,
lib/gitlab/pagination/keyset/simple_order_builder.rb,
lib/gitlab/pagination/keyset/sql_type_missing_error.rb,
lib/gitlab/pagination/keyset/column_order_definition.rb,
lib/gitlab/pagination/keyset/unsupported_scope_order.rb,
lib/gitlab/pagination/keyset/column_condition_builder.rb,
lib/gitlab/pagination/keyset/cursor_based_request_context.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/column_data.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/query_builder.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/order_by_columns.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/array_scope_columns.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/order_by_column_data.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy.rb,
lib/gitlab/pagination/keyset/in_operator_optimization/strategies/order_values_loader_strategy.rb

Defined Under Namespace

Modules: InOperatorOptimization Classes: ColumnConditionBuilder, ColumnOrderDefinition, CursorBasedRequestContext, CursorPager, HeaderBuilder, Iterator, Order, Page, Pager, Paginator, RequestContext, SimpleOrderBuilder, SqlTypeMissingError, UnsupportedScopeOrder

Constant Summary collapse

SUPPORTED_TYPES =
[
  Project
].freeze

Class Method Summary collapse

Class Method Details

.available?(request_context, relation) ⇒ Boolean

Returns:

  • (Boolean)

14
15
16
17
18
19
20
21
# File 'lib/gitlab/pagination/keyset.rb', line 14

def self.available?(request_context, relation)
  order_by = request_context.page.order_by

  return false unless available_for_type?(relation)
  return false unless order_by.size == 1 && order_by[:id]

  true
end

.available_for_type?(relation) ⇒ Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/gitlab/pagination/keyset.rb', line 10

def self.available_for_type?(relation)
  SUPPORTED_TYPES.include?(relation.klass)
end