Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/graphql/pagination/keyset/last_items.rb')
-rw-r--r--lib/gitlab/graphql/pagination/keyset/last_items.rb25
1 files changed, 0 insertions, 25 deletions
diff --git a/lib/gitlab/graphql/pagination/keyset/last_items.rb b/lib/gitlab/graphql/pagination/keyset/last_items.rb
deleted file mode 100644
index 960567a6fbc..00000000000
--- a/lib/gitlab/graphql/pagination/keyset/last_items.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Graphql
- module Pagination
- module Keyset
- # This class handles the last(N) ActiveRecord call even if a special ORDER BY configuration is present.
- # For the last(N) call, ActiveRecord calls reverse_order, however for some cases it raises
- # ActiveRecord::IrreversibleOrderError error.
- class LastItems
- # rubocop: disable CodeReuse/ActiveRecord
- def self.take_items(scope, count)
- if Gitlab::Pagination::Keyset::Order.keyset_aware?(scope)
- order = Gitlab::Pagination::Keyset::Order.extract_keyset_order_object(scope)
- items = scope.reorder(order.reversed_order).first(count)
- items.is_a?(Array) ? items.reverse : items
- else
- scope.last(count)
- end
- end
- end
- end
- end
- end
-end