module GraphQL::KaminariConnection
Constants
- VERSION
Attributes
base_page_data_class[W]
page_data_type_name[W]
If your schema already has 'PageData' type, you can change its name.
Public Class Methods
included(klass)
click to toggle source
# File lib/graphql/kaminari_connection.rb, line 9 def included(klass) klass.extend ClassMethods end
page_data_type()
click to toggle source
@return [Class]
# File lib/graphql/kaminari_connection.rb, line 14 def page_data_type @page_data_type ||= define_page_data_type(without_count: false) end
page_data_without_count_type()
click to toggle source
# File lib/graphql/kaminari_connection.rb, line 18 def page_data_without_count_type @page_data_without_count_type ||= define_page_data_type(without_count: true) end
Private Class Methods
base_page_data_class()
click to toggle source
@return [Class]
# File lib/graphql/kaminari_connection.rb, line 37 def base_page_data_class @base_page_data_class || GraphQL::Schema::Object end
define_page_data_type(without_count:)
click to toggle source
@param without_count [Boolean] @return [Class]
# File lib/graphql/kaminari_connection.rb, line 43 def define_page_data_type(without_count:) type_name = without_count ? "#{page_data_type_name}WithoutTotalPages" : page_data_type_name Class.new(base_page_data_class) do graphql_name type_name description 'Information about pagination' field :current_page, 'Int', null: false field :is_first_page, 'Boolean', null: false, method: :first_page? field :is_last_page, 'Boolean', null: false, method: :last_page? field :is_out_of_range, 'Boolean', null: false, method: :out_of_range? field :limit_value, 'Int', null: false field :next_page, 'Int', null: true field :prev_page, 'Int', null: true field :total_pages, 'Int', null: false unless without_count end end
page_data_type_name()
click to toggle source
The name of page data GraphQL
type.
@return [String]
# File lib/graphql/kaminari_connection.rb, line 32 def page_data_type_name @page_data_type_name || 'PageData' end