Class: ElasticGraph::GraphQL::QueryAdapter::Pagination
- Inherits:
-
Data
- Object
- Data
- ElasticGraph::GraphQL::QueryAdapter::Pagination
- Defined in:
- lib/elastic_graph/graphql/query_adapter/pagination.rb
Overview
Note: This class is not tested directly but indirectly through specs on ‘QueryAdapter`
Instance Attribute Summary collapse
-
#schema_element_names ⇒ Object
readonly
Returns the value of attribute schema_element_names.
Instance Method Summary collapse
Instance Attribute Details
#schema_element_names ⇒ Object (readonly)
Returns the value of attribute schema_element_names
13 14 15 |
# File 'lib/elastic_graph/graphql/query_adapter/pagination.rb', line 13 def schema_element_names @schema_element_names end |
Instance Method Details
#call(query:, args:, lookahead:, field:, context:) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/elastic_graph/graphql/query_adapter/pagination.rb', line 15 def call(query:, args:, lookahead:, field:, context:) return query unless field.type.unwrap_fully.indexed_document? document_pagination = [:first, :before, :last, :after].to_h do |key| [key, args[schema_element_names.public_send(key)]] end query.merge_with(document_pagination: document_pagination) end |