Module: GraphQL::Batch
- Defined in:
- lib/graphql/batch.rb,
lib/graphql/batch/loader.rb,
lib/graphql/batch/version.rb,
lib/graphql/batch/executor.rb,
lib/graphql/batch/setup_multiplex.rb,
lib/graphql/batch/mutation_field_extension.rb
Defined Under Namespace
Classes: Executor, Loader, MutationFieldExtension, NoExecutorError, SetupMultiplex
Constant Summary
collapse
- BrokenPromiseError =
::Promise::BrokenError
- VERSION =
"0.6.0"
Class Method Summary
collapse
Class Method Details
.batch(executor_class: GraphQL::Batch::Executor) ⇒ Object
.use(schema_defn, executor_class: GraphQL::Batch::Executor) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/graphql/batch.rb', line 18
def self.use(schema_defn, executor_class: GraphQL::Batch::Executor)
if schema_defn.respond_to?(:trace_with)
schema_defn.trace_with(GraphQL::Batch::SetupMultiplex::Trace, executor_class: executor_class)
else
instrumentation = GraphQL::Batch::SetupMultiplex.new(schema_defn, executor_class: executor_class)
schema_defn.instrument(:multiplex, instrumentation)
end
if schema_defn.mutation
require_relative "batch/mutation_field_extension"
schema_defn.mutation.fields.each do |name, field|
field.extension(GraphQL::Batch::MutationFieldExtension)
end
end
schema_defn.lazy_resolve(::Promise, :sync)
end
|