Class: ElasticGraph::Apollo::GraphQL::ApolloEntityRefResolver::ForPaginatedList

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/apollo/graphql/apollo_entity_ref_resolver.rb

Overview

GraphQL resolver for paginated fields defined with ‘apollo_entity_ref_paginated_collection_field`.

Instance Method Summary collapse

Constructor Details

#initialize(elasticgraph_graphql:, config:) ⇒ ForPaginatedList

Returns a new instance of ForPaginatedList.



54
55
56
# File 'lib/elastic_graph/apollo/graphql/apollo_entity_ref_resolver.rb', line 54

def initialize(elasticgraph_graphql:, config:)
  @for_id_list = ForIdList.new(elasticgraph_graphql:, config:)
end

Instance Method Details

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



58
59
60
61
# File 'lib/elastic_graph/apollo/graphql/apollo_entity_ref_resolver.rb', line 58

def resolve(field:, object:, args:, context:)
  array = @for_id_list.resolve(field:, object:, args:, context:)
  ::ElasticGraph::GraphQL::Resolvers::RelayConnection::ArrayAdapter.build(array, args, context)
end