gitlab-org--gitlab-foss/lib/gitlab/graphql/pagination/externally_paginated_array_...

30 lines
612 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# Make a customized connection type
module Gitlab
module Graphql
module Pagination
class ExternallyPaginatedArrayConnection < GraphQL::Pagination::ArrayConnection
def start_cursor
items.previous_cursor
end
def end_cursor
items.next_cursor
end
def next_page?
end_cursor.present?
end
def previous_page?
start_cursor.present?
end
alias_method :has_next_page, :next_page?
alias_method :has_previous_page, :previous_page?
end
end
end
end