Class: GraphQL::Searchkick::ResultConnection
- Inherits:
-
Pagination::RelationConnection
- Object
- Pagination::RelationConnection
- GraphQL::Searchkick::ResultConnection
- Defined in:
- lib/graphql/searchkick/result_connection.rb
Instance Method Summary collapse
- #has_next_page ⇒ Object
- #load_nodes ⇒ Object
- #null_relation(relation) ⇒ Object
- #relation_count(relation) ⇒ Object
- #relation_limit(relation) ⇒ Object
- #relation_offset(relation) ⇒ Object
Instance Method Details
#has_next_page ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/graphql/searchkick/result_connection.rb', line 9 def has_next_page if @has_next_page.nil? @has_next_page = if @before_offset && @before_offset > 0 true elsif first initial_offset = after && offset_from_cursor(after) || 0 nodes.total_count > initial_offset + first else false end end @has_next_page end |
#load_nodes ⇒ Object
39 40 41 |
# File 'lib/graphql/searchkick/result_connection.rb', line 39 def load_nodes @nodes ||= limited_nodes end |
#null_relation(relation) ⇒ Object
35 36 37 |
# File 'lib/graphql/searchkick/result_connection.rb', line 35 def null_relation(relation) relation.limit(0) end |
#relation_count(relation) ⇒ Object
23 24 25 |
# File 'lib/graphql/searchkick/result_connection.rb', line 23 def relation_count(relation) relation.total_count end |
#relation_limit(relation) ⇒ Object
27 28 29 |
# File 'lib/graphql/searchkick/result_connection.rb', line 27 def relation_limit(relation) relation.limit_value end |
#relation_offset(relation) ⇒ Object
31 32 33 |
# File 'lib/graphql/searchkick/result_connection.rb', line 31 def relation_offset(relation) relation.offset_value end |