aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/graph/root_.generated.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2023-08-11 15:24:26 +0200
committerMichael Muré <batolettre@gmail.com>2023-08-11 15:42:36 +0200
commit31a9738094424a0114804521aa6581646e9b8956 (patch)
tree0dcbbdec285a04388a19af7102a99651698a7cb1 /api/graphql/graph/root_.generated.go
parentf44555f4d7d0c31a46945d02b4e9f74fbeeffe0e (diff)
downloadgit-bug-31a9738094424a0114804521aa6581646e9b8956.tar.gz
api/graphql: regenerate after gqlgen upgrade
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) {