Class: GraphQL::Pagination::MongoidRelationConnection
- Inherits:
-
RelationConnection
- Object
- Connection
- RelationConnection
- GraphQL::Pagination::MongoidRelationConnection
- 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
-
#null_relation(relation) ⇒ Object
-
#relation_count(relation) ⇒ Object
-
#relation_limit(relation) ⇒ Object
-
#relation_offset(relation) ⇒ Object
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
Constructor Details
This class inherits a constructor from GraphQL::Pagination::Connection
Instance Method Details
#null_relation(relation) ⇒ Object
20 21 22 |
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 20 def null_relation(relation) relation..none end |
#relation_count(relation) ⇒ Object
15 16 17 18 |
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 15 def relation_count(relation) # Mongo's `.count` doesn't apply limit or skip, which we need. So we have to load _everything_! relation.to_a.count end |
#relation_limit(relation) ⇒ Object
11 12 13 |
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 11 def relation_limit(relation) relation..limit end |
#relation_offset(relation) ⇒ Object
7 8 9 |
# File 'lib/graphql/pagination/mongoid_relation_connection.rb', line 7 def relation_offset(relation) relation..skip end |