Class: ElasticGraph::GraphQL::Aggregation::QueryAdapter::WithoutSchema
- Inherits:
-
Object
- Object
- ElasticGraph::GraphQL::Aggregation::QueryAdapter::WithoutSchema
- Defined in:
- lib/elastic_graph/graphql/aggregation/query_adapter.rb
Overview
Partially applied ‘QueryAdapter` – essentially the `QueryAdapter` without the schema, so that it can be instantiated before the `Schema` instance exists, instead providing it from `context` at query time.
Instance Method Summary collapse
- #call(query:, lookahead:, args:, field:, context:) ⇒ Object
-
#initialize(config:, filter_args_translator:, runtime_metadata:, sub_aggregation_grouping_adapter:) ⇒ WithoutSchema
constructor
A new instance of WithoutSchema.
Constructor Details
#initialize(config:, filter_args_translator:, runtime_metadata:, sub_aggregation_grouping_adapter:) ⇒ WithoutSchema
Returns a new instance of WithoutSchema.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/elastic_graph/graphql/aggregation/query_adapter.rb', line 31 def initialize(config:, filter_args_translator:, runtime_metadata:, sub_aggregation_grouping_adapter:) @build_adapter = ->(schema) do QueryAdapter.new( schema: schema, config: config, filter_args_translator: filter_args_translator, runtime_metadata: , sub_aggregation_grouping_adapter: sub_aggregation_grouping_adapter ) end end |
Instance Method Details
#call(query:, lookahead:, args:, field:, context:) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elastic_graph/graphql/aggregation/query_adapter.rb', line 43 def call(query:, lookahead:, args:, field:, context:) return query unless field.type.unwrap_fully.indexed_aggregation? @build_adapter.call(context.fetch(:elastic_graph_schema)).call( query: query, lookahead: lookahead, args: args, field: field, context: context ) end |