Class: GraphQL::Stitching::Executor
- Inherits:
-
Object
- Object
- GraphQL::Stitching::Executor
- Defined in:
- lib/graphql/stitching/executor.rb
Defined Under Namespace
Classes: BoundarySource, RootSource
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#query_count ⇒ Object
Returns the value of attribute query_count.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#supergraph ⇒ Object
readonly
Returns the value of attribute supergraph.
Instance Method Summary collapse
-
#initialize(supergraph:, request:, plan:, nonblocking: false) ⇒ Executor
constructor
A new instance of Executor.
- #perform(raw: false) ⇒ Object
Constructor Details
#initialize(supergraph:, request:, plan:, nonblocking: false) ⇒ Executor
Returns a new instance of Executor.
239 240 241 242 243 244 245 246 247 248 |
# File 'lib/graphql/stitching/executor.rb', line 239 def initialize(supergraph:, request:, plan:, nonblocking: false) @supergraph = supergraph @request = request @queue = plan["ops"] @data = {} @errors = [] @query_count = 0 @exec_cycles = 0 @dataloader = GraphQL::Dataloader.new(nonblocking: nonblocking) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
236 237 238 |
# File 'lib/graphql/stitching/executor.rb', line 236 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
236 237 238 |
# File 'lib/graphql/stitching/executor.rb', line 236 def errors @errors end |
#query_count ⇒ Object
Returns the value of attribute query_count.
237 238 239 |
# File 'lib/graphql/stitching/executor.rb', line 237 def query_count @query_count end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
236 237 238 |
# File 'lib/graphql/stitching/executor.rb', line 236 def request @request end |
#supergraph ⇒ Object (readonly)
Returns the value of attribute supergraph.
236 237 238 |
# File 'lib/graphql/stitching/executor.rb', line 236 def supergraph @supergraph end |
Instance Method Details
#perform(raw: false) ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/graphql/stitching/executor.rb', line 250 def perform(raw: false) exec! result = {} if @data && @data.length > 0 result["data"] = raw ? @data : GraphQL::Stitching::Shaper.new( schema: @supergraph.schema, request: @request, ).perform!(@data) end if @errors.length > 0 result["errors"] = @errors end result end |