Class: ElasticGraph::GraphQL::Resolvers::IndexedTypeRootFieldsResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/graphql/resolvers/indexed_type_root_fields_resolver.rb

Overview

Responsible for resolving the list and aggregation root fields generated for each indexed type.

Instance Method Summary collapse

Constructor Details

#initialize(elasticgraph_graphql:, config:) ⇒ IndexedTypeRootFieldsResolver

Returns a new instance of IndexedTypeRootFieldsResolver.



17
18
19
# File 'lib/elastic_graph/graphql/resolvers/indexed_type_root_fields_resolver.rb', line 17

def initialize(elasticgraph_graphql:, config:)
  # Nothing to initialize, but needs to be defined to satisfy the resolver interface.
end

Instance Method Details

#resolve(field:, object:, args:, context:, lookahead:) ⇒ Object



21
22
23
24
25
# File 'lib/elastic_graph/graphql/resolvers/indexed_type_root_fields_resolver.rb', line 21

def resolve(field:, object:, args:, context:, lookahead:)
  query = yield
  response = QuerySource.execute_one(query, for_context: context)
  RelayConnection.maybe_wrap(response, field: field, context: context, lookahead: lookahead, query: query)
end