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.
212 213 214 215 216 217 218 219 220 221 |
# File 'lib/graphql/stitching/executor.rb', line 212 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.
209 210 211 |
# File 'lib/graphql/stitching/executor.rb', line 209 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
209 210 211 |
# File 'lib/graphql/stitching/executor.rb', line 209 def errors @errors end |
#query_count ⇒ Object
Returns the value of attribute query_count.
210 211 212 |
# File 'lib/graphql/stitching/executor.rb', line 210 def query_count @query_count end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
209 210 211 |
# File 'lib/graphql/stitching/executor.rb', line 209 def request @request end |
#supergraph ⇒ Object (readonly)
Returns the value of attribute supergraph.
209 210 211 |
# File 'lib/graphql/stitching/executor.rb', line 209 def supergraph @supergraph end |
Instance Method Details
#perform(raw: false) ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/graphql/stitching/executor.rb', line 223 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 |