diff --git a/codegen/object.go b/codegen/object.go index c037344fe65..3e63c78205f 100644 --- a/codegen/object.go +++ b/codegen/object.go @@ -220,7 +220,15 @@ func (f *Field) CallArgs() string { // should be in the template, but its recursive and has a bunch of args func (f *Field) WriteJson() string { - return f.doWriteJson("res", f.Type.Modifiers, f.ASTType, false, 1) + return strings.TrimSpace( + tpl(` + func () graphql.Marshaler { + {{ .next }} + }() + `, map[string]interface{}{ + "next": f.doWriteJson("res", f.Type.Modifiers, f.ASTType, false, 1), + }), + ) } func (f *Field) doWriteJson(val string, remainingMods []string, astType *ast.Type, isPtr bool, depth int) string { @@ -235,7 +243,8 @@ func (f *Field) doWriteJson(val string, remainingMods []string, astType *ast.Typ {{- end }} return graphql.Null } - {{.next }}`, map[string]interface{}{ + {{ .next -}} + `, map[string]interface{}{ "val": val, "nonNull": astType.NonNull, "next": f.doWriteJson(val, remainingMods[1:], astType, true, depth+1), @@ -289,7 +298,8 @@ func (f *Field) doWriteJson(val string, remainingMods []string, astType *ast.Typ {{- end}} } {{ if and .top (not .isScalar) }} wg.Wait() {{ end }} - return {{.arr}}`, map[string]interface{}{ + return {{ .arr -}} + `, map[string]interface{}{ "val": val, "arr": arr, "index": index, @@ -304,7 +314,7 @@ func (f *Field) doWriteJson(val string, remainingMods []string, astType *ast.Typ if isPtr { val = "*" + val } - return f.Marshal(val) + return "return " + f.Marshal(val) default: if !isPtr { diff --git a/codegen/templates/data.go b/codegen/templates/data.go index 7a8753267b6..dff2f5afe96 100644 --- a/codegen/templates/data.go +++ b/codegen/templates/data.go @@ -2,7 +2,7 @@ package templates var data = map[string]string{ "args.gotpl": "\targs := map[string]interface{}{}\n\t{{- range $i, $arg := . }}\n\t\tvar arg{{$i}} {{$arg.Signature }}\n\t\tif tmp, ok := rawArgs[{{$arg.GQLName|quote}}]; ok {\n\t\t\tvar err error\n\t\t\t{{$arg.Unmarshal (print \"arg\" $i) \"tmp\" }}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\targs[{{$arg.GQLName|quote}}] = arg{{$i}}\n\t{{- end }}\n\treturn args, nil\n", - "field.gotpl": "{{ $field := . }}\n{{ $object := $field.Object }}\n\n{{- if $object.Stream }}\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t{{- end }}\n\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\t\tField: field,\n\t\t})\n\t\trctx := ctx // FIXME: subscriptions are missing request middleware stack https://github.com/99designs/gqlgen/issues/259\n\t\tresults, err := ec.resolvers.{{ $field.ShortInvocation }}\n\t\tif err != nil {\n\t\t\tec.Error(ctx, err)\n\t\t\treturn nil\n\t\t}\n\t\treturn func() graphql.Marshaler {\n\t\t\tres, ok := <-results\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tvar out graphql.OrderedMap\n\t\t\tout.Add(field.Alias, func() graphql.Marshaler { {{ $field.WriteJson }} }())\n\t\t\treturn &out\n\t\t}\n\t}\n{{ else }}\n\t// nolint: vetshadow\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField, {{if not $object.Root}}obj *{{$object.FullName}}{{end}}) graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\treturn graphql.Null\n\t\t\t}\n\t\t{{- end }}\n\t\trctx := &graphql.ResolverContext{\n\t\t\tObject: {{$object.GQLType|quote}},\n\t\t\tArgs: {{if $field.Args }}args{{else}}nil{{end}},\n\t\t\tField: field,\n\t\t}\n\t\tctx = graphql.WithResolverContext(ctx, rctx)\n\t\tresTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) {\n\t\t\tctx = rctx // use context from middleware stack in children\n\t\t\t{{- if $field.IsResolver }}\n\t\t\t\treturn ec.resolvers.{{ $field.ShortInvocation }}\n\t\t\t{{- else if $field.IsMethod }}\n\t\t\t\t{{- if $field.NoErr }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}), nil\n\t\t\t\t{{- else }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }})\n\t\t\t\t{{- end }}\n\t\t\t{{- else if $field.IsVariable }}\n\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}, nil\n\t\t\t{{- end }}\n\t\t})\n\t\tif resTmp == nil {\n\t\t\t{{- if $field.ASTType.NonNull }}\n\t\t\t\tif !ec.HasError(rctx) {\n\t\t\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t\t\t}\n\t\t\t{{- end }}\n\t\t\treturn graphql.Null\n\t\t}\n\t\tres := resTmp.({{$field.Signature}})\n\t\trctx.Result = res\n\t\t{{ $field.WriteJson }}\n\t}\n{{ end }}\n", + "field.gotpl": "{{ $field := . }}\n{{ $object := $field.Object }}\n\n{{- if $object.Stream }}\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t{{- end }}\n\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\t\tField: field,\n\t\t})\n\t\trctx := ctx // FIXME: subscriptions are missing request middleware stack https://github.com/99designs/gqlgen/issues/259\n\t\tresults, err := ec.resolvers.{{ $field.ShortInvocation }}\n\t\tif err != nil {\n\t\t\tec.Error(ctx, err)\n\t\t\treturn nil\n\t\t}\n\t\treturn func() graphql.Marshaler {\n\t\t\tres, ok := <-results\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tvar out graphql.OrderedMap\n\t\t\tout.Add(field.Alias, func() graphql.Marshaler { return {{ $field.WriteJson }} }())\n\t\t\treturn &out\n\t\t}\n\t}\n{{ else }}\n\t// nolint: vetshadow\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField, {{if not $object.Root}}obj *{{$object.FullName}}{{end}}) graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\treturn graphql.Null\n\t\t\t}\n\t\t{{- end }}\n\t\trctx := &graphql.ResolverContext{\n\t\t\tObject: {{$object.GQLType|quote}},\n\t\t\tArgs: {{if $field.Args }}args{{else}}nil{{end}},\n\t\t\tField: field,\n\t\t}\n\t\tctx = graphql.WithResolverContext(ctx, rctx)\n\t\tresTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) {\n\t\t\tctx = rctx // use context from middleware stack in children\n\t\t\t{{- if $field.IsResolver }}\n\t\t\t\treturn ec.resolvers.{{ $field.ShortInvocation }}\n\t\t\t{{- else if $field.IsMethod }}\n\t\t\t\t{{- if $field.NoErr }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}), nil\n\t\t\t\t{{- else }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }})\n\t\t\t\t{{- end }}\n\t\t\t{{- else if $field.IsVariable }}\n\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}, nil\n\t\t\t{{- end }}\n\t\t})\n\t\tif resTmp == nil {\n\t\t\t{{- if $field.ASTType.NonNull }}\n\t\t\t\tif !ec.HasError(rctx) {\n\t\t\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t\t\t}\n\t\t\t{{- end }}\n\t\t\treturn graphql.Null\n\t\t}\n\t\tres := resTmp.({{$field.Signature}})\n\t\trctx.Result = res\n\t\treturn {{ $field.WriteJson }}\n\t}\n{{ end }}\n", "generated.gotpl": "// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\n// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.\nfunc NewExecutableSchema(cfg Config) graphql.ExecutableSchema {\n\treturn &executableSchema{\n\t\tresolvers: cfg.Resolvers,\n\t\tdirectives: cfg.Directives,\n\t\tcomplexity: cfg.Complexity,\n\t}\n}\n\ntype Config struct {\n\tResolvers ResolverRoot\n\tDirectives DirectiveRoot\n\tComplexity ComplexityRoot\n}\n\ntype ResolverRoot interface {\n{{- range $object := .Objects -}}\n\t{{ if $object.HasResolvers -}}\n\t\t{{$object.GQLType}}() {{$object.GQLType}}Resolver\n\t{{ end }}\n{{- end }}\n}\n\ntype DirectiveRoot struct {\n{{ range $directive := .Directives }}\n\t{{ $directive.Declaration }}\n{{ end }}\n}\n\ntype ComplexityRoot struct {\n{{ range $object := .Objects }}\n\t{{ if not $object.IsReserved -}}\n\t\t{{ $object.GQLType|toCamel }} struct {\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{ if not $field.IsReserved -}}\n\t\t\t\t{{ $field.GQLName|toCamel }} {{ $field.ComplexitySignature }}\n\t\t\t{{ end }}\n\t\t{{- end }}\n\t\t}\n\t{{- end }}\n{{ end }}\n}\n\n{{ range $object := .Objects -}}\n\t{{ if $object.HasResolvers }}\n\t\ttype {{$object.GQLType}}Resolver interface {\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{ $field.ShortResolverDeclaration }}\n\t\t{{ end }}\n\t\t}\n\t{{- end }}\n{{- end }}\n\n{{ range $object := .Objects -}}\n\t{{ range $field := $object.Fields -}}\n\t\t{{ if $field.Args }}\n\t\t\tfunc {{ $field.ArgsFunc }}(rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\t\t\t{{ template \"args.gotpl\" $field.Args }}\n\t\t\t}\n\t\t{{ end }}\n\t{{ end }}\n{{- end }}\n\n{{ range $directive := .Directives }}\n\t{{ if $directive.Args }}\n\t\tfunc {{ $directive.ArgsFunc }}(rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\t\t{{ template \"args.gotpl\" $directive.Args }}\n\t\t}\n\t{{ end }}\n{{ end }}\n\ntype executableSchema struct {\n\tresolvers ResolverRoot\n\tdirectives DirectiveRoot\n\tcomplexity ComplexityRoot\n}\n\nfunc (e *executableSchema) Schema() *ast.Schema {\n\treturn parsedSchema\n}\n\nfunc (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {\n\tswitch typeName + \".\" + field {\n\t{{ range $object := .Objects }}\n\t\t{{ if not $object.IsReserved }}\n\t\t\t{{ range $field := $object.Fields }}\n\t\t\t\t{{ if not $field.IsReserved }}\n\t\t\t\t\tcase \"{{$object.GQLType}}.{{$field.GQLName}}\":\n\t\t\t\t\t\tif e.complexity.{{$object.GQLType|toCamel}}.{{$field.GQLName|toCamel}} == nil {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{{ if $field.Args }}\n\t\t\t\t\t\t\targs, err := {{ $field.ArgsFunc }}(rawArgs)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn 0, false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t{{ end }}\n\t\t\t\t\t\treturn e.complexity.{{$object.GQLType|toCamel}}.{{$field.GQLName|toCamel}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{end}}), true\n\t\t\t\t{{ end }}\n\t\t\t{{ end }}\n\t\t{{ end }}\n\t{{ end }}\n\t}\n\treturn 0, false\n}\n\nfunc (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .QueryRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.QueryRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t\tExtensions: ec.Extensions,\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"queries are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .MutationRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.MutationRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t\tExtensions: ec.Extensions,\n\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"mutations are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {\n\t{{- if .SubscriptionRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tnext := ec._{{.SubscriptionRoot.GQLType}}(ctx, op.SelectionSet)\n\t\tif ec.Errors != nil {\n\t\t\treturn graphql.OneShot(&graphql.Response{Data: []byte(\"null\"), Errors: ec.Errors})\n\t\t}\n\n\t\tvar buf bytes.Buffer\n\t\treturn func() *graphql.Response {\n\t\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\t\tbuf.Reset()\n\t\t\t\tdata := next()\n\n\t\t\t\tif data == nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tdata.MarshalGQL(&buf)\n\t\t\t\treturn buf.Bytes()\n\t\t\t})\n\n\t\t\tif buf == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn &graphql.Response{\n\t\t\t\tData: buf,\n\t\t\t\tErrors: ec.Errors,\n\t\t\t\tExtensions: ec.Extensions,\n\t\t\t}\n\t\t}\n\t{{- else }}\n\t\treturn graphql.OneShot(graphql.ErrorResponse(ctx, \"subscriptions are not supported\"))\n\t{{- end }}\n}\n\ntype executionContext struct {\n\t*graphql.RequestContext\n\t*executableSchema\n}\n\n{{- range $object := .Objects }}\n\t{{ template \"object.gotpl\" $object }}\n\n\t{{- range $field := $object.Fields }}\n\t\t{{ template \"field.gotpl\" $field }}\n\t{{ end }}\n{{- end}}\n\n{{- range $interface := .Interfaces }}\n\t{{ template \"interface.gotpl\" $interface }}\n{{- end }}\n\n{{- range $input := .Inputs }}\n\t{{ template \"input.gotpl\" $input }}\n{{- end }}\n\nfunc (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tec.Error(ctx, ec.Recover(ctx, r))\n\t\t\tret = nil\n\t\t}\n\t}()\n\t{{- if .Directives }}\n\trctx := graphql.GetResolverContext(ctx)\n\tfor _, d := range rctx.Field.Definition.Directives {\n\t\tswitch d.Name {\n\t\t{{- range $directive := .Directives }}\n\t\tcase \"{{$directive.Name}}\":\n\t\t\tif ec.directives.{{$directive.Name|ucFirst}} != nil {\n\t\t\t\t{{- if $directive.Args }}\n\t\t\t\t\trawArgs := d.ArgumentMap(ec.Variables)\n\t\t\t\t\targs, err := {{ $directive.ArgsFunc }}(rawArgs)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tec.Error(ctx, err)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t{{- end }}\n\t\t\t\tn := next\n\t\t\t\tnext = func(ctx context.Context) (interface{}, error) {\n\t\t\t\t\treturn ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})\n\t\t\t\t}\n\t\t\t}\n\t\t{{- end }}\n\t\t}\n\t}\n\t{{- end }}\n\tres, err := ec.ResolverMiddleware(ctx, next)\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn nil\n\t}\n\treturn res\n}\n\nfunc (ec *executionContext) introspectSchema() *introspection.Schema {\n\treturn introspection.WrapSchema(parsedSchema)\n}\n\nfunc (ec *executionContext) introspectType(name string) *introspection.Type {\n\treturn introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name])\n}\n\nvar parsedSchema = gqlparser.MustLoadSchema(\n\t{{- range $filename, $schema := .SchemaRaw }}\n\t\t&ast.Source{Name: {{$filename|quote}}, Input: {{$schema|rawQuote}}},\n\t{{- end }}\n)\n", "input.gotpl": "\t{{- if .IsMarshaled }}\n\tfunc Unmarshal{{ .GQLType }}(v interface{}) ({{.FullName}}, error) {\n\t\tvar it {{.FullName}}\n\t\tvar asMap = v.(map[string]interface{})\n\t\t{{ range $field := .Fields}}\n\t\t\t{{- if $field.Default}}\n\t\t\t\tif _, present := asMap[{{$field.GQLName|quote}}] ; !present {\n\t\t\t\t\tasMap[{{$field.GQLName|quote}}] = {{ $field.Default | dump }}\n\t\t\t\t}\n\t\t\t{{- end}}\n\t\t{{- end }}\n\n\t\tfor k, v := range asMap {\n\t\t\tswitch k {\n\t\t\t{{- range $field := .Fields }}\n\t\t\tcase {{$field.GQLName|quote}}:\n\t\t\t\tvar err error\n\t\t\t\t{{ $field.Unmarshal (print \"it.\" $field.GoFieldName) \"v\" }}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn it, err\n\t\t\t\t}\n\t\t\t{{- end }}\n\t\t\t}\n\t\t}\n\n\t\treturn it, nil\n\t}\n\t{{- end }}\n", "interface.gotpl": "{{- $interface := . }}\n\nfunc (ec *executionContext) _{{$interface.GQLType}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.FullName}}) graphql.Marshaler {\n\tswitch obj := (*obj).(type) {\n\tcase nil:\n\t\treturn graphql.Null\n\t{{- range $implementor := $interface.Implementors }}\n\t\t{{- if $implementor.ValueReceiver }}\n\t\t\tcase {{$implementor.FullName}}:\n\t\t\t\treturn ec._{{$implementor.GQLType}}(ctx, sel, &obj)\n\t\t{{- end}}\n\t\tcase *{{$implementor.FullName}}:\n\t\t\treturn ec._{{$implementor.GQLType}}(ctx, sel, obj)\n\t{{- end }}\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unexpected type %T\", obj))\n\t}\n}\n", diff --git a/codegen/templates/field.gotpl b/codegen/templates/field.gotpl index 56943d2f7ae..9fbf28d4735 100644 --- a/codegen/templates/field.gotpl +++ b/codegen/templates/field.gotpl @@ -26,7 +26,7 @@ return nil } var out graphql.OrderedMap - out.Add(field.Alias, func() graphql.Marshaler { {{ $field.WriteJson }} }()) + out.Add(field.Alias, func() graphql.Marshaler { return {{ $field.WriteJson }} }()) return &out } } @@ -71,6 +71,6 @@ } res := resTmp.({{$field.Signature}}) rctx.Result = res - {{ $field.WriteJson }} + return {{ $field.WriteJson }} } {{ end }} diff --git a/codegen/type.go b/codegen/type.go index 8c53fe55217..2e9c67dc0b4 100644 --- a/codegen/type.go +++ b/codegen/type.go @@ -163,8 +163,8 @@ func (t Type) Marshal(val string) string { } if t.Marshaler != nil { - return "return " + t.Marshaler.PkgDot() + "Marshal" + t.Marshaler.GoType + "(" + val + ")" + return t.Marshaler.PkgDot() + "Marshal" + t.Marshaler.GoType + "(" + val + ")" } - return "return " + val + return val } diff --git a/example/chat/generated.go b/example/chat/generated.go index 00e2aaef9cf..a3c3ab99f9f 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -404,7 +404,9 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -427,40 +429,42 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq } res := resTmp.([]Message) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec._Message(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec._Message(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } var messageImplementors = []string{"Message"} @@ -528,7 +532,9 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -551,7 +557,9 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -574,7 +582,9 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -597,7 +607,9 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq } res := resTmp.(time.Time) rctx.Result = res - return graphql.MarshalTime(res) + return func() graphql.Marshaler { + return graphql.MarshalTime(res) + }() } var mutationImplementors = []string{"Mutation"} @@ -660,8 +672,10 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co } res := resTmp.(Message) rctx.Result = res + return func() graphql.Marshaler { - return ec._Message(ctx, field.Selections, &res) + return ec._Message(ctx, field.Selections, &res) + }() } var queryImplementors = []string{"Query"} @@ -727,12 +741,14 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle } res := resTmp.(*Chatroom) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Chatroom(ctx, field.Selections, res) + return ec._Chatroom(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -758,12 +774,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -783,12 +801,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var subscriptionImplementors = []string{"Subscription"} @@ -835,7 +855,10 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel } var out graphql.OrderedMap out.Add(field.Alias, func() graphql.Marshaler { - return ec._Message(ctx, field.Selections, &res) + return func() graphql.Marshaler { + + return ec._Message(ctx, field.Selections, &res) + }() }()) return &out } @@ -903,7 +926,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -923,7 +948,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -946,16 +973,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -978,40 +1007,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -1073,7 +1104,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1093,7 +1126,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1116,7 +1151,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1136,7 +1173,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1208,7 +1247,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1228,7 +1269,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1251,40 +1294,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1307,15 +1352,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1338,7 +1385,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1358,7 +1407,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1420,7 +1471,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1440,7 +1493,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1463,15 +1518,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1491,11 +1548,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1562,40 +1621,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1618,15 +1679,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1646,12 +1709,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1671,12 +1736,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1699,40 +1766,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -1801,7 +1870,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1821,11 +1892,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -1845,7 +1918,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1871,40 +1946,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1924,40 +2001,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1977,40 +2056,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2036,40 +2117,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2089,40 +2172,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2142,12 +2227,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { diff --git a/example/config/generated.go b/example/config/generated.go index a807683571e..e9e63edcf18 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -318,8 +318,10 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap } res := resTmp.(Todo) rctx.Result = res + return func() graphql.Marshaler { - return ec._Todo(ctx, field.Selections, &res) + return ec._Todo(ctx, field.Selections, &res) + }() } var queryImplementors = []string{"Query"} @@ -385,40 +387,42 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll } res := resTmp.([]Todo) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Todo(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Todo(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -444,12 +448,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -469,12 +475,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var todoImplementors = []string{"Todo"} @@ -552,7 +560,9 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -575,7 +585,9 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -598,7 +610,9 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -621,7 +635,9 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -644,8 +660,10 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec } res := resTmp.(User) rctx.Result = res + return func() graphql.Marshaler { - return ec._User(ctx, field.Selections, &res) + return ec._User(ctx, field.Selections, &res) + }() } var userImplementors = []string{"User"} @@ -703,7 +721,9 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -726,7 +746,9 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -791,7 +813,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -811,7 +835,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -834,16 +860,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -866,40 +894,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -961,7 +991,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -981,7 +1013,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1004,7 +1038,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1024,7 +1060,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1096,7 +1134,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1116,7 +1156,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1139,40 +1181,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1195,15 +1239,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1226,7 +1272,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1246,7 +1294,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1308,7 +1358,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1328,7 +1380,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1351,15 +1405,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1379,11 +1435,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1450,40 +1508,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1506,15 +1566,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1534,12 +1596,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1559,12 +1623,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1587,40 +1653,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -1689,7 +1757,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1709,11 +1779,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -1733,7 +1805,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1759,40 +1833,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1812,40 +1888,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1865,40 +1943,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1924,40 +2004,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1977,40 +2059,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2030,12 +2114,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func UnmarshalNewTodo(v interface{}) (NewTodo, error) { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 543274b512d..b2f63cb22ce 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -413,7 +413,9 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -436,7 +438,9 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -459,7 +463,9 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var customerImplementors = []string{"Customer"} @@ -530,7 +536,9 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -553,7 +561,9 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -573,12 +583,14 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql } res := resTmp.(*Address) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Address(ctx, field.Selections, res) + return ec._Address(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -598,40 +610,42 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. } res := resTmp.([]Order) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Order(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Order(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var itemImplementors = []string{"Item"} @@ -684,7 +698,9 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var orderImplementors = []string{"Order"} @@ -754,7 +770,9 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -777,7 +795,9 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle } res := resTmp.(time.Time) rctx.Result = res - return graphql.MarshalTime(res) + return func() graphql.Marshaler { + return graphql.MarshalTime(res) + }() } // nolint: vetshadow @@ -800,7 +820,9 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col } res := resTmp.(float64) rctx.Result = res - return graphql.MarshalFloat(res) + return func() graphql.Marshaler { + return graphql.MarshalFloat(res) + }() } // nolint: vetshadow @@ -820,40 +842,42 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll } res := resTmp.([]Item) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Item(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Item(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var queryImplementors = []string{"Query"} @@ -925,40 +949,42 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. } res := resTmp.([]Customer) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Customer(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Customer(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -984,40 +1010,42 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. } res := resTmp.([]Customer) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Customer(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Customer(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1043,71 +1071,73 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. } res := resTmp.([][]Customer) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - arr2 := make(graphql.Array, len(res[idx1])) - - isLen1 := len(res[idx1]) == 1 + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { if !isLen1 { - wg.Add(len(res[idx1])) + defer wg.Done() } + arr1[idx1] = func() graphql.Marshaler { + + arr2 := make(graphql.Array, len(res[idx1])) - for idx2 := range res[idx1] { - idx2 := idx2 - rctx := &graphql.ResolverContext{ - Index: &idx2, - Result: &res[idx1][idx2], + isLen1 := len(res[idx1]) == 1 + if !isLen1 { + wg.Add(len(res[idx1])) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx2 int) { - if !isLen1 { - defer wg.Done() + + for idx2 := range res[idx1] { + idx2 := idx2 + rctx := &graphql.ResolverContext{ + Index: &idx2, + Result: &res[idx1][idx2], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx2 int) { + if !isLen1 { + defer wg.Done() + } + arr2[idx2] = func() graphql.Marshaler { + + return ec._Customer(ctx, field.Selections, &res[idx1][idx2]) + }() + } + if isLen1 { + f(idx2) + } else { + go f(idx2) } - arr2[idx2] = func() graphql.Marshaler { - return ec._Customer(ctx, field.Selections, &res[idx1][idx2]) - }() - } - if isLen1 { - f(idx2) - } else { - go f(idx2) } - } + return arr2 + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - return arr2 - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1133,12 +1163,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1158,12 +1190,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -1228,7 +1262,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1248,7 +1284,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1271,16 +1309,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -1303,40 +1343,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -1398,7 +1440,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1418,7 +1462,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1441,7 +1487,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1461,7 +1509,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1533,7 +1583,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1553,7 +1605,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1576,40 +1630,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1632,15 +1688,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1663,7 +1721,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1683,7 +1743,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1745,7 +1807,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1765,7 +1829,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1788,15 +1854,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1816,11 +1884,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1887,40 +1957,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1943,15 +2015,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1971,12 +2045,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1996,12 +2072,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -2024,40 +2102,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -2126,7 +2206,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2146,11 +2228,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -2170,7 +2254,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2196,40 +2282,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2249,40 +2337,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2302,40 +2392,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2361,40 +2453,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2414,40 +2508,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2467,12 +2563,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index da4ffeddb69..88eabfcbe20 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -344,7 +344,9 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } res := resTmp.(external.ObjectID) rctx.Result = res - return model.MarshalID(res) + return func() graphql.Marshaler { + return model.MarshalID(res) + }() } // nolint: vetshadow @@ -364,11 +366,13 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql } res := resTmp.(*model.Point) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return *res + if res == nil { + return graphql.Null + } + return *res + }() } var queryImplementors = []string{"Query"} @@ -443,12 +447,14 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } res := resTmp.(*model.User) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._User(ctx, field.Selections, res) + return ec._User(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -477,40 +483,42 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } res := resTmp.([]model.User) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._User(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._User(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -536,12 +544,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -561,12 +571,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var userImplementors = []string{"User"} @@ -654,7 +666,9 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } res := resTmp.(external.ObjectID) rctx.Result = res - return model.MarshalID(res) + return func() graphql.Marshaler { + return model.MarshalID(res) + }() } // nolint: vetshadow @@ -677,7 +691,9 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -697,7 +713,9 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } res := resTmp.(time.Time) rctx.Result = res - return model.MarshalTimestamp(res) + return func() graphql.Marshaler { + return model.MarshalTimestamp(res) + }() } // nolint: vetshadow @@ -720,7 +738,9 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co } res := resTmp.(model.Banned) rctx.Result = res - return graphql.MarshalBoolean(bool(res)) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(bool(res)) + }() } // nolint: vetshadow @@ -743,7 +763,9 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -766,7 +788,9 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap } res := resTmp.(model.Point) rctx.Result = res - return res + return func() graphql.Marshaler { + return res + }() } // nolint: vetshadow @@ -786,8 +810,10 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col } res := resTmp.(model.Address) rctx.Result = res + return func() graphql.Marshaler { - return ec._Address(ctx, field.Selections, &res) + return ec._Address(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -807,7 +833,9 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec } res := resTmp.(model.Tier) rctx.Result = res - return res + return func() graphql.Marshaler { + return res + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -872,7 +900,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -892,7 +922,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -915,16 +947,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -947,40 +981,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -1042,7 +1078,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1062,7 +1100,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1085,7 +1125,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1105,7 +1147,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1177,7 +1221,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1197,7 +1243,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1220,40 +1268,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1276,15 +1326,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1307,7 +1359,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1327,7 +1381,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1389,7 +1445,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1409,7 +1467,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1432,15 +1492,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1460,11 +1522,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1531,40 +1595,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1587,15 +1653,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1615,12 +1683,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1640,12 +1710,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1668,40 +1740,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -1770,7 +1844,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1790,11 +1866,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -1814,7 +1892,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1840,40 +1920,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1893,40 +1975,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1946,40 +2030,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2005,40 +2091,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2058,40 +2146,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2111,12 +2201,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func UnmarshalSearchArgs(v interface{}) (model.SearchArgs, error) { diff --git a/example/selection/generated.go b/example/selection/generated.go index ca8cfbe47c1..ad363f31c30 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -275,7 +275,9 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -298,7 +300,9 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec } res := resTmp.(time.Time) rctx.Result = res - return graphql.MarshalTime(res) + return func() graphql.Marshaler { + return graphql.MarshalTime(res) + }() } // nolint: vetshadow @@ -318,16 +322,18 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -347,16 +353,18 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } var postImplementors = []string{"Post", "Event"} @@ -418,7 +426,9 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -441,7 +451,9 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec } res := resTmp.(time.Time) rctx.Result = res - return graphql.MarshalTime(res) + return func() graphql.Marshaler { + return graphql.MarshalTime(res) + }() } // nolint: vetshadow @@ -461,16 +473,18 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -490,16 +504,18 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } var queryImplementors = []string{"Query"} @@ -559,40 +575,42 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col } res := resTmp.([]Event) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec._Event(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec._Event(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -618,12 +636,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -643,12 +663,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -713,7 +735,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -733,7 +757,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -756,16 +782,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -788,40 +816,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -883,7 +913,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -903,7 +935,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -926,7 +960,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -946,7 +982,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1018,7 +1056,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1038,7 +1078,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1061,40 +1103,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1117,15 +1161,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1148,7 +1194,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1168,7 +1216,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1230,7 +1280,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1250,7 +1302,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1273,15 +1327,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1301,11 +1357,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1372,40 +1430,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1428,15 +1488,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1456,12 +1518,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1481,12 +1545,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1509,40 +1575,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -1611,7 +1679,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1631,11 +1701,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -1655,7 +1727,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1681,40 +1755,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1734,40 +1810,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1787,40 +1865,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1846,40 +1926,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1899,40 +1981,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) } - arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1952,12 +2036,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func (ec *executionContext) _Event(ctx context.Context, sel ast.SelectionSet, obj *Event) graphql.Marshaler { diff --git a/example/starwars/generated.go b/example/starwars/generated.go index d92f231bce8..2059df975f2 100644 --- a/example/starwars/generated.go +++ b/example/starwars/generated.go @@ -899,7 +899,9 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -922,7 +924,9 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -942,40 +946,42 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co } res := resTmp.([]Character) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Character(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Character(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1004,8 +1010,10 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field } res := resTmp.(FriendsConnection) rctx.Result = res + return func() graphql.Marshaler { - return ec._FriendsConnection(ctx, field.Selections, &res) + return ec._FriendsConnection(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -1028,16 +1036,18 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. } res := resTmp.([]Episode) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return res[idx1] + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -1057,7 +1067,9 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var friendsConnectionImplementors = []string{"FriendsConnection"} @@ -1128,7 +1140,9 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -1148,40 +1162,42 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field } res := resTmp.([]FriendsEdge) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._FriendsEdge(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._FriendsEdge(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1201,40 +1217,42 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel } res := resTmp.([]Character) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Character(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Character(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1257,8 +1275,10 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie } res := resTmp.(PageInfo) rctx.Result = res + return func() graphql.Marshaler { - return ec._PageInfo(ctx, field.Selections, &res) + return ec._PageInfo(ctx, field.Selections, &res) + }() } var friendsEdgeImplementors = []string{"FriendsEdge"} @@ -1313,7 +1333,9 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -1333,8 +1355,10 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql } res := resTmp.(Character) rctx.Result = res + return func() graphql.Marshaler { - return ec._Character(ctx, field.Selections, &res) + return ec._Character(ctx, field.Selections, &res) + }() } var humanImplementors = []string{"Human", "Character"} @@ -1426,7 +1450,9 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -1449,7 +1475,9 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1478,7 +1506,9 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col } res := resTmp.(float64) rctx.Result = res - return graphql.MarshalFloat(res) + return func() graphql.Marshaler { + return graphql.MarshalFloat(res) + }() } // nolint: vetshadow @@ -1498,7 +1528,9 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle } res := resTmp.(float64) rctx.Result = res - return graphql.MarshalFloat(res) + return func() graphql.Marshaler { + return graphql.MarshalFloat(res) + }() } // nolint: vetshadow @@ -1518,40 +1550,42 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co } res := resTmp.([]Character) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Character(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Character(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1580,8 +1614,10 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field } res := resTmp.(FriendsConnection) rctx.Result = res + return func() graphql.Marshaler { - return ec._FriendsConnection(ctx, field.Selections, &res) + return ec._FriendsConnection(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -1604,16 +1640,18 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. } res := resTmp.([]Episode) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return res[idx1] + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -1633,40 +1671,42 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. } res := resTmp.([]Starship) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Starship(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Starship(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var mutationImplementors = []string{"Mutation"} @@ -1723,12 +1763,14 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr } res := resTmp.(*Review) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Review(ctx, field.Selections, res) + return ec._Review(ctx, field.Selections, res) + }() } var pageInfoImplementors = []string{"PageInfo"} @@ -1791,7 +1833,9 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -1814,7 +1858,9 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -1837,7 +1883,9 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } var queryImplementors = []string{"Query"} @@ -1945,8 +1993,10 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle } res := resTmp.(Character) rctx.Result = res + return func() graphql.Marshaler { - return ec._Character(ctx, field.Selections, &res) + return ec._Character(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -1975,40 +2025,42 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co } res := resTmp.([]Review) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Review(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Review(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2037,40 +2089,42 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } res := resTmp.([]SearchResult) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._SearchResult(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._SearchResult(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2096,8 +2150,10 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. } res := resTmp.(Character) rctx.Result = res + return func() graphql.Marshaler { - return ec._Character(ctx, field.Selections, &res) + return ec._Character(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -2123,12 +2179,14 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll } res := resTmp.(*Droid) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Droid(ctx, field.Selections, res) + return ec._Droid(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -2154,12 +2212,14 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll } res := resTmp.(*Human) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Human(ctx, field.Selections, res) + return ec._Human(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -2185,12 +2245,14 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C } res := resTmp.(*Starship) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Starship(ctx, field.Selections, res) + return ec._Starship(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -2216,12 +2278,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -2241,12 +2305,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var reviewImplementors = []string{"Review"} @@ -2303,7 +2369,9 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -2323,11 +2391,13 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -2347,7 +2417,9 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll } res := resTmp.(time.Time) rctx.Result = res - return graphql.MarshalTime(res) + return func() graphql.Marshaler { + return graphql.MarshalTime(res) + }() } var starshipImplementors = []string{"Starship"} @@ -2420,7 +2492,9 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalID(res) + return func() graphql.Marshaler { + return graphql.MarshalID(res) + }() } // nolint: vetshadow @@ -2443,7 +2517,9 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2472,7 +2548,9 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. } res := resTmp.(float64) rctx.Result = res - return graphql.MarshalFloat(res) + return func() graphql.Marshaler { + return graphql.MarshalFloat(res) + }() } // nolint: vetshadow @@ -2495,25 +2573,27 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql } res := resTmp.([][]int) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { - arr2 := make(graphql.Array, len(res[idx1])) + arr2 := make(graphql.Array, len(res[idx1])) - for idx2 := range res[idx1] { - arr2[idx2] = func() graphql.Marshaler { - return graphql.MarshalInt(res[idx1][idx2]) - }() - } + for idx2 := range res[idx1] { + arr2[idx2] = func() graphql.Marshaler { + return graphql.MarshalInt(res[idx1][idx2]) + }() + } - return arr2 - }() - } + return arr2 + }() + } - return arr1 + return arr1 + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -2578,7 +2658,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2598,7 +2680,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2621,16 +2705,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -2653,40 +2739,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -2748,7 +2836,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2768,7 +2858,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2791,7 +2883,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -2811,7 +2905,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -2883,7 +2979,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2903,7 +3001,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -2926,40 +3026,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2982,15 +3084,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -3013,7 +3117,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -3033,7 +3139,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -3095,7 +3203,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -3115,7 +3225,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -3138,15 +3250,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -3166,11 +3280,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -3237,40 +3353,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -3293,15 +3411,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -3321,12 +3441,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -3346,12 +3468,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -3374,40 +3498,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -3476,7 +3602,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -3496,11 +3624,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -3520,7 +3650,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -3546,40 +3678,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -3599,40 +3733,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -3652,40 +3788,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -3711,40 +3849,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -3764,40 +3904,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -3817,12 +3959,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func (ec *executionContext) _Character(ctx context.Context, sel ast.SelectionSet, obj *Character) graphql.Marshaler { diff --git a/example/todo/generated.go b/example/todo/generated.go index 94faf5fcebf..87c59fcb3af 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -373,8 +373,10 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } res := resTmp.(Todo) rctx.Result = res + return func() graphql.Marshaler { - return ec._Todo(ctx, field.Selections, &res) + return ec._Todo(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -400,12 +402,14 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr } res := resTmp.(*Todo) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Todo(ctx, field.Selections, res) + return ec._Todo(ctx, field.Selections, res) + }() } var myQueryImplementors = []string{"MyQuery"} @@ -486,12 +490,14 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } res := resTmp.(*Todo) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Todo(ctx, field.Selections, res) + return ec._Todo(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -511,12 +517,14 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql } res := resTmp.(*Todo) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Todo(ctx, field.Selections, res) + return ec._Todo(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -539,40 +547,42 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } res := resTmp.([]Todo) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec._Todo(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec._Todo(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -598,12 +608,14 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -623,12 +635,14 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var todoImplementors = []string{"Todo"} @@ -691,7 +705,9 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } res := resTmp.(int) rctx.Result = res - return graphql.MarshalInt(res) + return func() graphql.Marshaler { + return graphql.MarshalInt(res) + }() } // nolint: vetshadow @@ -714,7 +730,9 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -737,7 +755,9 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -802,7 +822,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -822,7 +844,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -845,16 +869,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -877,40 +903,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -972,7 +1000,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -992,7 +1022,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1015,7 +1047,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1035,7 +1069,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1107,7 +1143,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1127,7 +1165,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1150,40 +1190,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1206,15 +1248,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1237,7 +1281,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1257,7 +1303,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1319,7 +1367,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1339,7 +1389,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1362,15 +1414,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1390,11 +1444,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1461,40 +1517,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1517,15 +1575,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1545,12 +1605,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1570,12 +1632,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1598,40 +1662,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -1700,7 +1766,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1720,11 +1788,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -1744,7 +1814,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1770,40 +1842,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1823,40 +1897,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1876,40 +1952,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1935,40 +2013,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1988,40 +2068,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2041,12 +2123,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func UnmarshalTodoInput(v interface{}) (TodoInput, error) { diff --git a/integration/generated.go b/integration/generated.go index 3232b3cc4f9..bd7d410992f 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -385,8 +385,10 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co } res := resTmp.(models.Element) rctx.Result = res + return func() graphql.Marshaler { - return ec._Element(ctx, field.Selections, &res) + return ec._Element(ctx, field.Selections, &res) + }() } // nolint: vetshadow @@ -409,7 +411,9 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -429,16 +433,18 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph } res := resTmp.([]bool) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalBoolean(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalBoolean(res[idx1]) + }() + } - return arr1 + return arr1 + }() } var queryImplementors = []string{"Query"} @@ -531,44 +537,46 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle } res := resTmp.([]*models.Element) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - if res[idx1] == nil { - return graphql.Null + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() } + arr1[idx1] = func() graphql.Marshaler { - return ec._Element(ctx, field.Selections, res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + if res[idx1] == nil { + return graphql.Null + } - } - wg.Wait() - return arr1 + return ec._Element(ctx, field.Selections, res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } + + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -597,7 +605,9 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -617,12 +627,14 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col } res := resTmp.(*models.Viewer) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._Viewer(ctx, field.Selections, res) + return ec._Viewer(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -645,7 +657,9 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -674,7 +688,9 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -700,12 +716,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -725,12 +743,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Schema(ctx, field.Selections, res) + return ec.___Schema(ctx, field.Selections, res) + }() } var userImplementors = []string{"User"} @@ -793,7 +813,9 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -816,16 +838,18 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } var viewerImplementors = []string{"Viewer"} @@ -872,12 +896,14 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll } res := resTmp.(*remote_api.User) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec._User(ctx, field.Selections, res) + return ec._User(ctx, field.Selections, res) + }() } var __DirectiveImplementors = []string{"__Directive"} @@ -942,7 +968,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -962,7 +990,9 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -985,16 +1015,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } res := resTmp.([]string) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) + arr1 := make(graphql.Array, len(res)) - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return graphql.MarshalString(res[idx1]) - }() - } + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return graphql.MarshalString(res[idx1]) + }() + } - return arr1 + return arr1 + }() } // nolint: vetshadow @@ -1017,40 +1049,42 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __EnumValueImplementors = []string{"__EnumValue"} @@ -1112,7 +1146,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1132,7 +1168,9 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1155,7 +1193,9 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1175,7 +1215,9 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __FieldImplementors = []string{"__Field"} @@ -1247,7 +1289,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1267,7 +1311,9 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1290,40 +1336,42 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1346,15 +1394,17 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1377,7 +1427,9 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } res := resTmp.(bool) rctx.Result = res - return graphql.MarshalBoolean(res) + return func() graphql.Marshaler { + return graphql.MarshalBoolean(res) + }() } // nolint: vetshadow @@ -1397,7 +1449,9 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } var __InputValueImplementors = []string{"__InputValue"} @@ -1459,7 +1513,9 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1479,7 +1535,9 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1502,15 +1560,17 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1530,11 +1590,13 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } var __SchemaImplementors = []string{"__Schema"} @@ -1601,40 +1663,42 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1657,15 +1721,17 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") + if res == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null } - return graphql.Null - } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1685,12 +1751,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1710,12 +1778,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } // nolint: vetshadow @@ -1738,40 +1808,42 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } res := resTmp.([]introspection.Directive) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Directive(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Directive(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } var __TypeImplementors = []string{"__Type"} @@ -1840,7 +1912,9 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1860,11 +1934,13 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } - return graphql.MarshalString(*res) + if res == nil { + return graphql.Null + } + return graphql.MarshalString(*res) + }() } // nolint: vetshadow @@ -1884,7 +1960,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - return graphql.MarshalString(res) + return func() graphql.Marshaler { + return graphql.MarshalString(res) + }() } // nolint: vetshadow @@ -1910,40 +1988,42 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Field(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Field(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -1963,40 +2043,42 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2016,40 +2098,42 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___Type(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___Type(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2075,40 +2159,42 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___EnumValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___EnumValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2128,40 +2214,42 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res + return func() graphql.Marshaler { - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], } - arr1[idx1] = func() graphql.Marshaler { + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { - return ec.___InputValue(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } + return ec.___InputValue(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } - } - wg.Wait() - return arr1 + } + wg.Wait() + return arr1 + }() } // nolint: vetshadow @@ -2181,12 +2269,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res + return func() graphql.Marshaler { - if res == nil { - return graphql.Null - } + if res == nil { + return graphql.Null + } - return ec.___Type(ctx, field.Selections, res) + return ec.___Type(ctx, field.Selections, res) + }() } func UnmarshalDateFilter(v interface{}) (models.DateFilter, error) {