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.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
-
#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(request, nonblocking: false) ⇒ Executor
constructor
A new instance of Executor.
- #perform(raw: false) ⇒ Object
Constructor Details
#initialize(request, nonblocking: false) ⇒ Executor
Returns a new instance of Executor.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/graphql/stitching/executor.rb', line 11 def initialize(request, nonblocking: false) @request = request @supergraph = request.supergraph @plan = request.plan @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.
8 9 10 |
# File 'lib/graphql/stitching/executor.rb', line 8 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/graphql/stitching/executor.rb', line 8 def errors @errors end |
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
8 9 10 |
# File 'lib/graphql/stitching/executor.rb', line 8 def plan @plan end |
#query_count ⇒ Object
Returns the value of attribute query_count.
9 10 11 |
# File 'lib/graphql/stitching/executor.rb', line 9 def query_count @query_count end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
8 9 10 |
# File 'lib/graphql/stitching/executor.rb', line 8 def request @request end |
#supergraph ⇒ Object (readonly)
Returns the value of attribute supergraph.
8 9 10 |
# File 'lib/graphql/stitching/executor.rb', line 8 def supergraph @supergraph end |
Instance Method Details
#perform(raw: false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/graphql/stitching/executor.rb', line 22 def perform(raw: false) exec! result = {} if @data && @data.length > 0 result["data"] = raw ? @data : GraphQL::Stitching::Shaper.new(@request).perform!(@data) end if @errors.length > 0 result["errors"] = @errors end result end |