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.
-
#supergraph ⇒ Object
readonly
Returns the value of attribute supergraph.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
-
#initialize(supergraph:, plan:, variables: {}, nonblocking: false) ⇒ Executor
constructor
A new instance of Executor.
- #perform(document = nil) ⇒ Object
Constructor Details
#initialize(supergraph:, plan:, variables: {}, nonblocking: false) ⇒ Executor
Returns a new instance of Executor.
205 206 207 208 209 210 211 212 213 |
# File 'lib/graphql/stitching/executor.rb', line 205 def initialize(supergraph:, plan:, variables: {}, nonblocking: false) @supergraph = supergraph @variables = variables @queue = plan["ops"] @data = {} @errors = [] @query_count = 0 @dataloader = GraphQL::Dataloader.new(nonblocking: nonblocking) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
202 203 204 |
# File 'lib/graphql/stitching/executor.rb', line 202 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
202 203 204 |
# File 'lib/graphql/stitching/executor.rb', line 202 def errors @errors end |
#query_count ⇒ Object
Returns the value of attribute query_count.
203 204 205 |
# File 'lib/graphql/stitching/executor.rb', line 203 def query_count @query_count end |
#supergraph ⇒ Object (readonly)
Returns the value of attribute supergraph.
202 203 204 |
# File 'lib/graphql/stitching/executor.rb', line 202 def supergraph @supergraph end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
202 203 204 |
# File 'lib/graphql/stitching/executor.rb', line 202 def variables @variables end |
Instance Method Details
#perform(document = nil) ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/graphql/stitching/executor.rb', line 215 def perform(document=nil) exec! result = {} result["data"] = @data if @data && @data.length > 0 result["errors"] = @errors if @errors.length > 0 result if document.nil? GraphQL::Stitching::Shaper.new(supergraph: @supergraph, document: document, raw: result).perform! end |