aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/graph/root_.generated.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2023-08-12 14:05:02 +0200
committerGitHub <noreply@github.com>2023-08-12 14:05:02 +0200
commit20e62977a0509e2c79ef5d8d9173103a278b78ff (patch)
tree9a39ab11d0373caeaf34f2d06188c481d27f67d7 /api/graphql/graph/root_.generated.go
parenta0d225ce23af9f5dbe31521f19485c66d409e573 (diff)
parent429b913dc5519babfab47bf65222e32415a6c1bd (diff)
downloadgit-bug-20e62977a0509e2c79ef5d8d9173103a278b78ff.tar.gz
Merge pull request #1088 from MichaelMure/dependabot/go_modules/github.com/99designs/gqlgen-0.17.36
build(deps): bump github.com/99designs/gqlgen from 0.17.20 to 0.17.36
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) {