Class: GraphQL::Pagination::MongoidRelationConnection

Inherits:
RelationConnection show all
Defined in:
lib/graphql/pagination/mongoid_relation_connection.rb

Instance Attribute Summary

Attributes inherited from Connection

#after_value, #arguments, #before_value, #context, #edge_class, #field, #first, #first_value, #items, #last, #last_value, #parent

Instance Method Summary collapse

Methods inherited from RelationConnection

#cursor_for, #has_next_page, #has_previous_page, #nodes

Methods inherited from Connection

#after, #before, #cursor_for, #default_page_size, #default_page_size=, #edge_nodes, #edges, #end_cursor, #has_default_page_size_override?, #has_max_page_size_override?, #has_next_page, #has_previous_page, #initialize, #max_page_size, #max_page_size=, #nodes, #page_info, #range_add_edge, #start_cursor, #was_authorized_by_scope_items?

Constructor Details

This class inherits a constructor from GraphQL::Pagination::Connection

Instance Method Details

#null_relation(relation) ⇒ Object



19
20
21
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 19

def null_relation(relation)
  relation.without_options.none
end

#relation_count(relation) ⇒ Object



15
16
17
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 15

def relation_count(relation)
  relation.all.count(relation.options.slice(:limit, :skip))
end

#relation_limit(relation) ⇒ Object



11
12
13
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 11

def relation_limit(relation)
  relation.options.limit
end

#relation_offset(relation) ⇒ Object



7
8
9
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 7

def relation_offset(relation)
  relation.options.skip
end