Module: GraphQL::Execution::Batching

Defined in:
lib/graphql/execution/batching.rb,
lib/graphql/execution/batching/runner.rb,
lib/graphql/execution/batching/selections_step.rb,
lib/graphql/execution/batching/field_resolve_step.rb,
lib/graphql/execution/batching/field_compatibility.rb,
lib/graphql/execution/batching/prepare_object_step.rb

Defined Under Namespace

Modules: FieldCompatibility, SchemaExtension Classes: FieldResolveStep, PrepareObjectStep, RawValueFieldResolveStep, Runner, SelectionsStep

Class Method Summary collapse

Class Method Details

.run_all(schema, query_options, context: {}, max_complexity: schema.max_complexity) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/graphql/execution/batching.rb', line 45

def self.run_all(schema, query_options, context: {}, max_complexity: schema.max_complexity)
  queries = query_options.map do |opts|
    case opts
    when Hash
      schema.query_class.new(schema, nil, **opts)
    when GraphQL::Query, GraphQL::Query::Partial
      opts
    else
      raise "Expected Hash or GraphQL::Query, not #{opts.class} (#{opts.inspect})"
    end
  end
  multiplex = Execution::Multiplex.new(schema: schema, queries: queries, context: context, max_complexity: max_complexity)
  runner = Runner.new(multiplex)
  runner.execute
end

.use(schema) ⇒ Object



41
42
43
# File 'lib/graphql/execution/batching.rb', line 41

def self.use(schema)
  schema.extend(SchemaExtension)
end