aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/graph/root_.generated.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/graphql/graph/root_.generated.go')
-rw-r--r--api/graphql/graph/root_.generated.go58
1 files changed, 48 insertions, 10 deletions
diff --git a/api/graphql/graph/root_.generated.go b/api/graphql/graph/root_.generated.go
index a1434228..85e447b3 100644
--- a/api/graphql/graph/root_.generated.go
+++ b/api/graphql/graph/root_.generated.go
@@ -6,6 +6,7 @@ import (
"bytes"
"context"
"errors"
+ "sync/atomic"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/introspection"
@@ -381,7 +382,7 @@ func (e *executableSchema) Schema() *ast.Schema {
}
func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
- ec := executionContext{nil, e}
+ ec := executionContext{nil, e, 0, 0, nil}
_ = ec
switch typeName + "." + field {
@@ -1779,7 +1780,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
rc := graphql.GetOperationContext(ctx)
- ec := executionContext{rc, e}
+ ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)}
inputUnmarshalMap := graphql.BuildUnmarshalerMap(
ec.unmarshalInputAddCommentAndCloseBugInput,
ec.unmarshalInputAddCommentAndReopenBugInput,
@@ -1796,18 +1797,33 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
switch rc.Operation.Operation {
case ast.Query:
return func(ctx context.Context) *graphql.Response {
- if !first {
- return nil
+ var response graphql.Response
+ var data graphql.Marshaler
+ if first {
+ first = false
+ ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
+ data = ec._Query(ctx, rc.Operation.SelectionSet)
+ } else {
+ if atomic.LoadInt32(&ec.pendingDeferred) > 0 {
+ result := <-ec.deferredResults
+ atomic.AddInt32(&ec.pendingDeferred, -1)
+ data = result.Result
+ response.Path = result.Path
+ response.Label = result.Label
+ response.Errors = result.Errors
+ } else {
+ return nil
+ }
}
- first = false
- ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
- data := ec._Query(ctx, rc.Operation.SelectionSet)
var buf bytes.Buffer
data.MarshalGQL(&buf)
-
- return &graphql.Response{
- Data: buf.Bytes(),
+ response.Data = buf.Bytes()
+ if atomic.LoadInt32(&ec.deferred) > 0 {
+ hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0
+ response.HasNext = &hasNext
}
+
+ return &response
}
case ast.Mutation:
return func(ctx context.Context) *graphql.Response {
@@ -1833,6 +1849,28 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
type executionContext struct {
*graphql.OperationContext
*executableSchema
+ deferred int32
+ pendingDeferred int32
+ deferredResults chan graphql.DeferredResult
+}
+
+func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) {
+ atomic.AddInt32(&ec.pendingDeferred, 1)
+ go func() {
+ ctx := graphql.WithFreshResponseContext(dg.Context)
+ dg.FieldSet.Dispatch(ctx)
+ ds := graphql.DeferredResult{
+ Path: dg.Path,
+ Label: dg.Label,
+ Result: dg.FieldSet,
+ Errors: graphql.GetErrors(ctx),
+ }
+ // null fields should bubble up
+ if dg.FieldSet.Invalids > 0 {
+ ds.Result = graphql.Null
+ }
+ ec.deferredResults <- ds
+ }()
}
func (ec *executionContext) introspectSchema() (*introspection.Schema, error) {