From e601d8498f9d3b4a14bc155ac3b07e24a15011c3 Mon Sep 17 00:00:00 2001 From: Parag Kanodia Date: Thu, 5 Dec 2024 10:04:08 +0530 Subject: [PATCH 1/4] introduced usefunctionsyntaxforexecutioncontext --- codegen/args.gotpl | 28 +- codegen/config/config.go | 41 +- codegen/directives.gotpl | 53 +- codegen/field.gotpl | 57 +- codegen/generated!.gotpl | 37 + codegen/input.gotpl | 20 +- codegen/interface.gotpl | 10 + codegen/object.gotpl | 27 + codegen/root_.gotpl | 37 + codegen/templates/templates.go | 16 + codegen/templates/templates_test.go | 46 + .../directive.go | 16 + .../generated.go | 5291 ++++++++++ .../generated_test.go | 297 + .../gqlgen.yml | 24 + .../models-gen.go | 111 + .../resolver.go | 52 + .../stub.go | 59 + .../test.graphql | 86 + codegen/type.gotpl | 53 + docs/content/config.md | 6 +- plugin/federation/federation.go | 5 +- plugin/federation/federation.gotpl | 18 + ...ction_syntax_for_execution_context_test.go | 51 + .../entity.resolvers.go | 184 + .../generated/errors.go | 9 + .../generated/exec.go | 8942 +++++++++++++++++ .../generated/federation.go | 1031 ++ .../generated/model/models.go | 130 + .../gqlgen.yml | 15 + .../resolver.go | 10 + .../schema.graphql | 77 + .../schema.resolvers.go | 4 + 33 files changed, 16803 insertions(+), 40 deletions(-) create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/directive.go create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/generated.go create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/gqlgen.yml create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/models-gen.go create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/resolver.go create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/stub.go create mode 100644 codegen/testserver/usefunctionsyntaxforexecutioncontext/test.graphql create mode 100644 plugin/federation/federation_use_function_syntax_for_execution_context_test.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/entity.resolvers.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/errors.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/exec.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/federation.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model/models.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/gqlgen.yml create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/resolver.go create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.graphql create mode 100644 plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.resolvers.go diff --git a/codegen/args.gotpl b/codegen/args.gotpl index 2f3afdf077f..98d6e288758 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -1,10 +1,20 @@ +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + {{ range $name, $args := .Args }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func {{ $name }}(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { +{{- else -}} func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +{{- end }} var err error args := map[string]interface{}{} {{- range $i, $arg := . }} + {{ if $useFunctionSyntaxForExecutionContext -}} + arg{{$i}}, err := {{ $name }}{{$arg.Name | go}}(ctx, ec, rawArgs) + {{- else -}} arg{{$i}}, err := ec.{{ $name }}{{$arg.Name | go}}(ctx, rawArgs) + {{- end }} if err != nil { return nil, err } @@ -14,10 +24,18 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] } {{- range $i, $arg := . }} + {{ if $useFunctionSyntaxForExecutionContext -}} + func {{ $name }}{{$arg.Name | go}}( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, + ) ({{ $arg.TypeReference.GO | ref}}, error) { + {{- else -}} func (ec *executionContext) {{ $name }}{{$arg.Name | go}}( ctx context.Context, rawArgs map[string]interface{}, ) ({{ $arg.TypeReference.GO | ref}}, error) { + {{- end }} {{- if not .CallArgumentDirectivesWithNull}} // We won't call the directive if the argument is null. // Set call_argument_directives_with_null to true to call directives @@ -36,9 +54,13 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] var zeroVal {{ $arg.TypeReference.GO | ref}} return zeroVal, nil } + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $arg.TypeReference.UnmarshalFunc }}(ctx, ec, tmp) + {{- else -}} return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) + {{- end }} } - {{ template "implDirectives" $arg }} + {{ template "implDirectives" (dict "Field" $arg "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} tmp, err := directive{{$arg.ImplDirectives|len}}(ctx) if err != nil { var zeroVal {{ $arg.TypeReference.GO | ref}} @@ -57,7 +79,11 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] } {{- else }} if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $arg.TypeReference.UnmarshalFunc }}(ctx, ec, tmp) + {{- else -}} return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) + {{- end }} } var zeroVal {{ $arg.TypeReference.GO | ref}} diff --git a/codegen/config/config.go b/codegen/config/config.go index cb4c8f4b152..9e8433a7df9 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -22,26 +22,27 @@ import ( ) type Config struct { - SchemaFilename StringList `yaml:"schema,omitempty"` - Exec ExecConfig `yaml:"exec"` - Model PackageConfig `yaml:"model,omitempty"` - Federation PackageConfig `yaml:"federation,omitempty"` - Resolver ResolverConfig `yaml:"resolver,omitempty"` - AutoBind []string `yaml:"autobind"` - Models TypeMap `yaml:"models,omitempty"` - StructTag string `yaml:"struct_tag,omitempty"` - Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` - GoBuildTags StringList `yaml:"go_build_tags,omitempty"` - GoInitialisms GoInitialismsConfig `yaml:"go_initialisms,omitempty"` - OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` - OmitGetters bool `yaml:"omit_getters,omitempty"` - OmitInterfaceChecks bool `yaml:"omit_interface_checks,omitempty"` - OmitComplexity bool `yaml:"omit_complexity,omitempty"` - OmitGQLGenFileNotice bool `yaml:"omit_gqlgen_file_notice,omitempty"` - OmitGQLGenVersionInFileNotice bool `yaml:"omit_gqlgen_version_in_file_notice,omitempty"` - OmitRootModels bool `yaml:"omit_root_models,omitempty"` - OmitResolverFields bool `yaml:"omit_resolver_fields,omitempty"` - OmitPanicHandler bool `yaml:"omit_panic_handler,omitempty"` + SchemaFilename StringList `yaml:"schema,omitempty"` + Exec ExecConfig `yaml:"exec"` + Model PackageConfig `yaml:"model,omitempty"` + Federation PackageConfig `yaml:"federation,omitempty"` + Resolver ResolverConfig `yaml:"resolver,omitempty"` + AutoBind []string `yaml:"autobind"` + Models TypeMap `yaml:"models,omitempty"` + StructTag string `yaml:"struct_tag,omitempty"` + Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` + GoBuildTags StringList `yaml:"go_build_tags,omitempty"` + GoInitialisms GoInitialismsConfig `yaml:"go_initialisms,omitempty"` + OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` + OmitGetters bool `yaml:"omit_getters,omitempty"` + OmitInterfaceChecks bool `yaml:"omit_interface_checks,omitempty"` + OmitComplexity bool `yaml:"omit_complexity,omitempty"` + OmitGQLGenFileNotice bool `yaml:"omit_gqlgen_file_notice,omitempty"` + OmitGQLGenVersionInFileNotice bool `yaml:"omit_gqlgen_version_in_file_notice,omitempty"` + OmitRootModels bool `yaml:"omit_root_models,omitempty"` + OmitResolverFields bool `yaml:"omit_resolver_fields,omitempty"` + OmitPanicHandler bool `yaml:"omit_panic_handler,omitempty"` + UseFunctionSyntaxForExecutionContext bool `yaml:"use_function_syntax_for_execution_context,omitempty"` // If this is set to true, argument directives that // decorate a field with a null value will still be called. // diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index c3fa8abef85..a66a53bd206 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -1,16 +1,28 @@ -{{ define "implDirectives" }}{{ $in := .DirectiveObjName }} - {{ $zeroVal := .TypeReference.GO | ref}} - {{- range $i, $directive := .ImplDirectives -}} +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + +{{ define "implDirectives" }} + {{ $in := .Field.DirectiveObjName }} + {{ $useFunctionSyntaxForExecutionContext := .UseFunctionSyntaxForExecutionContext }} + {{ $zeroVal := .Field.TypeReference.GO | ref}} + {{- range $i, $directive := .Field.ImplDirectives -}} directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { {{- range $arg := $directive.Args }} {{- if notNil "Value" $arg }} + {{ if $useFunctionSyntaxForExecutionContext -}} + {{ $arg.VarName }}, err := {{ $arg.TypeReference.UnmarshalFunc }}(ctx, ec, {{ $arg.Value | dump }}) + {{- else -}} {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Value | dump }}) + {{- end }} if err != nil{ var zeroVal {{$zeroVal}} return zeroVal, err } {{- else if notNil "Default" $arg }} + {{ if $useFunctionSyntaxForExecutionContext -}} + {{ $arg.VarName }}, err := {{ $arg.TypeReference.UnmarshalFunc }}(ctx, ec, {{ $arg.Default | dump }}) + {{- else -}} {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }}) + {{- end }} if err != nil{ var zeroVal {{$zeroVal}} return zeroVal, err @@ -29,13 +41,18 @@ {{ end }} {{define "queryDirectives"}} + {{ $useFunctionSyntaxForExecutionContext := .UseFunctionSyntaxForExecutionContext }} for _, d := range obj.Directives { switch d.Name { - {{- range $directive := . }} + {{- range $directive := .DirectiveList }} case "{{$directive.Name}}": {{- if $directive.Args }} rawArgs := d.ArgumentMap(ec.Variables) + {{ if $useFunctionSyntaxForExecutionContext -}} + args, err := {{ $directive.ArgsFunc }}(ctx,ec,rawArgs) + {{- else -}} args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + {{- end }} if err != nil { ec.Error(ctx, err) return graphql.Null @@ -70,26 +87,42 @@ {{end}} {{ if .Directives.LocationDirectives "QUERY" }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func _queryMiddleware(ctx context.Context, ec *executionContext, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { +{{- else -}} func (ec *executionContext) _queryMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { - {{ template "queryDirectives" .Directives.LocationDirectives "QUERY" }} +{{- end }} + {{ template "queryDirectives" (dict "DirectiveList" (.Directives.LocationDirectives "QUERY") "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} } {{ end }} {{ if .Directives.LocationDirectives "MUTATION" }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func _mutationMiddleware(ctx context.Context, ec *executionContext, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { +{{- else -}} func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { - {{ template "queryDirectives" .Directives.LocationDirectives "MUTATION" }} +{{- end }} + {{ template "queryDirectives" (dict "DirectiveList" (.Directives.LocationDirectives "MUTATION") "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} } {{ end }} {{ if .Directives.LocationDirectives "SUBSCRIPTION" }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func _subscriptionMiddleware(ctx context.Context, ec *executionContext, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func(ctx context.Context) graphql.Marshaler { +{{- else -}} func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func(ctx context.Context) graphql.Marshaler { +{{- end }} for _, d := range obj.Directives { switch d.Name { {{- range $directive := .Directives.LocationDirectives "SUBSCRIPTION" }} case "{{$directive.Name}}": {{- if $directive.Args }} rawArgs := d.ArgumentMap(ec.Variables) + {{ if $useFunctionSyntaxForExecutionContext -}} + args, err := {{ $directive.ArgsFunc }}(ctx,ec,rawArgs) + {{- else -}} args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + {{- end }} if err != nil { ec.Error(ctx, err) return func(ctx context.Context) graphql.Marshaler { @@ -122,7 +155,11 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as {{ end }} {{ if .Directives.LocationDirectives "FIELD" }} + {{ if $useFunctionSyntaxForExecutionContext -}} + func _fieldMiddleware(ctx context.Context, ec *executionContext, obj interface{}, next graphql.Resolver) interface{} { + {{- else -}} func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { + {{- end }} {{- if .Directives.LocationDirectives "FIELD" }} fc := graphql.GetFieldContext(ctx) for _, d := range fc.Field.Directives { @@ -131,7 +168,11 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as case "{{$directive.Name}}": {{- if $directive.Args }} rawArgs := d.ArgumentMap(ec.Variables) + {{ if $useFunctionSyntaxForExecutionContext -}} + args, err := {{ $directive.ArgsFunc }}(ctx,ec,rawArgs) + {{- else -}} args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + {{- end }} if err != nil { ec.Error(ctx, err) return nil diff --git a/codegen/field.gotpl b/codegen/field.gotpl index 4bf5c13d5a0..470139d87fe 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -1,11 +1,21 @@ +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + {{- range $object := .Objects }}{{- range $field := $object.Fields }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func _{{$object.Name}}_{{$field.Name}}(ctx context.Context, ec *executionContext, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) (ret {{ if $object.Stream }}func(ctx context.Context){{ end }}graphql.Marshaler) { +{{- else -}} func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) (ret {{ if $object.Stream }}func(ctx context.Context){{ end }}graphql.Marshaler) { +{{- end }} {{- $null := "graphql.Null" }} {{- if $object.Stream }} {{- $null = "nil" }} {{- end }} + {{ if $useFunctionSyntaxForExecutionContext -}} + fc, err := {{ $field.FieldContextFunc }}(ctx, ec, field) + {{- else -}} fc, err := ec.{{ $field.FieldContextFunc }}(ctx, field) + {{- end }} if err != nil { return {{ $null }} } @@ -25,15 +35,23 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex res := {{ $field.TypeReference.GO | ref }}{} {{- end }} fc.Result = res + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $field.TypeReference.MarshalFunc }}(ctx, ec, field.Selections, res) + {{- else -}} return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res) + {{- end }} {{- else}} {{- if $.AllDirectives.LocationDirectives "FIELD" }} + {{ if $useFunctionSyntaxForExecutionContext -}} + resTmp := _fieldMiddleware(ctx, ec, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { + {{- else -}} resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { - {{ template "field" $field }} + {{- end }} + {{ template "field" (dict "Field" $field "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} }) {{ else }} resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - {{ template "field" $field }} + {{ template "field" (dict "Field" $field "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} }) if err != nil { ec.Error(ctx, err) @@ -59,7 +77,11 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex w.Write([]byte{'{'}) graphql.MarshalString(field.Alias).MarshalGQL(w) w.Write([]byte{':'}) + {{ if $useFunctionSyntaxForExecutionContext -}} + {{ $field.TypeReference.MarshalFunc }}(ctx, ec, field.Selections, res).MarshalGQL(w) + {{- else -}} ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res).MarshalGQL(w) + {{- end }} w.Write([]byte{'}'}) }) case <-ctx.Done(): @@ -69,12 +91,20 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- else }} res := resTmp.({{$field.TypeReference.GO | ref}}) fc.Result = res + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $field.TypeReference.MarshalFunc }}(ctx, ec, field.Selections, res) + {{- else -}} return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res) + {{- end }} {{- end }} {{- end }} } +{{ if $useFunctionSyntaxForExecutionContext -}} +func {{ $field.FieldContextFunc }}({{ if not $field.Args }}_{{ else }}ctx{{ end }} context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +{{- else -}} func (ec *executionContext) {{ $field.FieldContextFunc }}({{ if not $field.Args }}_{{ else }}ctx{{ end }} context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +{{- end }} fc = &graphql.FieldContext{ Object: {{quote $field.Object.Name}}, Field: field, @@ -89,7 +119,11 @@ func (ec *executionContext) {{ $field.FieldContextFunc }}({{ if not $field.Args switch field.Name { {{- range $f := $field.TypeReference.Definition.Fields }} case "{{ $f.Name }}": + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $field.ChildFieldContextFunc $f.Name }}(ctx, ec, field) + {{- else -}} return ec.{{ $field.ChildFieldContextFunc $f.Name }}(ctx, field) + {{- end }} {{- end }} } return nil, fmt.Errorf("no field named %q was found under type {{ $field.TypeReference.Definition.Name }}", field.Name) @@ -106,7 +140,11 @@ func (ec *executionContext) {{ $field.FieldContextFunc }}({{ if not $field.Args }() {{- end }} ctx = graphql.WithFieldContext(ctx, fc) + {{ if $useFunctionSyntaxForExecutionContext -}} + if fc.Args, err = {{ $field.ArgsFunc }}(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + {{- else -}} if fc.Args, err = ec.{{ $field.ArgsFunc }}(ctx, field.ArgumentMap(ec.Variables)); err != nil { + {{- end }} ec.Error(ctx, err) return fc, err } @@ -117,26 +155,27 @@ func (ec *executionContext) {{ $field.FieldContextFunc }}({{ if not $field.Args {{- end }}{{- end}} {{ define "field" }} - {{- if .HasDirectives -}} + {{- $useFunctionSyntaxForExecutionContext := .UseFunctionSyntaxForExecutionContext -}} + {{- if .Field.HasDirectives -}} directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - {{ template "fieldDefinition" . }} + {{ template "fieldDefinition" .Field }} } - {{ template "implDirectives" . }} - tmp, err := directive{{.ImplDirectives|len}}(rctx) + {{ template "implDirectives" (dict "Field" .Field "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} + tmp, err := directive{{.Field.ImplDirectives|len}}(rctx) if err != nil { return nil, graphql.ErrorOnPath(ctx, err) } if tmp == nil { return nil, nil } - if data, ok := tmp.({{if .Stream}}<-chan {{end}}{{ .TypeReference.GO | ref }}) ; ok { + if data, ok := tmp.({{if .Field.Stream}}<-chan {{end}}{{ .Field.TypeReference.GO | ref }}) ; ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be {{if .Stream}}<-chan {{end}}{{ .TypeReference.GO }}`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be {{if .Field.Stream}}<-chan {{end}}{{ .Field.TypeReference.GO }}`, tmp) {{- else -}} ctx = rctx // use context from middleware stack in children - {{ template "fieldDefinition" . }} + {{ template "fieldDefinition" .Field }} {{- end -}} {{ end }} diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 8638b1cf9a9..f631d02cfb1 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -16,6 +16,8 @@ {{ reserveImport "github.com/99designs/gqlgen/graphql" }} {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + {{ if eq .Config.Exec.Layout "single-file" }} // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { @@ -133,7 +135,11 @@ break } {{ if $field.Args }} + {{ if $useFunctionSyntaxForExecutionContext -}} + args, err := {{ $field.ArgsFunc }}(context.TODO(), &ec, rawArgs) + {{- else -}} args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) + {{- end }} if err != nil { return 0, false } @@ -156,7 +162,11 @@ inputUnmarshalMap := graphql.BuildUnmarshalerMap( {{- range $input := .Inputs -}} {{ if not $input.HasUnmarshal }} + {{ if $useFunctionSyntaxForExecutionContext -}} + unmarshalInput{{ $input.Name }}, + {{- else -}} ec.unmarshalInput{{ $input.Name }}, + {{- end }} {{- end }} {{- end }} ) @@ -171,11 +181,20 @@ first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "QUERY" -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data = _queryMiddleware(ctx, &ec, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return _{{.QueryRoot.Name}}(ctx, ec, opCtx.Operation.SelectionSet), nil + {{- else -}} data = ec._queryMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ return ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data = _{{.QueryRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet) + {{- else -}} data = ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet) + {{- end }} {{- end }} } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { @@ -207,11 +226,20 @@ first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "MUTATION" -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data := _mutationMiddleware(ctx, &ec, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return _{{.MutationRoot.Name}}(ctx, ec, opCtx.Operation.SelectionSet), nil + {{- else -}} data := ec._mutationMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ return ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data := _{{.MutationRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet) + {{- else -}} data := ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet) + {{- end }} {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) @@ -224,11 +252,20 @@ {{- if .SubscriptionRoot }} case ast.Subscription: {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + next := _subscriptionMiddleware(ctx, &ec, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return _{{.SubscriptionRoot.Name}}(ctx, ec, opCtx.Operation.SelectionSet),nil + {{- else -}} next := ec._subscriptionMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ return ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet),nil + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + next := _{{.SubscriptionRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet) + {{- else -}} next := ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet) + {{- end }} {{- end }} var buf bytes.Buffer diff --git a/codegen/input.gotpl b/codegen/input.gotpl index 1b91d8db863..23677a7a03e 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -1,10 +1,16 @@ +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + {{- range $input := .Inputs }} {{- if not .HasUnmarshal }} {{- $it := "it" }} {{- if .PointersInUnmarshalInput }} {{- $it = "&it" }} {{- end }} + {{ if $useFunctionSyntaxForExecutionContext -}} + func unmarshalInput{{ .Name }}(ctx context.Context, ec *executionContext, obj interface{}) ({{ if .PointersInUnmarshalInput }}*{{ end }}{{.Type | ref}}, error) { + {{- else -}} func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{ if .PointersInUnmarshalInput }}*{{ end }}{{.Type | ref}}, error) { + {{- end }} {{- if $input.IsMap }} it := make(map[string]interface{}, len(obj.(map[string]interface{}))) {{- else }} @@ -37,8 +43,12 @@ {{- end }} ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$field.Name|quote}})) {{- if $field.ImplDirectives }} + {{ if $useFunctionSyntaxForExecutionContext -}} + directive0 := func(ctx context.Context) (interface{}, error) { return {{ $field.TypeReference.UnmarshalFunc }}(ctx, ec, v) } + {{- else -}} directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } - {{ template "implDirectives" $field }} + {{- end }} + {{ template "implDirectives" (dict "Field" $field "UseFunctionSyntaxForExecutionContext" $useFunctionSyntaxForExecutionContext) }} tmp, err := directive{{$field.ImplDirectives|len}}(ctx) if err != nil { return {{$it}}, graphql.ErrorOnPath(ctx, err) @@ -71,7 +81,11 @@ } {{- else }} {{- if $field.IsResolver }} + {{ if $useFunctionSyntaxForExecutionContext -}} + data, err := {{ $field.TypeReference.UnmarshalFunc }}(ctx, ec, v) + {{- else -}} data, err := ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) + {{- end }} if err != nil { return {{$it}}, err } @@ -79,7 +93,11 @@ return {{$it}}, err } {{- else }} + {{ if $useFunctionSyntaxForExecutionContext -}} + data, err := {{ $field.TypeReference.UnmarshalFunc }}(ctx, ec, v) + {{- else -}} data, err := ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) + {{- end }} if err != nil { return {{$it}}, err } diff --git a/codegen/interface.gotpl b/codegen/interface.gotpl index e9d560c8f64..ee975a51ab3 100644 --- a/codegen/interface.gotpl +++ b/codegen/interface.gotpl @@ -1,6 +1,12 @@ +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + {{- range $interface := .Interfaces }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func _{{$interface.Name}}(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj {{$interface.Type | ref}}) graphql.Marshaler { +{{- else -}} func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj {{$interface.Type | ref}}) graphql.Marshaler { +{{- end }} switch obj := (obj).(type) { case nil: return graphql.Null @@ -11,7 +17,11 @@ func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.Se return graphql.Null } {{- end }} + {{ if $useFunctionSyntaxForExecutionContext -}} + return _{{$implementor.Name}}(ctx, ec, sel, {{ if $implementor.TakeRef }}&{{ end }}obj) + {{- else -}} return ec._{{$implementor.Name}}(ctx, sel, {{ if $implementor.TakeRef }}&{{ end }}obj) + {{- end }} {{- end }} default: panic(fmt.Errorf("unexpected type %T", obj)) diff --git a/codegen/object.gotpl b/codegen/object.gotpl index 09689a27240..f42d3574380 100644 --- a/codegen/object.gotpl +++ b/codegen/object.gotpl @@ -1,9 +1,15 @@ +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + {{- range $object := .Objects }} var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}} {{- if .Stream }} +{{ if $useFunctionSyntaxForExecutionContext -}} +func _{{$object.Name}}(ctx context.Context, ec *executionContext, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler { +{{- else -}} func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler { +{{- end }} fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: {{$object.Name|quote}}, @@ -16,14 +22,23 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec switch fields[0].Name { {{- range $field := $object.Fields }} case "{{$field.Name}}": + {{ if $useFunctionSyntaxForExecutionContext -}} + return _{{$object.Name}}_{{$field.Name}}(ctx, ec, fields[0]) + {{- else -}} return ec._{{$object.Name}}_{{$field.Name}}(ctx, fields[0]) + {{- end }} {{- end }} default: panic("unknown field " + strconv.Quote(fields[0].Name)) } } {{- else }} + +{{ if $useFunctionSyntaxForExecutionContext -}} +func _{{$object.Name}}(ctx context.Context, ec *executionContext, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler { +{{- else -}} func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler { +{{- end }} fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) {{- if $object.Root }} ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ @@ -56,7 +71,11 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec } }() {{- end }} + {{ if $useFunctionSyntaxForExecutionContext -}} + res = _{{$object.Name}}_{{$field.Name}}(ctx, ec, field{{if not $object.Root}}, obj{{end}}) + {{- else -}} res = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}}) + {{- end }} {{- if $field.TypeReference.GQL.NonNull }} if res == graphql.Null { {{- if $object.IsConcurrent }} @@ -107,10 +126,18 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec {{- else }} {{- if $object.Root -}} out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + {{ if $useFunctionSyntaxForExecutionContext -}} + return _{{$object.Name}}_{{$field.Name}}(ctx, ec, field) + {{- else -}} return ec._{{$object.Name}}_{{$field.Name}}(ctx, field) + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + out.Values[i] = _{{$object.Name}}_{{$field.Name}}(ctx, ec, field, obj) + {{- else -}} out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field, obj) + {{- end }} {{- end -}} {{- if $field.TypeReference.GQL.NonNull }} diff --git a/codegen/root_.gotpl b/codegen/root_.gotpl index 91882647f9a..70e25c381f1 100644 --- a/codegen/root_.gotpl +++ b/codegen/root_.gotpl @@ -15,6 +15,8 @@ {{ reserveImport "github.com/99designs/gqlgen/graphql" }} {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} + // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ @@ -105,7 +107,11 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } {{ if $field.Args }} + {{ if $useFunctionSyntaxForExecutionContext -}} + args, err := {{ $field.ArgsFunc }}(context.TODO(), &ec, rawArgs) + {{- else -}} args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) + {{- end }} if err != nil { return 0, false } @@ -128,7 +134,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { inputUnmarshalMap := graphql.BuildUnmarshalerMap( {{- range $input := .Inputs -}} {{ if not $input.HasUnmarshal }} + {{ if $useFunctionSyntaxForExecutionContext -}} + unmarshalInput{{ $input.Name }}, + {{- else -}} ec.unmarshalInput{{ $input.Name }}, + {{- end }} {{- end }} {{- end }} ) @@ -143,11 +153,20 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "QUERY" -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data = _queryMiddleware(ctx, ec, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return _{{.QueryRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet), nil + {{- else -}} data = ec._queryMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ return ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data = _{{.QueryRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet) + {{- else -}} data = ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet) + {{- end }} {{- end }} } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { @@ -179,11 +198,20 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "MUTATION" -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data := _mutationMiddleware(ctx, &ec, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return _{{.MutationRoot.Name}}(ctx, ec, opCtx.Operation.SelectionSet), nil + {{- else -}} data := ec._mutationMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ return ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + data := _{{.MutationRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet) + {{- else -}} data := ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet) + {{- end }} {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) @@ -196,11 +224,20 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { {{- if .SubscriptionRoot }} case ast.Subscription: {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + next := _subscriptionMiddleware(ctx, &ec, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return _{{.SubscriptionRoot.Name}}(ctx, ec, opCtx.Operation.SelectionSet),nil + {{- else -}} next := ec._subscriptionMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ return ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet),nil + {{- end }} }) {{- else -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + next := _{{.SubscriptionRoot.Name}}(ctx, &ec, opCtx.Operation.SelectionSet) + {{- else -}} next := ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet) + {{- end }} {{- end }} var buf bytes.Buffer diff --git a/codegen/templates/templates.go b/codegen/templates/templates.go index 9b6e4cfb1e6..23468d20459 100644 --- a/codegen/templates/templates.go +++ b/codegen/templates/templates.go @@ -205,6 +205,7 @@ func Funcs() template.FuncMap { "obj": obj, "ts": TypeIdentifier, "call": Call, + "dict": dict, "prefixLines": prefixLines, "notNil": notNil, "strSplit": StrSplit, @@ -274,6 +275,21 @@ func Call(p *types.Func) string { return pkg + p.Name() } +func dict(values ...any) (map[string]any, error) { + if len(values)%2 != 0 { + return nil, errors.New("invalid dict call: arguments must be key-value pairs") + } + m := make(map[string]any, len(values)/2) + for i := 0; i < len(values); i += 2 { + key, ok := values[i].(string) + if !ok { + return nil, errors.New("dict keys must be strings") + } + m[key] = values[i+1] + } + return m, nil +} + func resetModelNames() { modelNamesMu.Lock() defer modelNamesMu.Unlock() diff --git a/codegen/templates/templates_test.go b/codegen/templates/templates_test.go index c282f01ec53..32aabe92fe7 100644 --- a/codegen/templates/templates_test.go +++ b/codegen/templates/templates_test.go @@ -362,3 +362,49 @@ func TestRenderFS(t *testing.T) { // don't look at last character since it's \n on Linux and \r\n on Windows assert.Equal(t, expectedString, actualContentsStr[:len(expectedString)]) } + +func TestDict(t *testing.T) { + tests := []struct { + name string + input []any + expected map[string]any + expectErr bool + }{ + { + name: "valid key-value pairs", + input: []any{"key1", "value1", "key2", "value2"}, + expected: map[string]any{"key1": "value1", "key2": "value2"}, + expectErr: false, + }, + { + name: "odd number of arguments", + input: []any{"key1", "value1", "key2"}, + expected: nil, + expectErr: true, + }, + { + name: "non-string key", + input: []any{"key1", "value1", 123, "value2"}, + expected: nil, + expectErr: true, + }, + { + name: "empty input", + input: []any{}, + expected: map[string]any{}, + expectErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result, err := dict(tt.input...) + if tt.expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + assert.Equal(t, tt.expected, result) + } + }) + } +} diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/directive.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/directive.go new file mode 100644 index 00000000000..45f91911a37 --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/directive.go @@ -0,0 +1,16 @@ +package usefunctionsyntaxforexecutioncontext + +import ( + "context" + "log" + + "github.com/99designs/gqlgen/graphql" +) + +// LogDirective implementation +func LogDirective(ctx context.Context, obj any, next graphql.Resolver, message *string) (res any, err error) { + log.Printf("Log Directive: %s", *message) + + // Proceed with the next resolver in the chain + return next(ctx) +} diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated.go new file mode 100644 index 00000000000..c427f290465 --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated.go @@ -0,0 +1,5291 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package usefunctionsyntaxforexecutioncontext + +import ( + "bytes" + "context" + "embed" + "errors" + "fmt" + "io" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Mutation() MutationResolver + Query() QueryResolver + Subscription() SubscriptionResolver +} + +type DirectiveRoot struct { + Log func(ctx context.Context, obj interface{}, next graphql.Resolver, message *string) (res interface{}, err error) +} + +type ComplexityRoot struct { + Admin struct { + CreatedAt func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Permissions func(childComplexity int) int + } + + Mutation struct { + CreateUser func(childComplexity int, input CreateUserInput) int + DeleteUser func(childComplexity int, id string) int + } + + MutationResponse struct { + Message func(childComplexity int) int + Success func(childComplexity int) int + } + + Query struct { + GetEntity func(childComplexity int, id string) int + GetUser func(childComplexity int, id string) int + ListUsers func(childComplexity int, filter *UserFilter) int + } + + Subscription struct { + UserCreated func(childComplexity int) int + } + + User struct { + Age func(childComplexity int) int + CreatedAt func(childComplexity int) int + Email func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Role func(childComplexity int) int + } +} + +type MutationResolver interface { + CreateUser(ctx context.Context, input CreateUserInput) (*User, error) + DeleteUser(ctx context.Context, id string) (*MutationResponse, error) +} +type QueryResolver interface { + GetUser(ctx context.Context, id string) (*User, error) + ListUsers(ctx context.Context, filter *UserFilter) ([]*User, error) + GetEntity(ctx context.Context, id string) (Entity, error) +} +type SubscriptionResolver interface { + UserCreated(ctx context.Context) (<-chan *User, error) +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "Admin.createdAt": + if e.complexity.Admin.CreatedAt == nil { + break + } + + return e.complexity.Admin.CreatedAt(childComplexity), true + + case "Admin.id": + if e.complexity.Admin.ID == nil { + break + } + + return e.complexity.Admin.ID(childComplexity), true + + case "Admin.name": + if e.complexity.Admin.Name == nil { + break + } + + return e.complexity.Admin.Name(childComplexity), true + + case "Admin.permissions": + if e.complexity.Admin.Permissions == nil { + break + } + + return e.complexity.Admin.Permissions(childComplexity), true + + case "Mutation.createUser": + if e.complexity.Mutation.CreateUser == nil { + break + } + + args, err := field_Mutation_createUser_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateUser(childComplexity, args["input"].(CreateUserInput)), true + + case "Mutation.deleteUser": + if e.complexity.Mutation.DeleteUser == nil { + break + } + + args, err := field_Mutation_deleteUser_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteUser(childComplexity, args["id"].(string)), true + + case "MutationResponse.message": + if e.complexity.MutationResponse.Message == nil { + break + } + + return e.complexity.MutationResponse.Message(childComplexity), true + + case "MutationResponse.success": + if e.complexity.MutationResponse.Success == nil { + break + } + + return e.complexity.MutationResponse.Success(childComplexity), true + + case "Query.getEntity": + if e.complexity.Query.GetEntity == nil { + break + } + + args, err := field_Query_getEntity_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetEntity(childComplexity, args["id"].(string)), true + + case "Query.getUser": + if e.complexity.Query.GetUser == nil { + break + } + + args, err := field_Query_getUser_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetUser(childComplexity, args["id"].(string)), true + + case "Query.listUsers": + if e.complexity.Query.ListUsers == nil { + break + } + + args, err := field_Query_listUsers_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ListUsers(childComplexity, args["filter"].(*UserFilter)), true + + case "Subscription.userCreated": + if e.complexity.Subscription.UserCreated == nil { + break + } + + return e.complexity.Subscription.UserCreated(childComplexity), true + + case "User.age": + if e.complexity.User.Age == nil { + break + } + + return e.complexity.User.Age(childComplexity), true + + case "User.createdAt": + if e.complexity.User.CreatedAt == nil { + break + } + + return e.complexity.User.CreatedAt(childComplexity), true + + case "User.email": + if e.complexity.User.Email == nil { + break + } + + return e.complexity.User.Email(childComplexity), true + + case "User.id": + if e.complexity.User.ID == nil { + break + } + + return e.complexity.User.ID(childComplexity), true + + case "User.name": + if e.complexity.User.Name == nil { + break + } + + return e.complexity.User.Name(childComplexity), true + + case "User.role": + if e.complexity.User.Role == nil { + break + } + + return e.complexity.User.Role(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + unmarshalInputCreateUserInput, + unmarshalInputUserFilter, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = _Query(ctx, &ec, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := _Mutation(ctx, &ec, opCtx.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Subscription: + next := _Subscription(ctx, &ec, opCtx.Operation.SelectionSet) + + var buf bytes.Buffer + return func(ctx context.Context) *graphql.Response { + buf.Reset() + data := next(ctx) + + if data == nil { + return nil + } + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +//go:embed "test.graphql" +var sourcesFS embed.FS + +func sourceData(filename string) string { + data, err := sourcesFS.ReadFile(filename) + if err != nil { + panic(fmt.Sprintf("codegen problem: %s not available", filename)) + } + return string(data) +} + +var sources = []*ast.Source{ + {Name: "test.graphql", Input: sourceData("test.graphql"), BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func dir_log_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := dir_log_argsMessage(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["message"] = arg0 + return args, nil +} +func dir_log_argsMessage( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["message"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("message")) + if tmp, ok := rawArgs["message"]; ok { + return unmarshalOString2ᚖstring(ctx, ec, tmp) + } + + var zeroVal *string + return zeroVal, nil +} + +func field_Mutation_createUser_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Mutation_createUser_argsInput(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func field_Mutation_createUser_argsInput( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (CreateUserInput, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["input"] + if !ok { + var zeroVal CreateUserInput + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return unmarshalNCreateUserInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐCreateUserInput(ctx, ec, tmp) + } + + var zeroVal CreateUserInput + return zeroVal, nil +} + +func field_Mutation_deleteUser_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Mutation_deleteUser_argsID(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} +func field_Mutation_deleteUser_argsID( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return unmarshalNID2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Query___type_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Query___type_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Query___type_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Query_getEntity_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Query_getEntity_argsID(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} +func field_Query_getEntity_argsID( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return unmarshalNID2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Query_getUser_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Query_getUser_argsID(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["id"] = arg0 + return args, nil +} +func field_Query_getUser_argsID( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return unmarshalNID2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Query_listUsers_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Query_listUsers_argsFilter(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["filter"] = arg0 + return args, nil +} +func field_Query_listUsers_argsFilter( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (*UserFilter, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["filter"] + if !ok { + var zeroVal *UserFilter + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + if tmp, ok := rawArgs["filter"]; ok { + return unmarshalOUserFilter2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUserFilter(ctx, ec, tmp) + } + + var zeroVal *UserFilter + return zeroVal, nil +} + +func field___Type_enumValues_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field___Type_enumValues_argsIncludeDeprecated(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func field___Type_enumValues_argsIncludeDeprecated( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["includeDeprecated"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return unmarshalOBoolean2bool(ctx, ec, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +func field___Type_fields_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field___Type_fields_argsIncludeDeprecated(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func field___Type_fields_argsIncludeDeprecated( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["includeDeprecated"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return unmarshalOBoolean2bool(ctx, ec, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func _Admin_id(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *Admin) (ret graphql.Marshaler) { + fc, err := fieldContext_Admin_id(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNID2string(ctx, ec, field.Selections, res) +} + +func fieldContext_Admin_id(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func _Admin_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *Admin) (ret graphql.Marshaler) { + fc, err := fieldContext_Admin_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_Admin_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _Admin_permissions(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *Admin) (ret graphql.Marshaler) { + fc, err := fieldContext_Admin_permissions(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Permissions, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return marshalNString2ᚕstringᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext_Admin_permissions(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _Admin_createdAt(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *Admin) (ret graphql.Marshaler) { + fc, err := fieldContext_Admin_createdAt(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalODate2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext_Admin_createdAt(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func _Mutation_createUser(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Mutation_createUser(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateUser(rctx, fc.Args["input"].(CreateUserInput)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + message, err := unmarshalOString2ᚖstring(ctx, ec, "Creating a user") + if err != nil { + var zeroVal *User + return zeroVal, err + } + if ec.directives.Log == nil { + var zeroVal *User + return zeroVal, errors.New("directive log is not implemented") + } + return ec.directives.Log(ctx, nil, directive0, message) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*User); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext.User`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*User) + fc.Result = res + return marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx, ec, field.Selections, res) +} + +func fieldContext_Mutation_createUser(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return fieldContext_User_id(ctx, ec, field) + case "name": + return fieldContext_User_name(ctx, ec, field) + case "email": + return fieldContext_User_email(ctx, ec, field) + case "age": + return fieldContext_User_age(ctx, ec, field) + case "role": + return fieldContext_User_role(ctx, ec, field) + case "createdAt": + return fieldContext_User_createdAt(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Mutation_createUser_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Mutation_deleteUser(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Mutation_deleteUser(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUser(rctx, fc.Args["id"].(string)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + message, err := unmarshalOString2ᚖstring(ctx, ec, "Deleting a user") + if err != nil { + var zeroVal *MutationResponse + return zeroVal, err + } + if ec.directives.Log == nil { + var zeroVal *MutationResponse + return zeroVal, errors.New("directive log is not implemented") + } + return ec.directives.Log(ctx, nil, directive0, message) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*MutationResponse); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext.MutationResponse`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*MutationResponse) + fc.Result = res + return marshalNMutationResponse2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐMutationResponse(ctx, ec, field.Selections, res) +} + +func fieldContext_Mutation_deleteUser(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "success": + return fieldContext_MutationResponse_success(ctx, ec, field) + case "message": + return fieldContext_MutationResponse_message(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type MutationResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Mutation_deleteUser_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _MutationResponse_success(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *MutationResponse) (ret graphql.Marshaler) { + fc, err := fieldContext_MutationResponse_success(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext_MutationResponse_success(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MutationResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func _MutationResponse_message(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *MutationResponse) (ret graphql.Marshaler) { + fc, err := fieldContext_MutationResponse_message(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext_MutationResponse_message(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MutationResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _Query_getUser(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query_getUser(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetUser(rctx, fc.Args["id"].(string)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + message, err := unmarshalOString2ᚖstring(ctx, ec, "Fetching a user") + if err != nil { + var zeroVal *User + return zeroVal, err + } + if ec.directives.Log == nil { + var zeroVal *User + return zeroVal, errors.New("directive log is not implemented") + } + return ec.directives.Log(ctx, nil, directive0, message) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*User); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext.User`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*User) + fc.Result = res + return marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx, ec, field.Selections, res) +} + +func fieldContext_Query_getUser(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return fieldContext_User_id(ctx, ec, field) + case "name": + return fieldContext_User_name(ctx, ec, field) + case "email": + return fieldContext_User_email(ctx, ec, field) + case "age": + return fieldContext_User_age(ctx, ec, field) + case "role": + return fieldContext_User_role(ctx, ec, field) + case "createdAt": + return fieldContext_User_createdAt(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Query_getUser_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Query_listUsers(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query_listUsers(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ListUsers(rctx, fc.Args["filter"].(*UserFilter)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + message, err := unmarshalOString2ᚖstring(ctx, ec, "Listing users") + if err != nil { + var zeroVal []*User + return zeroVal, err + } + if ec.directives.Log == nil { + var zeroVal []*User + return zeroVal, errors.New("directive log is not implemented") + } + return ec.directives.Log(ctx, nil, directive0, message) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.([]*User); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext.User`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*User) + fc.Result = res + return marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUserᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext_Query_listUsers(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return fieldContext_User_id(ctx, ec, field) + case "name": + return fieldContext_User_name(ctx, ec, field) + case "email": + return fieldContext_User_email(ctx, ec, field) + case "age": + return fieldContext_User_age(ctx, ec, field) + case "role": + return fieldContext_User_role(ctx, ec, field) + case "createdAt": + return fieldContext_User_createdAt(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Query_listUsers_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Query_getEntity(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query_getEntity(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetEntity(rctx, fc.Args["id"].(string)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + message, err := unmarshalOString2ᚖstring(ctx, ec, "Fetching an entity") + if err != nil { + var zeroVal Entity + return zeroVal, err + } + if ec.directives.Log == nil { + var zeroVal Entity + return zeroVal, errors.New("directive log is not implemented") + } + return ec.directives.Log(ctx, nil, directive0, message) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(Entity); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext.Entity`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(Entity) + fc.Result = res + return marshalOEntity2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐEntity(ctx, ec, field.Selections, res) +} + +func fieldContext_Query_getEntity(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Query_getEntity_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Query___type(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query___type(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext_Query___type(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Query___type_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Query___schema(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query___schema(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, ec, field.Selections, res) +} + +func fieldContext_Query___schema(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return fieldContext___Schema_description(ctx, ec, field) + case "types": + return fieldContext___Schema_types(ctx, ec, field) + case "queryType": + return fieldContext___Schema_queryType(ctx, ec, field) + case "mutationType": + return fieldContext___Schema_mutationType(ctx, ec, field) + case "subscriptionType": + return fieldContext___Schema_subscriptionType(ctx, ec, field) + case "directives": + return fieldContext___Schema_directives(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func _Subscription_userCreated(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := fieldContext_Subscription_userCreated(ctx, ec, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserCreated(rctx) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + message, err := unmarshalOString2ᚖstring(ctx, ec, "User created subscription") + if err != nil { + var zeroVal *User + return zeroVal, err + } + if ec.directives.Log == nil { + var zeroVal *User + return zeroVal, errors.New("directive log is not implemented") + } + return ec.directives.Log(ctx, nil, directive0, message) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(<-chan *User); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be <-chan *github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext.User`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *User): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx, ec, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func fieldContext_Subscription_userCreated(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return fieldContext_User_id(ctx, ec, field) + case "name": + return fieldContext_User_name(ctx, ec, field) + case "email": + return fieldContext_User_email(ctx, ec, field) + case "age": + return fieldContext_User_age(ctx, ec, field) + case "role": + return fieldContext_User_role(ctx, ec, field) + case "createdAt": + return fieldContext_User_createdAt(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func _User_id(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { + fc, err := fieldContext_User_id(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNID2string(ctx, ec, field.Selections, res) +} + +func fieldContext_User_id(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func _User_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { + fc, err := fieldContext_User_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_User_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _User_email(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { + fc, err := fieldContext_User_email(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Email, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_User_email(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _User_age(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { + fc, err := fieldContext_User_age(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Age, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return marshalOInt2ᚖint(ctx, ec, field.Selections, res) +} + +func fieldContext_User_age(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _User_role(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { + fc, err := fieldContext_User_role(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Role, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(Role) + fc.Result = res + return marshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx, ec, field.Selections, res) +} + +func fieldContext_User_role(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Role does not have child fields") + }, + } + return fc, nil +} + +func _User_createdAt(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { + fc, err := fieldContext_User_createdAt(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalODate2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext_User_createdAt(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Date does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_locations(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_locations(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return marshalN__DirectiveLocation2ᚕstringᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_locations(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_args(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_args(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_args(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___InputValue_name(ctx, ec, field) + case "description": + return fieldContext___InputValue_description(ctx, ec, field) + case "type": + return fieldContext___InputValue_type(ctx, ec, field) + case "defaultValue": + return fieldContext___InputValue_defaultValue(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func ___Directive_isRepeatable(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_isRepeatable(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_isRepeatable(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_isDeprecated(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_isDeprecated(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_isDeprecated(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_deprecationReason(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_deprecationReason(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_deprecationReason(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Field_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Field_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Field_args(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_args(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_args(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___InputValue_name(ctx, ec, field) + case "description": + return fieldContext___InputValue_description(ctx, ec, field) + case "type": + return fieldContext___InputValue_type(ctx, ec, field) + case "defaultValue": + return fieldContext___InputValue_defaultValue(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func ___Field_type(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_type(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_type(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Field_isDeprecated(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_isDeprecated(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_isDeprecated(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func ___Field_deprecationReason(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_deprecationReason(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_deprecationReason(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___InputValue_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___InputValue_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___InputValue_type(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_type(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_type(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___InputValue_defaultValue(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_defaultValue(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_defaultValue(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Schema_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Schema_types(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_types(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_types(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_queryType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_queryType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_queryType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_mutationType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_mutationType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_mutationType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_subscriptionType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_subscriptionType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_subscriptionType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_directives(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_directives(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_directives(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___Directive_name(ctx, ec, field) + case "description": + return fieldContext___Directive_description(ctx, ec, field) + case "locations": + return fieldContext___Directive_locations(ctx, ec, field) + case "args": + return fieldContext___Directive_args(ctx, ec, field) + case "isRepeatable": + return fieldContext___Directive_isRepeatable(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func ___Type_kind(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_kind(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalN__TypeKind2string(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_kind(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func ___Type_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Type_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Type_fields(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_fields(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_fields(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___Field_name(ctx, ec, field) + case "description": + return fieldContext___Field_description(ctx, ec, field) + case "args": + return fieldContext___Field_args(ctx, ec, field) + case "type": + return fieldContext___Field_type(ctx, ec, field) + case "isDeprecated": + return fieldContext___Field_isDeprecated(ctx, ec, field) + case "deprecationReason": + return fieldContext___Field_deprecationReason(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field___Type_fields_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func ___Type_interfaces(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_interfaces(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_interfaces(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Type_possibleTypes(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_possibleTypes(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_possibleTypes(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Type_enumValues(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_enumValues(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_enumValues(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___EnumValue_name(ctx, ec, field) + case "description": + return fieldContext___EnumValue_description(ctx, ec, field) + case "isDeprecated": + return fieldContext___EnumValue_isDeprecated(ctx, ec, field) + case "deprecationReason": + return fieldContext___EnumValue_deprecationReason(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field___Type_enumValues_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func ___Type_inputFields(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_inputFields(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_inputFields(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___InputValue_name(ctx, ec, field) + case "description": + return fieldContext___InputValue_description(ctx, ec, field) + case "type": + return fieldContext___InputValue_type(ctx, ec, field) + case "defaultValue": + return fieldContext___InputValue_defaultValue(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func ___Type_ofType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_ofType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_ofType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Type_specifiedByURL(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_specifiedByURL(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_specifiedByURL(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func unmarshalInputCreateUserInput(ctx context.Context, ec *executionContext, obj interface{}) (CreateUserInput, error) { + var it CreateUserInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["role"]; !present { + asMap["role"] = "USER" + } + + fieldsInOrder := [...]string{"name", "email", "age", "role"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Email = data + case "age": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("age")) + data, err := unmarshalOInt2ᚖint(ctx, ec, v) + if err != nil { + return it, err + } + it.Age = data + case "role": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("role")) + data, err := unmarshalORole2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx, ec, v) + if err != nil { + return it, err + } + it.Role = data + } + } + + return it, nil +} + +func unmarshalInputUserFilter(ctx context.Context, ec *executionContext, obj interface{}) (UserFilter, error) { + var it UserFilter + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + if _, present := asMap["isActive"]; !present { + asMap["isActive"] = true + } + + fieldsInOrder := [...]string{"name", "email", "age", "roles", "isActive"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := unmarshalOString2ᚖstring(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + case "email": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email")) + data, err := unmarshalOString2ᚖstring(ctx, ec, v) + if err != nil { + return it, err + } + it.Email = data + case "age": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("age")) + data, err := unmarshalOInt2ᚖint(ctx, ec, v) + if err != nil { + return it, err + } + it.Age = data + case "roles": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roles")) + data, err := unmarshalORole2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRoleᚄ(ctx, ec, v) + if err != nil { + return it, err + } + it.Roles = data + case "isActive": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isActive")) + data, err := unmarshalOBoolean2ᚖbool(ctx, ec, v) + if err != nil { + return it, err + } + it.IsActive = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func _Entity(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj Entity) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case User: + return _User(ctx, ec, sel, &obj) + case *User: + if obj == nil { + return graphql.Null + } + return _User(ctx, ec, sel, obj) + case Admin: + return _Admin(ctx, ec, sel, &obj) + case *Admin: + if obj == nil { + return graphql.Null + } + return _Admin(ctx, ec, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var adminImplementors = []string{"Admin", "Entity"} + +func _Admin(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *Admin) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, adminImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Admin") + case "id": + out.Values[i] = _Admin_id(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = _Admin_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "permissions": + out.Values[i] = _Admin_permissions(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = _Admin_createdAt(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var mutationImplementors = []string{"Mutation"} + +func _Mutation(ctx context.Context, ec *executionContext, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "createUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return _Mutation_createUser(ctx, ec, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return _Mutation_deleteUser(ctx, ec, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var mutationResponseImplementors = []string{"MutationResponse"} + +func _MutationResponse(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *MutationResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MutationResponse") + case "success": + out.Values[i] = _MutationResponse_success(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = _MutationResponse_message(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var queryImplementors = []string{"Query"} + +func _Query(ctx context.Context, ec *executionContext, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "getUser": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Query_getUser(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "listUsers": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Query_listUsers(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getEntity": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Query_getEntity(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return _Query___type(ctx, ec, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return _Query___schema(ctx, ec, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var subscriptionImplementors = []string{"Subscription"} + +func _Subscription(ctx context.Context, ec *executionContext, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Subscription", + }) + if len(fields) != 1 { + ec.Errorf(ctx, "must subscribe to exactly one stream") + return nil + } + + switch fields[0].Name { + case "userCreated": + return _Subscription_userCreated(ctx, ec, fields[0]) + default: + panic("unknown field " + strconv.Quote(fields[0].Name)) + } +} + +var userImplementors = []string{"User", "Entity"} + +func _User(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *User) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("User") + case "id": + out.Values[i] = _User_id(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = _User_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "email": + out.Values[i] = _User_email(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "age": + out.Values[i] = _User_age(ctx, ec, field, obj) + case "role": + out.Values[i] = _User_role(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = _User_createdAt(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func ___Directive(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ___Directive_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___Directive_description(ctx, ec, field, obj) + case "locations": + out.Values[i] = ___Directive_locations(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ___Directive_args(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRepeatable": + out.Values[i] = ___Directive_isRepeatable(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func ___EnumValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ___EnumValue_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___EnumValue_description(ctx, ec, field, obj) + case "isDeprecated": + out.Values[i] = ___EnumValue_isDeprecated(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ___EnumValue_deprecationReason(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func ___Field(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ___Field_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___Field_description(ctx, ec, field, obj) + case "args": + out.Values[i] = ___Field_args(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ___Field_type(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ___Field_isDeprecated(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ___Field_deprecationReason(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func ___InputValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ___InputValue_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___InputValue_description(ctx, ec, field, obj) + case "type": + out.Values[i] = ___InputValue_type(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ___InputValue_defaultValue(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func ___Schema(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ___Schema_description(ctx, ec, field, obj) + case "types": + out.Values[i] = ___Schema_types(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ___Schema_queryType(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ___Schema_mutationType(ctx, ec, field, obj) + case "subscriptionType": + out.Values[i] = ___Schema_subscriptionType(ctx, ec, field, obj) + case "directives": + out.Values[i] = ___Schema_directives(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func ___Type(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ___Type_kind(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ___Type_name(ctx, ec, field, obj) + case "description": + out.Values[i] = ___Type_description(ctx, ec, field, obj) + case "fields": + out.Values[i] = ___Type_fields(ctx, ec, field, obj) + case "interfaces": + out.Values[i] = ___Type_interfaces(ctx, ec, field, obj) + case "possibleTypes": + out.Values[i] = ___Type_possibleTypes(ctx, ec, field, obj) + case "enumValues": + out.Values[i] = ___Type_enumValues(ctx, ec, field, obj) + case "inputFields": + out.Values[i] = ___Type_inputFields(ctx, ec, field, obj) + case "ofType": + out.Values[i] = ___Type_ofType(ctx, ec, field, obj) + case "specifiedByURL": + out.Values[i] = ___Type_specifiedByURL(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func unmarshalNBoolean2bool(ctx context.Context, ec *executionContext, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNBoolean2bool(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalNCreateUserInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐCreateUserInput(ctx context.Context, ec *executionContext, v interface{}) (CreateUserInput, error) { + res, err := unmarshalInputCreateUserInput(ctx, ec, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func unmarshalNID2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalID(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNID2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalID(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func marshalNMutationResponse2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐMutationResponse(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v MutationResponse) graphql.Marshaler { + return _MutationResponse(ctx, ec, sel, &v) +} + +func marshalNMutationResponse2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐMutationResponse(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *MutationResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _MutationResponse(ctx, ec, sel, v) +} + +func unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx context.Context, ec *executionContext, v interface{}) (Role, error) { + var res Role + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v Role) graphql.Marshaler { + return v +} + +func unmarshalNString2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNString2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalNString2ᚕstringᚄ(ctx context.Context, ec *executionContext, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalNString2string(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func marshalNString2ᚕstringᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = marshalNString2string(ctx, ec, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalNUser2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v User) graphql.Marshaler { + return _User(ctx, ec, sel, &v) +} + +func marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUserᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []*User) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *User) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _User(ctx, ec, sel, v) +} + +func marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ___Directive(ctx, ec, sel, &v) +} + +func marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func unmarshalN__DirectiveLocation2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalN__DirectiveLocation2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, ec *executionContext, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalN__DirectiveLocation2string(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__DirectiveLocation2string(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ___EnumValue(ctx, ec, sel, &v) +} + +func marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ___Field(ctx, ec, sel, &v) +} + +func marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ___InputValue(ctx, ec, sel, &v) +} + +func marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ___Type(ctx, ec, sel, &v) +} + +func marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ___Type(ctx, ec, sel, v) +} + +func unmarshalN__TypeKind2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalN__TypeKind2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalOBoolean2bool(ctx context.Context, ec *executionContext, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOBoolean2bool(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + return res +} + +func unmarshalOBoolean2ᚖbool(ctx context.Context, ec *executionContext, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOBoolean2ᚖbool(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalBoolean(*v) + return res +} + +func unmarshalODate2ᚖstring(ctx context.Context, ec *executionContext, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalODate2ᚖstring(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func marshalOEntity2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐEntity(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v Entity) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _Entity(ctx, ec, sel, v) +} + +func unmarshalOInt2ᚖint(ctx context.Context, ec *executionContext, v interface{}) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOInt2ᚖint(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalInt(*v) + return res +} + +func unmarshalORole2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRoleᚄ(ctx context.Context, ec *executionContext, v interface{}) ([]Role, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]Role, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func marshalORole2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRoleᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []Role) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func unmarshalORole2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx context.Context, ec *executionContext, v interface{}) (*Role, error) { + if v == nil { + return nil, nil + } + var res = new(Role) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalORole2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐRole(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *Role) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func unmarshalOString2ᚖstring(ctx context.Context, ec *executionContext, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOString2ᚖstring(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUser(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *User) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _User(ctx, ec, sel, v) +} + +func unmarshalOUserFilter2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋusefunctionsyntaxforexecutioncontextᚐUserFilter(ctx context.Context, ec *executionContext, v interface{}) (*UserFilter, error) { + if v == nil { + return nil, nil + } + res, err := unmarshalInputUserFilter(ctx, ec, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ___Schema(ctx, ec, sel, v) +} + +func marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ___Type(ctx, ec, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go new file mode 100644 index 00000000000..c25e9353ee9 --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go @@ -0,0 +1,297 @@ +//go:generate rm -f resolver.go +//go:generate go run ../../../testdata/gqlgen.go -config gqlgen.yml -stub stub.go + +package usefunctionsyntaxforexecutioncontext + +import ( + "context" + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" +) + +func TestQuery(t *testing.T) { + resolvers := &Stub{} + srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + Resolvers: resolvers, + Directives: DirectiveRoot{ + Log: LogDirective, + }, + })) + c := client.New(srv) + + testAge := new(int) + createdAt := "2021-01-01" + resolvers.QueryResolver.GetUser = func(ctx context.Context, id string) (*User, error) { + return &User{ + ID: id, + Name: "test", + Email: "testEmail", + Age: testAge, + Role: "ADMIN", + CreatedAt: &createdAt, + }, nil + } + + resolvers.QueryResolver.ListUsers = func(ctx context.Context, filter *UserFilter) ([]*User, error) { + return []*User{ + { + ID: "1", + Name: "test1", + Email: "testEmail", + Age: testAge, + Role: "ADMIN", + CreatedAt: &createdAt, + }, + { + ID: "2", + Name: "test2", + Email: "testEmail", + Age: testAge, + Role: "ADMIN", + CreatedAt: &createdAt, + }, + }, nil + } + + expectedJsonResp := ` + { + "getUser": { + "id": "1", + "name": "test", + "email": "testEmail", + "age": 0, + "role": "ADMIN", + "createdAt": "2021-01-01" + }, + "listUsers": [ + { + "id": "1", + "name": "test1", + "email": "testEmail", + "age": 0, + "role": "ADMIN", + "createdAt": "2021-01-01" + }, + { + "id": "2", + "name": "test2", + "email": "testEmail", + "age": 0, + "role": "ADMIN", + "createdAt": "2021-01-01" + } + ] + } + ` + + t.Run("test query", func(t *testing.T) { + var resp struct { + GetUser struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + Age *int `json:"age"` + Role string `json:"role"` + CreatedAt string `json:"createdAt"` + } `json:"getUser"` + + ListUsers []struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + Age *int `json:"age"` + Role string `json:"role"` + CreatedAt string `json:"createdAt"` + } `json:"listUsers"` + } + c.MustPost(`query TestQuery { + # Fetch a user by ID + getUser(id: "1") { + id + name + email + age + role + createdAt + } + + # List users with a filter + listUsers(filter: { isActive: true, roles: [ADMIN, USER] }) { + id + name + email + age + role + createdAt + } + } + `, &resp) + jsonResp, err := json.Marshal(resp) + require.NoError(t, err) + require.JSONEq(t, expectedJsonResp, string(jsonResp)) + }) +} + +func TestMutation(t *testing.T) { + resolvers := &Stub{} + srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + Resolvers: resolvers, + Directives: DirectiveRoot{ + Log: LogDirective, + }, + })) + c := client.New(srv) + + createdAt := "2021-01-01" + resolvers.MutationResolver.CreateUser = func(ctx context.Context, input CreateUserInput) (*User, error) { + return &User{ + ID: "1", + Name: input.Name, + Email: input.Email, + Age: input.Age, + Role: *input.Role, + CreatedAt: &createdAt, + }, nil + } + + message := "User deleted successfully" + resolvers.MutationResolver.DeleteUser = func(ctx context.Context, id string) (*MutationResponse, error) { + return &MutationResponse{ + Success: true, + Message: &message, + }, nil + } + + expectedJsonResp := ` + { + "createUser": { + "id": "1", + "name": "test", + "email": "testEmail", + "age": 0, + "role": "ADMIN", + "createdAt": "2021-01-01" + }, + "deleteUser": { + "success": true, + "message": "User deleted successfully" + } + } + ` + + t.Run("test mutation", func(t *testing.T) { + var resp struct { + CreateUser struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + Age *int `json:"age"` + Role string `json:"role"` + CreatedAt string `json:"createdAt"` + } `json:"createUser"` + + DeleteUser struct { + Success bool `json:"success"` + Message string `json:"message"` + } `json:"deleteUser"` + } + + c.MustPost(`mutation TestMutation { + createUser(input: { name: "test", email: "testEmail", age: 0, role: ADMIN }) { + id + name + email + age + role + createdAt + } + deleteUser(id: "1") { + success + message + } + }`, &resp) + + jsonResp, err := json.Marshal(resp) + require.NoError(t, err) + require.JSONEq(t, expectedJsonResp, string(jsonResp)) + }) +} + +func TestSubscription(t *testing.T) { + resolvers := &Stub{} + srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + Resolvers: resolvers, + Directives: DirectiveRoot{ + Log: LogDirective, + }, + })) + c := client.New(srv) + + createdAt := "2021-01-01" + resolvers.SubscriptionResolver.UserCreated = func(ctx context.Context) (<-chan *User, error) { + ch := make(chan *User, 1) + go func() { + defer close(ch) + ch <- &User{ + ID: "1", + Name: "testUser", + Email: "testEmail", + Age: nil, + Role: "ADMIN", + CreatedAt: &createdAt, + } + }() + return ch, nil + } + + t.Run("test subscription", func(t *testing.T) { + var resp struct { + UserCreated struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + Age *int `json:"age"` + Role string `json:"role"` + CreatedAt string `json:"createdAt"` + } `json:"userCreated"` + } + + expectedJsonResp := ` + { + "userCreated": { + "id": "1", + "name": "testUser", + "email": "testEmail", + "age": null, + "role": "ADMIN", + "createdAt": "2021-01-01" + } + } + ` + + sub := c.Websocket(`subscription TestSubscription { + userCreated { + id + name + email + age + role + createdAt + } + }`) + + defer sub.Close() + + err := sub.Next(&resp) + require.NoError(t, err) + + jsonResp, err := json.Marshal(resp) + require.NoError(t, err) + require.JSONEq(t, expectedJsonResp, string(jsonResp)) + }) +} diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/gqlgen.yml b/codegen/testserver/usefunctionsyntaxforexecutioncontext/gqlgen.yml new file mode 100644 index 00000000000..3284a0e9d88 --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/gqlgen.yml @@ -0,0 +1,24 @@ +schema: + - "*.graphql" +skip_validation: true +use_function_syntax_for_execution_context: true +exec: + filename: generated.go + package: usefunctionsyntaxforexecutioncontext +model: + filename: models-gen.go + package: usefunctionsyntaxforexecutioncontext +resolver: + filename: resolver.go + package: usefunctionsyntaxforexecutioncontext + type: Resolver + +autobind: + - "github.com/99designs/gqlgen/codegen/testserver" + - "github.com/99designs/gqlgen/codegen/testserver/usefunctionsyntaxforexecutioncontext" + +models: + Email: + model: "github.com/99designs/gqlgen/codegen/testserver/singlefile.Email" + StringFromContextFunction: + model: "github.com/99designs/gqlgen/codegen/testserver/singlefile.StringFromContextFunction" diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/models-gen.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/models-gen.go new file mode 100644 index 00000000000..f061898b51f --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/models-gen.go @@ -0,0 +1,111 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package usefunctionsyntaxforexecutioncontext + +import ( + "fmt" + "io" + "strconv" +) + +type Entity interface { + IsEntity() + GetID() string + GetCreatedAt() *string +} + +type Admin struct { + ID string `json:"id"` + Name string `json:"name"` + Permissions []string `json:"permissions"` + CreatedAt *string `json:"createdAt,omitempty"` +} + +func (Admin) IsEntity() {} +func (this Admin) GetID() string { return this.ID } +func (this Admin) GetCreatedAt() *string { return this.CreatedAt } + +type CreateUserInput struct { + Name string `json:"name"` + Email string `json:"email"` + Age *int `json:"age,omitempty"` + Role *Role `json:"role,omitempty"` +} + +type Mutation struct { +} + +type MutationResponse struct { + Success bool `json:"success"` + Message *string `json:"message,omitempty"` +} + +type Query struct { +} + +type Subscription struct { +} + +type User struct { + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + Age *int `json:"age,omitempty"` + Role Role `json:"role"` + CreatedAt *string `json:"createdAt,omitempty"` +} + +func (User) IsEntity() {} +func (this User) GetID() string { return this.ID } +func (this User) GetCreatedAt() *string { return this.CreatedAt } + +type UserFilter struct { + Name *string `json:"name,omitempty"` + Email *string `json:"email,omitempty"` + Age *int `json:"age,omitempty"` + Roles []Role `json:"roles,omitempty"` + IsActive *bool `json:"isActive,omitempty"` +} + +type Role string + +const ( + RoleAdmin Role = "ADMIN" + RoleUser Role = "USER" + RoleGuest Role = "GUEST" +) + +var AllRole = []Role{ + RoleAdmin, + RoleUser, + RoleGuest, +} + +func (e Role) IsValid() bool { + switch e { + case RoleAdmin, RoleUser, RoleGuest: + return true + } + return false +} + +func (e Role) String() string { + return string(e) +} + +func (e *Role) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Role(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Role", str) + } + return nil +} + +func (e Role) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/resolver.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/resolver.go new file mode 100644 index 00000000000..4cd5bae7b75 --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/resolver.go @@ -0,0 +1,52 @@ +package usefunctionsyntaxforexecutioncontext + +// THIS CODE WILL BE UPDATED WITH SCHEMA CHANGES. PREVIOUS IMPLEMENTATION FOR SCHEMA CHANGES WILL BE KEPT IN THE COMMENT SECTION. IMPLEMENTATION FOR UNCHANGED SCHEMA WILL BE KEPT. + +import ( + "context" +) + +type Resolver struct{} + +// CreateUser is the resolver for the createUser field. +func (r *mutationResolver) CreateUser(ctx context.Context, input CreateUserInput) (*User, error) { + panic("not implemented") +} + +// DeleteUser is the resolver for the deleteUser field. +func (r *mutationResolver) DeleteUser(ctx context.Context, id string) (*MutationResponse, error) { + panic("not implemented") +} + +// GetUser is the resolver for the getUser field. +func (r *queryResolver) GetUser(ctx context.Context, id string) (*User, error) { + panic("not implemented") +} + +// ListUsers is the resolver for the listUsers field. +func (r *queryResolver) ListUsers(ctx context.Context, filter *UserFilter) ([]*User, error) { + panic("not implemented") +} + +// GetEntity is the resolver for the getEntity field. +func (r *queryResolver) GetEntity(ctx context.Context, id string) (Entity, error) { + panic("not implemented") +} + +// UserCreated is the resolver for the userCreated field. +func (r *subscriptionResolver) UserCreated(ctx context.Context) (<-chan *User, error) { + panic("not implemented") +} + +// Mutation returns MutationResolver implementation. +func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } + +// Query returns QueryResolver implementation. +func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } + +// Subscription returns SubscriptionResolver implementation. +func (r *Resolver) Subscription() SubscriptionResolver { return &subscriptionResolver{r} } + +type mutationResolver struct{ *Resolver } +type queryResolver struct{ *Resolver } +type subscriptionResolver struct{ *Resolver } diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/stub.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/stub.go new file mode 100644 index 00000000000..3cae42bfe5c --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/stub.go @@ -0,0 +1,59 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package usefunctionsyntaxforexecutioncontext + +import ( + "context" +) + +type Stub struct { + MutationResolver struct { + CreateUser func(ctx context.Context, input CreateUserInput) (*User, error) + DeleteUser func(ctx context.Context, id string) (*MutationResponse, error) + } + QueryResolver struct { + GetUser func(ctx context.Context, id string) (*User, error) + ListUsers func(ctx context.Context, filter *UserFilter) ([]*User, error) + GetEntity func(ctx context.Context, id string) (Entity, error) + } + SubscriptionResolver struct { + UserCreated func(ctx context.Context) (<-chan *User, error) + } +} + +func (r *Stub) Mutation() MutationResolver { + return &stubMutation{r} +} +func (r *Stub) Query() QueryResolver { + return &stubQuery{r} +} +func (r *Stub) Subscription() SubscriptionResolver { + return &stubSubscription{r} +} + +type stubMutation struct{ *Stub } + +func (r *stubMutation) CreateUser(ctx context.Context, input CreateUserInput) (*User, error) { + return r.MutationResolver.CreateUser(ctx, input) +} +func (r *stubMutation) DeleteUser(ctx context.Context, id string) (*MutationResponse, error) { + return r.MutationResolver.DeleteUser(ctx, id) +} + +type stubQuery struct{ *Stub } + +func (r *stubQuery) GetUser(ctx context.Context, id string) (*User, error) { + return r.QueryResolver.GetUser(ctx, id) +} +func (r *stubQuery) ListUsers(ctx context.Context, filter *UserFilter) ([]*User, error) { + return r.QueryResolver.ListUsers(ctx, filter) +} +func (r *stubQuery) GetEntity(ctx context.Context, id string) (Entity, error) { + return r.QueryResolver.GetEntity(ctx, id) +} + +type stubSubscription struct{ *Stub } + +func (r *stubSubscription) UserCreated(ctx context.Context) (<-chan *User, error) { + return r.SubscriptionResolver.UserCreated(ctx) +} diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/test.graphql b/codegen/testserver/usefunctionsyntaxforexecutioncontext/test.graphql new file mode 100644 index 00000000000..8779ee08bc2 --- /dev/null +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/test.graphql @@ -0,0 +1,86 @@ +# Custom directive to log field access (limited to fields, not input fields) +directive @log(message: String) on FIELD_DEFINITION + +# Custom scalar for Date +scalar Date + +# Enum for user roles +enum Role { + ADMIN + USER + GUEST +} + +# Interface representing an Entity with common fields +interface Entity { + id: ID! + createdAt: Date +} + +# Input type for creating a user +input CreateUserInput { + name: String! + email: String! + age: Int + role: Role = USER +} + +# Input type with parameters for filtering users +input UserFilter { + name: String + email: String + age: Int + roles: [Role!] + isActive: Boolean = true +} + +# Type representing a user, implementing the Entity interface +type User implements Entity { + id: ID! + name: String! + email: String! + age: Int + role: Role! + createdAt: Date +} + +# Type representing an admin, implementing the Entity interface +type Admin implements Entity { + id: ID! + name: String! + permissions: [String!]! + createdAt: Date +} + +# Type for mutation result +type MutationResponse { + success: Boolean! + message: String +} + +# Root Query type +type Query { + # Fetch a user by ID + getUser(id: ID!): User @log(message: "Fetching a user") + + # List all users with optional filters + listUsers(filter: UserFilter): [User!]! @log(message: "Listing users") + + # Fetch an entity by ID (could be User or Admin) + getEntity(id: ID!): Entity @log(message: "Fetching an entity") +} + +# Root Mutation type +type Mutation { + # Create a new user + createUser(input: CreateUserInput!): User! @log(message: "Creating a user") + + # Delete a user by ID + deleteUser(id: ID!): MutationResponse! @log(message: "Deleting a user") +} + +# Root Subscription type +type Subscription { + # Subscription to notify when a user is created + userCreated: User! @log(message: "User created subscription") +} diff --git a/codegen/type.gotpl b/codegen/type.gotpl index aa143b1f22e..e4ebea50d38 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -1,11 +1,20 @@ +{{ $useFunctionSyntaxForExecutionContext := .Config.UseFunctionSyntaxForExecutionContext }} {{- range $type := .ReferencedTypes }} {{ with $type.UnmarshalFunc }} + {{ if $useFunctionSyntaxForExecutionContext -}} + func {{ . }}(ctx context.Context, ec *executionContext, v interface{}) ({{ $type.GO | ref }}, error) { + {{- else -}} func (ec *executionContext) {{ . }}(ctx context.Context, v interface{}) ({{ $type.GO | ref }}, error) { + {{- end -}} {{- if and $type.IsNilable (not $type.GQL.NonNull) (not $type.IsPtrToPtr) }} if v == nil { return nil, nil } {{- end }} {{- if or $type.IsPtrToSlice $type.IsPtrToIntf }} + {{ if $useFunctionSyntaxForExecutionContext -}} + res, err := {{ $type.Elem.UnmarshalFunc }}(ctx, ec, v) + {{- else -}} res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) + {{- end }} return &res, graphql.ErrorOnPath(ctx, err) {{- else if $type.IsSlice }} var vSlice []interface{} @@ -16,7 +25,11 @@ res := make([]{{$type.GO.Elem | ref}}, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + {{ if $useFunctionSyntaxForExecutionContext -}} + res[i], err = {{ $type.Elem.UnmarshalFunc }}(ctx, ec, vSlice[i]) + {{- else -}} res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i]) + {{- end }} if err != nil { return nil, err } @@ -25,7 +38,11 @@ {{- else if and $type.IsPtrToPtr (not $type.Unmarshaler) (not $type.IsMarshaler) }} var pres {{ $type.Elem.GO | ref }} if v != nil { + {{ if $useFunctionSyntaxForExecutionContext -}} + res, err := {{ $type.Elem.UnmarshalFunc }}(ctx, ec, v) + {{- else -}} res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) + {{- end }} if err != nil { return nil, graphql.ErrorOnPath(ctx, err) } @@ -75,7 +92,11 @@ {{- end }} return res, graphql.ErrorOnPath(ctx, err) {{- else }} + {{ if $useFunctionSyntaxForExecutionContext -}} + res, err := unmarshalInput{{ $type.GQL.Name }}(ctx, ec, v) + {{- else -}} res, err := ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v) + {{- end }} {{- if and $type.IsNilable (not $type.IsMap) (not $type.PointersInUnmarshalInput) }} return &res, graphql.ErrorOnPath(ctx, err) {{- else if and (not $type.IsNilable) $type.PointersInUnmarshalInput }} @@ -89,9 +110,17 @@ {{- end }} {{ with $type.MarshalFunc }} + {{ if $useFunctionSyntaxForExecutionContext -}} + func {{ . }}(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler { + {{- else -}} func (ec *executionContext) {{ . }}(ctx context.Context, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler { + {{- end -}} {{- if or $type.IsPtrToSlice $type.IsPtrToIntf }} + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $type.Elem.MarshalFunc }}(ctx, ec, sel, *v) + {{- else -}} return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v) + {{- end }} {{- else if $type.IsSlice }} {{- if not $type.GQL.NonNull }} if v == nil { @@ -136,7 +165,11 @@ defer wg.Done() {{- end }} } + {{ if $useFunctionSyntaxForExecutionContext -}} + ret[i] = {{ $type.Elem.MarshalFunc }}(ctx, ec, sel, v[i]) + {{- else -}} ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) + {{- end }} } if isLen1 { f(i) @@ -152,7 +185,11 @@ {{- end }} } {{ else }} + {{ if $useFunctionSyntaxForExecutionContext -}} + ret[i] = {{ $type.Elem.MarshalFunc }}(ctx, ec, sel, v[i]) + {{- else -}} ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) + {{- end }} {{- end }} } {{ if not $type.IsScalar }} wg.Wait() {{ end }} @@ -168,7 +205,11 @@ if v == nil { return graphql.Null } + {{ if $useFunctionSyntaxForExecutionContext -}} + return {{ $type.Elem.MarshalFunc }}(ctx, ec, sel, *v) + {{- else -}} return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v) + {{- end }} {{- else }} {{- if $type.IsNilable }} if v == nil { @@ -213,13 +254,25 @@ {{- end }} {{- else if $type.IsRoot }} {{- if eq $type.Definition.Name "Subscription" }} + {{ if $useFunctionSyntaxForExecutionContext -}} + res := _{{$type.Definition.Name}}(ctx, ec, sel) + {{- else -}} res := ec._{{$type.Definition.Name}}(ctx, sel) + {{- end }} return res(ctx) {{- else }} + {{ if $useFunctionSyntaxForExecutionContext -}} + return _{{$type.Definition.Name}}(ctx, ec, sel) + {{- else -}} return ec._{{$type.Definition.Name}}(ctx, sel) + {{- end }} {{- end }} {{- else }} + {{ if $useFunctionSyntaxForExecutionContext -}} + return _{{$type.Definition.Name}}(ctx, ec, sel, {{ if not $type.IsNilable}}&{{end}} v) + {{- else -}} return ec._{{$type.Definition.Name}}(ctx, sel, {{ if not $type.IsNilable}}&{{end}} v) + {{- end }} {{- end }} {{- end }} } diff --git a/docs/content/config.md b/docs/content/config.md index 07b580f2f2f..47a10e0d4c3 100644 --- a/docs/content/config.md +++ b/docs/content/config.md @@ -115,6 +115,10 @@ resolver: # argument values but to set them even if they're null. call_argument_directives_with_null: true +# This enables gql server to use function syntax for execution context +# instead of generating receiver methods of the execution context. +# use_function_syntax_for_execution_context: true + # Optional: set build tags that will be used to load packages # go_build_tags: # - private @@ -144,7 +148,7 @@ models: - github.com/99designs/gqlgen/graphql.Int - github.com/99designs/gqlgen/graphql.Int64 - github.com/99designs/gqlgen/graphql.Int32 - # gqlgen provides a default GraphQL UUID convenience wrapper for github.com/google/uuid + # gqlgen provides a default GraphQL UUID convenience wrapper for github.com/google/uuid # but you can override this to provide your own GraphQL UUID implementation UUID: model: diff --git a/plugin/federation/federation.go b/plugin/federation/federation.go index 2af9205ff92..bd60f789233 100644 --- a/plugin/federation/federation.go +++ b/plugin/federation/federation.go @@ -324,8 +324,9 @@ func (f *Federation) GenerateCode(data *codegen.Data) error { Filename: data.Config.Federation.Filename, Data: struct { Federation - UsePointers bool - }{*f, data.Config.ResolversAlwaysReturnPointers}, + UsePointers bool + UseFunctionSyntaxForExecutionContext bool + }{*f, data.Config.ResolversAlwaysReturnPointers, data.Config.UseFunctionSyntaxForExecutionContext}, GeneratedHeader: true, Packages: data.Config.Packages, Template: federationTemplate, diff --git a/plugin/federation/federation.gotpl b/plugin/federation/federation.gotpl index fdb40a6a5b1..5d71478baa2 100644 --- a/plugin/federation/federation.gotpl +++ b/plugin/federation/federation.gotpl @@ -8,6 +8,8 @@ {{ $options := .PackageOptions }} {{ $usePointers := .UsePointers }} +{{ $useFunctionSyntaxForExecutionContext := .UseFunctionSyntaxForExecutionContext }} + var ( ErrUnknownType = errors.New("unknown type") ErrTypeNotFound = errors.New("type not found") @@ -169,7 +171,11 @@ func (ec *executionContext) resolveEntity( {{ range $i, $resolver := .Resolvers }} case "{{.ResolverName}}": {{- range $j, $keyField := .KeyFields }} + {{ if $useFunctionSyntaxForExecutionContext -}} + id{{$j}}, err := {{.Type.UnmarshalFunc}}(ctx, ec, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- else -}} id{{$j}}, err := ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- end }} if err != nil { return nil, fmt.Errorf(`unmarshalling param {{$j}} for {{$resolver.ResolverName}}(): %w`, err) } @@ -187,7 +193,11 @@ func (ec *executionContext) resolveEntity( } {{- else }} {{ range $entity.Requires }} + {{ if $useFunctionSyntaxForExecutionContext -}} + entity.{{.Field.JoinGo `.`}}, err = {{.Type.UnmarshalFunc}}(ctx, ec, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- else -}} entity.{{.Field.JoinGo `.`}}, err = ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- end }} if err != nil { return nil, err } @@ -231,7 +241,11 @@ func (ec *executionContext) resolveManyEntities( for i, rep := range reps { {{ range $i, $keyField := .KeyFields -}} + {{ if $useFunctionSyntaxForExecutionContext -}} + id{{$i}}, err := {{.Type.UnmarshalFunc}}(ctx, ec, rep.entity["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- else -}} id{{$i}}, err := ec.{{.Type.UnmarshalFunc}}(ctx, rep.entity["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- end }} if err != nil { return errors.New(fmt.Sprintf("Field %s undefined in schema.", "{{.Definition.Name}}")) } @@ -251,7 +265,11 @@ func (ec *executionContext) resolveManyEntities( for i, entity := range entities { {{- range $entity.Requires }} + {{ if $useFunctionSyntaxForExecutionContext -}} + entity.{{.Field.JoinGo `.`}}, err = {{.Type.UnmarshalFunc}}(ctx, ec, reps[i].entity["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- else -}} entity.{{.Field.JoinGo `.`}}, err = ec.{{.Type.UnmarshalFunc}}(ctx, reps[i].entity["{{.Field.Join `"].(map[string]interface{})["`}}"]) + {{- end }} if err != nil { return err } diff --git a/plugin/federation/federation_use_function_syntax_for_execution_context_test.go b/plugin/federation/federation_use_function_syntax_for_execution_context_test.go new file mode 100644 index 00000000000..a102603e20e --- /dev/null +++ b/plugin/federation/federation_use_function_syntax_for_execution_context_test.go @@ -0,0 +1,51 @@ +//go:generate go run ../../testdata/gqlgen.go -config testdata/usefunctionsyntaxforexecutioncontext/gqlgen.yml +package federation + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext" + "github.com/99designs/gqlgen/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated" +) + +func TestFederationWithUseFunctionSyntaxForExecutionContext(t *testing.T) { + c := client.New(handler.NewDefaultServer( + generated.NewExecutableSchema(generated.Config{ + Resolvers: &usefunctionsyntaxforexecutioncontext.Resolver{}, + }), + )) + + t.Run("Hello entities", func(t *testing.T) { + representations := []map[string]any{ + { + "__typename": "Hello", + "name": "first name - 1", + }, { + "__typename": "Hello", + "name": "first name - 2", + }, + } + + var resp struct { + Entities []struct { + Name string `json:"name"` + } `json:"_entities"` + } + + err := c.Post( + entityQuery([]string{ + "Hello {name}", + }), + &resp, + client.Var("representations", representations), + ) + + require.NoError(t, err) + require.Equal(t, "first name - 1", resp.Entities[0].Name) + require.Equal(t, "first name - 2", resp.Entities[1].Name) + }) +} diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/entity.resolvers.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/entity.resolvers.go new file mode 100644 index 00000000000..4b0f609babc --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/entity.resolvers.go @@ -0,0 +1,184 @@ +package usefunctionsyntaxforexecutioncontext + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.57-dev + +import ( + "context" + "fmt" + + "github.com/99designs/gqlgen/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated" + "github.com/99designs/gqlgen/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model" +) + +// FindHelloByName is the resolver for the findHelloByName field. +func (r *entityResolver) FindHelloByName(ctx context.Context, name string) (*model.Hello, error) { + return &model.Hello{ + Name: name, + }, nil +} + +// FindHelloMultiSingleKeysByKey1AndKey2 is the resolver for the findHelloMultiSingleKeysByKey1AndKey2 field. +func (r *entityResolver) FindHelloMultiSingleKeysByKey1AndKey2(ctx context.Context, key1 string, key2 string) (*model.HelloMultiSingleKeys, error) { + panic(fmt.Errorf("not implemented")) +} + +// FindHelloWithErrorsByName is the resolver for the findHelloWithErrorsByName field. +func (r *entityResolver) FindHelloWithErrorsByName(ctx context.Context, name string) (*model.HelloWithErrors, error) { + if name == "inject error" { + return nil, generated.ErrResolvingHelloWithErrorsByName + } else if name == "" { + return nil, generated.ErrEmptyKeyResolvingHelloWithErrorsByName + } + + return &model.HelloWithErrors{ + Name: name, + }, nil +} + +// FindManyMultiHelloByNames is the resolver for the findManyMultiHelloByNames field. +func (r *entityResolver) FindManyMultiHelloByNames(ctx context.Context, reps []*model.MultiHelloByNamesInput) ([]*model.MultiHello, error) { + results := []*model.MultiHello{} + + for _, item := range reps { + results = append(results, &model.MultiHello{ + Name: item.Name + " - from multiget", + }) + } + + return results, nil +} + +// FindManyMultiHelloMultipleRequiresByNames is the resolver for the findManyMultiHelloMultipleRequiresByNames field. +func (r *entityResolver) FindManyMultiHelloMultipleRequiresByNames(ctx context.Context, reps []*model.MultiHelloMultipleRequiresByNamesInput) ([]*model.MultiHelloMultipleRequires, error) { + results := make([]*model.MultiHelloMultipleRequires, len(reps)) + + for i := range reps { + results[i] = &model.MultiHelloMultipleRequires{ + Name: reps[i].Name, + } + } + + return results, nil +} + +// FindManyMultiHelloRequiresByNames is the resolver for the findManyMultiHelloRequiresByNames field. +func (r *entityResolver) FindManyMultiHelloRequiresByNames(ctx context.Context, reps []*model.MultiHelloRequiresByNamesInput) ([]*model.MultiHelloRequires, error) { + results := make([]*model.MultiHelloRequires, len(reps)) + + for i := range reps { + results[i] = &model.MultiHelloRequires{ + Name: reps[i].Name, + } + } + + return results, nil +} + +// FindManyMultiHelloWithErrorByNames is the resolver for the findManyMultiHelloWithErrorByNames field. +func (r *entityResolver) FindManyMultiHelloWithErrorByNames(ctx context.Context, reps []*model.MultiHelloWithErrorByNamesInput) ([]*model.MultiHelloWithError, error) { + return nil, fmt.Errorf("error resolving MultiHelloWorldWithError") +} + +// FindManyMultiPlanetRequiresNestedByNames is the resolver for the findManyMultiPlanetRequiresNestedByNames field. +func (r *entityResolver) FindManyMultiPlanetRequiresNestedByNames(ctx context.Context, reps []*model.MultiPlanetRequiresNestedByNamesInput) ([]*model.MultiPlanetRequiresNested, error) { + worlds := map[string]*model.World{ + "earth": { + Foo: "A", + }, + "mars": { + Foo: "B", + }, + } + + results := make([]*model.MultiPlanetRequiresNested, len(reps)) + + for i := range reps { + name := reps[i].Name + world, ok := worlds[name] + if !ok { + return nil, fmt.Errorf("unknown planet: %s", name) + } + + results[i] = &model.MultiPlanetRequiresNested{ + Name: name, + World: world, + } + } + + return results, nil +} + +// FindPlanetMultipleRequiresByName is the resolver for the findPlanetMultipleRequiresByName field. +func (r *entityResolver) FindPlanetMultipleRequiresByName(ctx context.Context, name string) (*model.PlanetMultipleRequires, error) { + return &model.PlanetMultipleRequires{Name: name}, nil +} + +// FindPlanetRequiresByName is the resolver for the findPlanetRequiresByName field. +func (r *entityResolver) FindPlanetRequiresByName(ctx context.Context, name string) (*model.PlanetRequires, error) { + return &model.PlanetRequires{ + Name: name, + }, nil +} + +// FindPlanetRequiresNestedByName is the resolver for the findPlanetRequiresNestedByName field. +func (r *entityResolver) FindPlanetRequiresNestedByName(ctx context.Context, name string) (*model.PlanetRequiresNested, error) { + worlds := map[string]*model.World{ + "earth": { + Foo: "A", + }, + "mars": { + Foo: "B", + }, + } + world, ok := worlds[name] + if !ok { + return nil, fmt.Errorf("unknown planet: %s", name) + } + + return &model.PlanetRequiresNested{ + Name: name, + World: world, + }, nil +} + +// FindWorldByHelloNameAndFoo is the resolver for the findWorldByHelloNameAndFoo field. +func (r *entityResolver) FindWorldByHelloNameAndFoo(ctx context.Context, helloName string, foo string) (*model.World, error) { + return &model.World{ + Hello: &model.Hello{ + Name: helloName, + }, + Foo: foo, + }, nil +} + +// FindWorldNameByName is the resolver for the findWorldNameByName field. +func (r *entityResolver) FindWorldNameByName(ctx context.Context, name string) (*model.WorldName, error) { + return &model.WorldName{ + Name: name, + }, nil +} + +// FindWorldWithMultipleKeysByHelloNameAndFoo is the resolver for the findWorldWithMultipleKeysByHelloNameAndFoo field. +func (r *entityResolver) FindWorldWithMultipleKeysByHelloNameAndFoo(ctx context.Context, helloName string, foo string) (*model.WorldWithMultipleKeys, error) { + return &model.WorldWithMultipleKeys{ + Hello: &model.Hello{ + Name: helloName, + }, + Foo: foo, + Bar: FindWorldWithMultipleKeysByHelloNameAndFooBarValue, + }, nil +} + +// FindWorldWithMultipleKeysByBar is the resolver for the findWorldWithMultipleKeysByBar field. +func (r *entityResolver) FindWorldWithMultipleKeysByBar(ctx context.Context, bar int) (*model.WorldWithMultipleKeys, error) { + return &model.WorldWithMultipleKeys{ + Bar: bar, + }, nil +} + +// Entity returns generated.EntityResolver implementation. +func (r *Resolver) Entity() generated.EntityResolver { return &entityResolver{r} } + +type entityResolver struct{ *Resolver } diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/errors.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/errors.go new file mode 100644 index 00000000000..ea311c688ad --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/errors.go @@ -0,0 +1,9 @@ +package generated + +import "errors" + +// Errors defined for retained code that we want to stick around between generations. +var ( + ErrResolvingHelloWithErrorsByName = errors.New("error resolving HelloWithErrorsByName") + ErrEmptyKeyResolvingHelloWithErrorsByName = errors.New("error (empty key) resolving HelloWithErrorsByName") +) diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/exec.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/exec.go new file mode 100644 index 00000000000..d2035f47392 --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/exec.go @@ -0,0 +1,8942 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package generated + +import ( + "bytes" + "context" + "errors" + "fmt" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + "github.com/99designs/gqlgen/plugin/federation/fedruntime" + "github.com/99designs/gqlgen/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Entity() EntityResolver +} + +type DirectiveRoot struct { +} + +type ComplexityRoot struct { + Entity struct { + FindHelloByName func(childComplexity int, name string) int + FindHelloMultiSingleKeysByKey1AndKey2 func(childComplexity int, key1 string, key2 string) int + FindHelloWithErrorsByName func(childComplexity int, name string) int + FindManyMultiHelloByNames func(childComplexity int, reps []*model.MultiHelloByNamesInput) int + FindManyMultiHelloMultipleRequiresByNames func(childComplexity int, reps []*model.MultiHelloMultipleRequiresByNamesInput) int + FindManyMultiHelloRequiresByNames func(childComplexity int, reps []*model.MultiHelloRequiresByNamesInput) int + FindManyMultiHelloWithErrorByNames func(childComplexity int, reps []*model.MultiHelloWithErrorByNamesInput) int + FindManyMultiPlanetRequiresNestedByNames func(childComplexity int, reps []*model.MultiPlanetRequiresNestedByNamesInput) int + FindPlanetMultipleRequiresByName func(childComplexity int, name string) int + FindPlanetRequiresByName func(childComplexity int, name string) int + FindPlanetRequiresNestedByName func(childComplexity int, name string) int + FindWorldByHelloNameAndFoo func(childComplexity int, helloName string, foo string) int + FindWorldNameByName func(childComplexity int, name string) int + FindWorldWithMultipleKeysByBar func(childComplexity int, bar int) int + FindWorldWithMultipleKeysByHelloNameAndFoo func(childComplexity int, helloName string, foo string) int + } + + Hello struct { + Name func(childComplexity int) int + Secondary func(childComplexity int) int + } + + HelloMultiSingleKeys struct { + Key1 func(childComplexity int) int + Key2 func(childComplexity int) int + } + + HelloWithErrors struct { + Name func(childComplexity int) int + } + + MultiHello struct { + Name func(childComplexity int) int + } + + MultiHelloMultipleRequires struct { + Key1 func(childComplexity int) int + Key2 func(childComplexity int) int + Key3 func(childComplexity int) int + Name func(childComplexity int) int + } + + MultiHelloRequires struct { + Key1 func(childComplexity int) int + Key2 func(childComplexity int) int + Name func(childComplexity int) int + } + + MultiHelloWithError struct { + Name func(childComplexity int) int + } + + MultiPlanetRequiresNested struct { + Name func(childComplexity int) int + Size func(childComplexity int) int + World func(childComplexity int) int + } + + PlanetMultipleRequires struct { + Density func(childComplexity int) int + Diameter func(childComplexity int) int + Name func(childComplexity int) int + Weight func(childComplexity int) int + } + + PlanetRequires struct { + Diameter func(childComplexity int) int + Name func(childComplexity int) int + Size func(childComplexity int) int + } + + PlanetRequiresNested struct { + Name func(childComplexity int) int + Size func(childComplexity int) int + World func(childComplexity int) int + } + + Query struct { + __resolve__service func(childComplexity int) int + __resolve_entities func(childComplexity int, representations []map[string]interface{}) int + } + + World struct { + Bar func(childComplexity int) int + Foo func(childComplexity int) int + Hello func(childComplexity int) int + } + + WorldName struct { + Name func(childComplexity int) int + } + + WorldWithMultipleKeys struct { + Bar func(childComplexity int) int + Foo func(childComplexity int) int + Hello func(childComplexity int) int + } + + _Service struct { + SDL func(childComplexity int) int + } +} + +type EntityResolver interface { + FindHelloByName(ctx context.Context, name string) (*model.Hello, error) + FindHelloMultiSingleKeysByKey1AndKey2(ctx context.Context, key1 string, key2 string) (*model.HelloMultiSingleKeys, error) + FindHelloWithErrorsByName(ctx context.Context, name string) (*model.HelloWithErrors, error) + FindManyMultiHelloByNames(ctx context.Context, reps []*model.MultiHelloByNamesInput) ([]*model.MultiHello, error) + FindManyMultiHelloMultipleRequiresByNames(ctx context.Context, reps []*model.MultiHelloMultipleRequiresByNamesInput) ([]*model.MultiHelloMultipleRequires, error) + FindManyMultiHelloRequiresByNames(ctx context.Context, reps []*model.MultiHelloRequiresByNamesInput) ([]*model.MultiHelloRequires, error) + FindManyMultiHelloWithErrorByNames(ctx context.Context, reps []*model.MultiHelloWithErrorByNamesInput) ([]*model.MultiHelloWithError, error) + FindManyMultiPlanetRequiresNestedByNames(ctx context.Context, reps []*model.MultiPlanetRequiresNestedByNamesInput) ([]*model.MultiPlanetRequiresNested, error) + FindPlanetMultipleRequiresByName(ctx context.Context, name string) (*model.PlanetMultipleRequires, error) + FindPlanetRequiresByName(ctx context.Context, name string) (*model.PlanetRequires, error) + FindPlanetRequiresNestedByName(ctx context.Context, name string) (*model.PlanetRequiresNested, error) + FindWorldByHelloNameAndFoo(ctx context.Context, helloName string, foo string) (*model.World, error) + FindWorldNameByName(ctx context.Context, name string) (*model.WorldName, error) + FindWorldWithMultipleKeysByHelloNameAndFoo(ctx context.Context, helloName string, foo string) (*model.WorldWithMultipleKeys, error) + FindWorldWithMultipleKeysByBar(ctx context.Context, bar int) (*model.WorldWithMultipleKeys, error) +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "Entity.findHelloByName": + if e.complexity.Entity.FindHelloByName == nil { + break + } + + args, err := field_Entity_findHelloByName_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindHelloByName(childComplexity, args["name"].(string)), true + + case "Entity.findHelloMultiSingleKeysByKey1AndKey2": + if e.complexity.Entity.FindHelloMultiSingleKeysByKey1AndKey2 == nil { + break + } + + args, err := field_Entity_findHelloMultiSingleKeysByKey1AndKey2_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindHelloMultiSingleKeysByKey1AndKey2(childComplexity, args["key1"].(string), args["key2"].(string)), true + + case "Entity.findHelloWithErrorsByName": + if e.complexity.Entity.FindHelloWithErrorsByName == nil { + break + } + + args, err := field_Entity_findHelloWithErrorsByName_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindHelloWithErrorsByName(childComplexity, args["name"].(string)), true + + case "Entity.findManyMultiHelloByNames": + if e.complexity.Entity.FindManyMultiHelloByNames == nil { + break + } + + args, err := field_Entity_findManyMultiHelloByNames_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindManyMultiHelloByNames(childComplexity, args["reps"].([]*model.MultiHelloByNamesInput)), true + + case "Entity.findManyMultiHelloMultipleRequiresByNames": + if e.complexity.Entity.FindManyMultiHelloMultipleRequiresByNames == nil { + break + } + + args, err := field_Entity_findManyMultiHelloMultipleRequiresByNames_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindManyMultiHelloMultipleRequiresByNames(childComplexity, args["reps"].([]*model.MultiHelloMultipleRequiresByNamesInput)), true + + case "Entity.findManyMultiHelloRequiresByNames": + if e.complexity.Entity.FindManyMultiHelloRequiresByNames == nil { + break + } + + args, err := field_Entity_findManyMultiHelloRequiresByNames_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindManyMultiHelloRequiresByNames(childComplexity, args["reps"].([]*model.MultiHelloRequiresByNamesInput)), true + + case "Entity.findManyMultiHelloWithErrorByNames": + if e.complexity.Entity.FindManyMultiHelloWithErrorByNames == nil { + break + } + + args, err := field_Entity_findManyMultiHelloWithErrorByNames_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindManyMultiHelloWithErrorByNames(childComplexity, args["reps"].([]*model.MultiHelloWithErrorByNamesInput)), true + + case "Entity.findManyMultiPlanetRequiresNestedByNames": + if e.complexity.Entity.FindManyMultiPlanetRequiresNestedByNames == nil { + break + } + + args, err := field_Entity_findManyMultiPlanetRequiresNestedByNames_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindManyMultiPlanetRequiresNestedByNames(childComplexity, args["reps"].([]*model.MultiPlanetRequiresNestedByNamesInput)), true + + case "Entity.findPlanetMultipleRequiresByName": + if e.complexity.Entity.FindPlanetMultipleRequiresByName == nil { + break + } + + args, err := field_Entity_findPlanetMultipleRequiresByName_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindPlanetMultipleRequiresByName(childComplexity, args["name"].(string)), true + + case "Entity.findPlanetRequiresByName": + if e.complexity.Entity.FindPlanetRequiresByName == nil { + break + } + + args, err := field_Entity_findPlanetRequiresByName_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindPlanetRequiresByName(childComplexity, args["name"].(string)), true + + case "Entity.findPlanetRequiresNestedByName": + if e.complexity.Entity.FindPlanetRequiresNestedByName == nil { + break + } + + args, err := field_Entity_findPlanetRequiresNestedByName_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindPlanetRequiresNestedByName(childComplexity, args["name"].(string)), true + + case "Entity.findWorldByHelloNameAndFoo": + if e.complexity.Entity.FindWorldByHelloNameAndFoo == nil { + break + } + + args, err := field_Entity_findWorldByHelloNameAndFoo_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindWorldByHelloNameAndFoo(childComplexity, args["helloName"].(string), args["foo"].(string)), true + + case "Entity.findWorldNameByName": + if e.complexity.Entity.FindWorldNameByName == nil { + break + } + + args, err := field_Entity_findWorldNameByName_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindWorldNameByName(childComplexity, args["name"].(string)), true + + case "Entity.findWorldWithMultipleKeysByBar": + if e.complexity.Entity.FindWorldWithMultipleKeysByBar == nil { + break + } + + args, err := field_Entity_findWorldWithMultipleKeysByBar_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindWorldWithMultipleKeysByBar(childComplexity, args["bar"].(int)), true + + case "Entity.findWorldWithMultipleKeysByHelloNameAndFoo": + if e.complexity.Entity.FindWorldWithMultipleKeysByHelloNameAndFoo == nil { + break + } + + args, err := field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Entity.FindWorldWithMultipleKeysByHelloNameAndFoo(childComplexity, args["helloName"].(string), args["foo"].(string)), true + + case "Hello.name": + if e.complexity.Hello.Name == nil { + break + } + + return e.complexity.Hello.Name(childComplexity), true + + case "Hello.secondary": + if e.complexity.Hello.Secondary == nil { + break + } + + return e.complexity.Hello.Secondary(childComplexity), true + + case "HelloMultiSingleKeys.key1": + if e.complexity.HelloMultiSingleKeys.Key1 == nil { + break + } + + return e.complexity.HelloMultiSingleKeys.Key1(childComplexity), true + + case "HelloMultiSingleKeys.key2": + if e.complexity.HelloMultiSingleKeys.Key2 == nil { + break + } + + return e.complexity.HelloMultiSingleKeys.Key2(childComplexity), true + + case "HelloWithErrors.name": + if e.complexity.HelloWithErrors.Name == nil { + break + } + + return e.complexity.HelloWithErrors.Name(childComplexity), true + + case "MultiHello.name": + if e.complexity.MultiHello.Name == nil { + break + } + + return e.complexity.MultiHello.Name(childComplexity), true + + case "MultiHelloMultipleRequires.key1": + if e.complexity.MultiHelloMultipleRequires.Key1 == nil { + break + } + + return e.complexity.MultiHelloMultipleRequires.Key1(childComplexity), true + + case "MultiHelloMultipleRequires.key2": + if e.complexity.MultiHelloMultipleRequires.Key2 == nil { + break + } + + return e.complexity.MultiHelloMultipleRequires.Key2(childComplexity), true + + case "MultiHelloMultipleRequires.key3": + if e.complexity.MultiHelloMultipleRequires.Key3 == nil { + break + } + + return e.complexity.MultiHelloMultipleRequires.Key3(childComplexity), true + + case "MultiHelloMultipleRequires.name": + if e.complexity.MultiHelloMultipleRequires.Name == nil { + break + } + + return e.complexity.MultiHelloMultipleRequires.Name(childComplexity), true + + case "MultiHelloRequires.key1": + if e.complexity.MultiHelloRequires.Key1 == nil { + break + } + + return e.complexity.MultiHelloRequires.Key1(childComplexity), true + + case "MultiHelloRequires.key2": + if e.complexity.MultiHelloRequires.Key2 == nil { + break + } + + return e.complexity.MultiHelloRequires.Key2(childComplexity), true + + case "MultiHelloRequires.name": + if e.complexity.MultiHelloRequires.Name == nil { + break + } + + return e.complexity.MultiHelloRequires.Name(childComplexity), true + + case "MultiHelloWithError.name": + if e.complexity.MultiHelloWithError.Name == nil { + break + } + + return e.complexity.MultiHelloWithError.Name(childComplexity), true + + case "MultiPlanetRequiresNested.name": + if e.complexity.MultiPlanetRequiresNested.Name == nil { + break + } + + return e.complexity.MultiPlanetRequiresNested.Name(childComplexity), true + + case "MultiPlanetRequiresNested.size": + if e.complexity.MultiPlanetRequiresNested.Size == nil { + break + } + + return e.complexity.MultiPlanetRequiresNested.Size(childComplexity), true + + case "MultiPlanetRequiresNested.world": + if e.complexity.MultiPlanetRequiresNested.World == nil { + break + } + + return e.complexity.MultiPlanetRequiresNested.World(childComplexity), true + + case "PlanetMultipleRequires.density": + if e.complexity.PlanetMultipleRequires.Density == nil { + break + } + + return e.complexity.PlanetMultipleRequires.Density(childComplexity), true + + case "PlanetMultipleRequires.diameter": + if e.complexity.PlanetMultipleRequires.Diameter == nil { + break + } + + return e.complexity.PlanetMultipleRequires.Diameter(childComplexity), true + + case "PlanetMultipleRequires.name": + if e.complexity.PlanetMultipleRequires.Name == nil { + break + } + + return e.complexity.PlanetMultipleRequires.Name(childComplexity), true + + case "PlanetMultipleRequires.weight": + if e.complexity.PlanetMultipleRequires.Weight == nil { + break + } + + return e.complexity.PlanetMultipleRequires.Weight(childComplexity), true + + case "PlanetRequires.diameter": + if e.complexity.PlanetRequires.Diameter == nil { + break + } + + return e.complexity.PlanetRequires.Diameter(childComplexity), true + + case "PlanetRequires.name": + if e.complexity.PlanetRequires.Name == nil { + break + } + + return e.complexity.PlanetRequires.Name(childComplexity), true + + case "PlanetRequires.size": + if e.complexity.PlanetRequires.Size == nil { + break + } + + return e.complexity.PlanetRequires.Size(childComplexity), true + + case "PlanetRequiresNested.name": + if e.complexity.PlanetRequiresNested.Name == nil { + break + } + + return e.complexity.PlanetRequiresNested.Name(childComplexity), true + + case "PlanetRequiresNested.size": + if e.complexity.PlanetRequiresNested.Size == nil { + break + } + + return e.complexity.PlanetRequiresNested.Size(childComplexity), true + + case "PlanetRequiresNested.world": + if e.complexity.PlanetRequiresNested.World == nil { + break + } + + return e.complexity.PlanetRequiresNested.World(childComplexity), true + + case "Query._service": + if e.complexity.Query.__resolve__service == nil { + break + } + + return e.complexity.Query.__resolve__service(childComplexity), true + + case "Query._entities": + if e.complexity.Query.__resolve_entities == nil { + break + } + + args, err := field_Query__entities_args(context.TODO(), &ec, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.__resolve_entities(childComplexity, args["representations"].([]map[string]interface{})), true + + case "World.bar": + if e.complexity.World.Bar == nil { + break + } + + return e.complexity.World.Bar(childComplexity), true + + case "World.foo": + if e.complexity.World.Foo == nil { + break + } + + return e.complexity.World.Foo(childComplexity), true + + case "World.hello": + if e.complexity.World.Hello == nil { + break + } + + return e.complexity.World.Hello(childComplexity), true + + case "WorldName.name": + if e.complexity.WorldName.Name == nil { + break + } + + return e.complexity.WorldName.Name(childComplexity), true + + case "WorldWithMultipleKeys.bar": + if e.complexity.WorldWithMultipleKeys.Bar == nil { + break + } + + return e.complexity.WorldWithMultipleKeys.Bar(childComplexity), true + + case "WorldWithMultipleKeys.foo": + if e.complexity.WorldWithMultipleKeys.Foo == nil { + break + } + + return e.complexity.WorldWithMultipleKeys.Foo(childComplexity), true + + case "WorldWithMultipleKeys.hello": + if e.complexity.WorldWithMultipleKeys.Hello == nil { + break + } + + return e.complexity.WorldWithMultipleKeys.Hello(childComplexity), true + + case "_Service.sdl": + if e.complexity._Service.SDL == nil { + break + } + + return e.complexity._Service.SDL(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + unmarshalInputMultiHelloByNamesInput, + unmarshalInputMultiHelloMultipleRequiresByNamesInput, + unmarshalInputMultiHelloRequiresByNamesInput, + unmarshalInputMultiHelloWithErrorByNamesInput, + unmarshalInputMultiPlanetRequiresNestedByNamesInput, + ) + first := true + + switch opCtx.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = _Query(ctx, &ec, opCtx.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +var sources = []*ast.Source{ + {Name: "../schema.graphql", Input: `directive @entityResolver(multi: Boolean) on OBJECT + +type Hello @key(fields: "name") { + name: String! + secondary: String! +} + +type World @key(fields: "hello { name } foo ") { + foo: String! + bar: Int! + hello: Hello +} + +type WorldWithMultipleKeys @key(fields: "hello { name } foo ") @key(fields: "bar") { + foo: String! + bar: Int! + hello: Hello +} + +type WorldName @key(fields: "name") { + name: String! +} + +type HelloWithErrors @key(fields: "name") { + name: String! +} + +type PlanetRequires @key(fields: "name") { + name: String! + size: Int! @requires(fields: "diameter") + diameter: Int! +} + +type PlanetMultipleRequires @key(fields: "name") { + name: String! @external + diameter: Int! @external + density: Int! @external + weight: Int! @requires(fields: "diameter density") +} + +type PlanetRequiresNested @key(fields: "name") { + name: String! @external + world: World! @external + size: Int! @requires(fields: "world{ foo }") +} + +type MultiPlanetRequiresNested @key(fields: "name") @entityResolver(multi: true) { + name: String! @external + world: World! @external + size: Int! @requires(fields: "world{ foo }") +} + +type MultiHello @key(fields: "name") @entityResolver(multi: true) { + name: String! +} + +type MultiHelloWithError @key(fields: "name") @entityResolver(multi: true) { + name: String! +} + +type HelloMultiSingleKeys @key(fields: "key1 key2") { + key1: String! + key2: String! +} + +type MultiHelloRequires @key(fields: "name") @entityResolver(multi: true) { + name: String! @external + key1: String! @external + key2: String! @requires(fields: "key1") +} + +type MultiHelloMultipleRequires @key(fields: "name") @entityResolver(multi: true) { + name: String! @external + key1: String! @external + key2: String! @external + key3: String! @requires(fields: "key1 key2") +} +`, BuiltIn: false}, + {Name: "../../../federation/directives.graphql", Input: ` + directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE + directive @requires(fields: _FieldSet!) on FIELD_DEFINITION + directive @provides(fields: _FieldSet!) on FIELD_DEFINITION + directive @extends on OBJECT | INTERFACE + directive @external on FIELD_DEFINITION + scalar _Any + scalar _FieldSet +`, BuiltIn: true}, + {Name: "../../../federation/entity.graphql", Input: ` +# a union of all types that use the @key directive +union _Entity = Hello | HelloMultiSingleKeys | HelloWithErrors | MultiHello | MultiHelloMultipleRequires | MultiHelloRequires | MultiHelloWithError | MultiPlanetRequiresNested | PlanetMultipleRequires | PlanetRequires | PlanetRequiresNested | World | WorldName | WorldWithMultipleKeys + +input MultiHelloByNamesInput { + Name: String! +} + +input MultiHelloMultipleRequiresByNamesInput { + Name: String! +} + +input MultiHelloRequiresByNamesInput { + Name: String! +} + +input MultiHelloWithErrorByNamesInput { + Name: String! +} + +input MultiPlanetRequiresNestedByNamesInput { + Name: String! +} + +# fake type to build resolver interfaces for users to implement +type Entity { + findHelloByName(name: String!,): Hello! + findHelloMultiSingleKeysByKey1AndKey2(key1: String!,key2: String!,): HelloMultiSingleKeys! + findHelloWithErrorsByName(name: String!,): HelloWithErrors! + findManyMultiHelloByNames(reps: [MultiHelloByNamesInput]!): [MultiHello] + findManyMultiHelloMultipleRequiresByNames(reps: [MultiHelloMultipleRequiresByNamesInput]!): [MultiHelloMultipleRequires] + findManyMultiHelloRequiresByNames(reps: [MultiHelloRequiresByNamesInput]!): [MultiHelloRequires] + findManyMultiHelloWithErrorByNames(reps: [MultiHelloWithErrorByNamesInput]!): [MultiHelloWithError] + findManyMultiPlanetRequiresNestedByNames(reps: [MultiPlanetRequiresNestedByNamesInput]!): [MultiPlanetRequiresNested] + findPlanetMultipleRequiresByName(name: String!,): PlanetMultipleRequires! + findPlanetRequiresByName(name: String!,): PlanetRequires! + findPlanetRequiresNestedByName(name: String!,): PlanetRequiresNested! + findWorldByHelloNameAndFoo(helloName: String!,foo: String!,): World! + findWorldNameByName(name: String!,): WorldName! + findWorldWithMultipleKeysByHelloNameAndFoo(helloName: String!,foo: String!,): WorldWithMultipleKeys! + findWorldWithMultipleKeysByBar(bar: Int!,): WorldWithMultipleKeys! +} + +type _Service { + sdl: String +} + +extend type Query { + _entities(representations: [_Any!]!): [_Entity]! + _service: _Service! +} +`, BuiltIn: true}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func field_Entity_findHelloByName_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findHelloByName_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Entity_findHelloByName_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findHelloMultiSingleKeysByKey1AndKey2_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["key1"] = arg0 + arg1, err := field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["key2"] = arg1 + return args, nil +} +func field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["key1"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key1")) + if tmp, ok := rawArgs["key1"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["key2"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key2")) + if tmp, ok := rawArgs["key2"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findHelloWithErrorsByName_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findHelloWithErrorsByName_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Entity_findHelloWithErrorsByName_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findManyMultiHelloByNames_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findManyMultiHelloByNames_argsReps(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["reps"] = arg0 + return args, nil +} +func field_Entity_findManyMultiHelloByNames_argsReps( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) ([]*model.MultiHelloByNamesInput, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["reps"] + if !ok { + var zeroVal []*model.MultiHelloByNamesInput + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + if tmp, ok := rawArgs["reps"]; ok { + return unmarshalNMultiHelloByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloByNamesInput(ctx, ec, tmp) + } + + var zeroVal []*model.MultiHelloByNamesInput + return zeroVal, nil +} + +func field_Entity_findManyMultiHelloMultipleRequiresByNames_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["reps"] = arg0 + return args, nil +} +func field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) ([]*model.MultiHelloMultipleRequiresByNamesInput, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["reps"] + if !ok { + var zeroVal []*model.MultiHelloMultipleRequiresByNamesInput + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + if tmp, ok := rawArgs["reps"]; ok { + return unmarshalNMultiHelloMultipleRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequiresByNamesInput(ctx, ec, tmp) + } + + var zeroVal []*model.MultiHelloMultipleRequiresByNamesInput + return zeroVal, nil +} + +func field_Entity_findManyMultiHelloRequiresByNames_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findManyMultiHelloRequiresByNames_argsReps(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["reps"] = arg0 + return args, nil +} +func field_Entity_findManyMultiHelloRequiresByNames_argsReps( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) ([]*model.MultiHelloRequiresByNamesInput, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["reps"] + if !ok { + var zeroVal []*model.MultiHelloRequiresByNamesInput + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + if tmp, ok := rawArgs["reps"]; ok { + return unmarshalNMultiHelloRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequiresByNamesInput(ctx, ec, tmp) + } + + var zeroVal []*model.MultiHelloRequiresByNamesInput + return zeroVal, nil +} + +func field_Entity_findManyMultiHelloWithErrorByNames_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findManyMultiHelloWithErrorByNames_argsReps(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["reps"] = arg0 + return args, nil +} +func field_Entity_findManyMultiHelloWithErrorByNames_argsReps( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) ([]*model.MultiHelloWithErrorByNamesInput, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["reps"] + if !ok { + var zeroVal []*model.MultiHelloWithErrorByNamesInput + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + if tmp, ok := rawArgs["reps"]; ok { + return unmarshalNMultiHelloWithErrorByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithErrorByNamesInput(ctx, ec, tmp) + } + + var zeroVal []*model.MultiHelloWithErrorByNamesInput + return zeroVal, nil +} + +func field_Entity_findManyMultiPlanetRequiresNestedByNames_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["reps"] = arg0 + return args, nil +} +func field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) ([]*model.MultiPlanetRequiresNestedByNamesInput, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["reps"] + if !ok { + var zeroVal []*model.MultiPlanetRequiresNestedByNamesInput + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + if tmp, ok := rawArgs["reps"]; ok { + return unmarshalNMultiPlanetRequiresNestedByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNestedByNamesInput(ctx, ec, tmp) + } + + var zeroVal []*model.MultiPlanetRequiresNestedByNamesInput + return zeroVal, nil +} + +func field_Entity_findPlanetMultipleRequiresByName_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findPlanetMultipleRequiresByName_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Entity_findPlanetMultipleRequiresByName_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findPlanetRequiresByName_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findPlanetRequiresByName_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Entity_findPlanetRequiresByName_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findPlanetRequiresNestedByName_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findPlanetRequiresNestedByName_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Entity_findPlanetRequiresNestedByName_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findWorldByHelloNameAndFoo_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findWorldByHelloNameAndFoo_argsHelloName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["helloName"] = arg0 + arg1, err := field_Entity_findWorldByHelloNameAndFoo_argsFoo(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["foo"] = arg1 + return args, nil +} +func field_Entity_findWorldByHelloNameAndFoo_argsHelloName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["helloName"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) + if tmp, ok := rawArgs["helloName"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findWorldByHelloNameAndFoo_argsFoo( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["foo"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) + if tmp, ok := rawArgs["foo"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findWorldNameByName_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findWorldNameByName_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Entity_findWorldNameByName_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findWorldWithMultipleKeysByBar_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findWorldWithMultipleKeysByBar_argsBar(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["bar"] = arg0 + return args, nil +} +func field_Entity_findWorldWithMultipleKeysByBar_argsBar( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["bar"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("bar")) + if tmp, ok := rawArgs["bar"]; ok { + return unmarshalNInt2int(ctx, ec, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["helloName"] = arg0 + arg1, err := field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["foo"] = arg1 + return args, nil +} +func field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["helloName"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) + if tmp, ok := rawArgs["helloName"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["foo"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) + if tmp, ok := rawArgs["foo"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Query___type_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Query___type_argsName(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["name"] = arg0 + return args, nil +} +func field_Query___type_argsName( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return unmarshalNString2string(ctx, ec, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func field_Query__entities_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field_Query__entities_argsRepresentations(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["representations"] = arg0 + return args, nil +} +func field_Query__entities_argsRepresentations( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) ([]map[string]interface{}, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["representations"] + if !ok { + var zeroVal []map[string]interface{} + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) + if tmp, ok := rawArgs["representations"]; ok { + return unmarshalN_Any2ᚕmapᚄ(ctx, ec, tmp) + } + + var zeroVal []map[string]interface{} + return zeroVal, nil +} + +func field___Type_enumValues_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field___Type_enumValues_argsIncludeDeprecated(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func field___Type_enumValues_argsIncludeDeprecated( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["includeDeprecated"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return unmarshalOBoolean2bool(ctx, ec, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +func field___Type_fields_args(ctx context.Context, ec *executionContext, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + arg0, err := field___Type_fields_argsIncludeDeprecated(ctx, ec, rawArgs) + if err != nil { + return nil, err + } + args["includeDeprecated"] = arg0 + return args, nil +} +func field___Type_fields_argsIncludeDeprecated( + ctx context.Context, + ec *executionContext, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["includeDeprecated"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return unmarshalOBoolean2bool(ctx, ec, tmp) + } + + var zeroVal bool + return zeroVal, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func _Entity_findHelloByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findHelloByName(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindHelloByName(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Hello) + fc.Result = res + return marshalNHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHello(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findHelloByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_Hello_name(ctx, ec, field) + case "secondary": + return fieldContext_Hello_secondary(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type Hello", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findHelloByName_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findHelloMultiSingleKeysByKey1AndKey2(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findHelloMultiSingleKeysByKey1AndKey2(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindHelloMultiSingleKeysByKey1AndKey2(rctx, fc.Args["key1"].(string), fc.Args["key2"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.HelloMultiSingleKeys) + fc.Result = res + return marshalNHelloMultiSingleKeys2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHelloMultiSingleKeys(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findHelloMultiSingleKeysByKey1AndKey2(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "key1": + return fieldContext_HelloMultiSingleKeys_key1(ctx, ec, field) + case "key2": + return fieldContext_HelloMultiSingleKeys_key2(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type HelloMultiSingleKeys", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findHelloMultiSingleKeysByKey1AndKey2_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findHelloWithErrorsByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findHelloWithErrorsByName(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindHelloWithErrorsByName(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.HelloWithErrors) + fc.Result = res + return marshalNHelloWithErrors2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHelloWithErrors(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findHelloWithErrorsByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_HelloWithErrors_name(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type HelloWithErrors", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findHelloWithErrorsByName_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findManyMultiHelloByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findManyMultiHelloByNames(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindManyMultiHelloByNames(rctx, fc.Args["reps"].([]*model.MultiHelloByNamesInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.MultiHello) + fc.Result = res + return marshalOMultiHello2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHello(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findManyMultiHelloByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_MultiHello_name(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type MultiHello", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findManyMultiHelloByNames_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findManyMultiHelloMultipleRequiresByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findManyMultiHelloMultipleRequiresByNames(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindManyMultiHelloMultipleRequiresByNames(rctx, fc.Args["reps"].([]*model.MultiHelloMultipleRequiresByNamesInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.MultiHelloMultipleRequires) + fc.Result = res + return marshalOMultiHelloMultipleRequires2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequires(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findManyMultiHelloMultipleRequiresByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_MultiHelloMultipleRequires_name(ctx, ec, field) + case "key1": + return fieldContext_MultiHelloMultipleRequires_key1(ctx, ec, field) + case "key2": + return fieldContext_MultiHelloMultipleRequires_key2(ctx, ec, field) + case "key3": + return fieldContext_MultiHelloMultipleRequires_key3(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type MultiHelloMultipleRequires", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findManyMultiHelloMultipleRequiresByNames_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findManyMultiHelloRequiresByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findManyMultiHelloRequiresByNames(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindManyMultiHelloRequiresByNames(rctx, fc.Args["reps"].([]*model.MultiHelloRequiresByNamesInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.MultiHelloRequires) + fc.Result = res + return marshalOMultiHelloRequires2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequires(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findManyMultiHelloRequiresByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_MultiHelloRequires_name(ctx, ec, field) + case "key1": + return fieldContext_MultiHelloRequires_key1(ctx, ec, field) + case "key2": + return fieldContext_MultiHelloRequires_key2(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type MultiHelloRequires", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findManyMultiHelloRequiresByNames_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findManyMultiHelloWithErrorByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findManyMultiHelloWithErrorByNames(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindManyMultiHelloWithErrorByNames(rctx, fc.Args["reps"].([]*model.MultiHelloWithErrorByNamesInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.MultiHelloWithError) + fc.Result = res + return marshalOMultiHelloWithError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithError(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findManyMultiHelloWithErrorByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_MultiHelloWithError_name(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type MultiHelloWithError", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findManyMultiHelloWithErrorByNames_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findManyMultiPlanetRequiresNestedByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findManyMultiPlanetRequiresNestedByNames(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindManyMultiPlanetRequiresNestedByNames(rctx, fc.Args["reps"].([]*model.MultiPlanetRequiresNestedByNamesInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.MultiPlanetRequiresNested) + fc.Result = res + return marshalOMultiPlanetRequiresNested2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNested(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findManyMultiPlanetRequiresNestedByNames(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_MultiPlanetRequiresNested_name(ctx, ec, field) + case "world": + return fieldContext_MultiPlanetRequiresNested_world(ctx, ec, field) + case "size": + return fieldContext_MultiPlanetRequiresNested_size(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type MultiPlanetRequiresNested", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findManyMultiPlanetRequiresNestedByNames_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findPlanetMultipleRequiresByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findPlanetMultipleRequiresByName(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindPlanetMultipleRequiresByName(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PlanetMultipleRequires) + fc.Result = res + return marshalNPlanetMultipleRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetMultipleRequires(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findPlanetMultipleRequiresByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_PlanetMultipleRequires_name(ctx, ec, field) + case "diameter": + return fieldContext_PlanetMultipleRequires_diameter(ctx, ec, field) + case "density": + return fieldContext_PlanetMultipleRequires_density(ctx, ec, field) + case "weight": + return fieldContext_PlanetMultipleRequires_weight(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type PlanetMultipleRequires", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findPlanetMultipleRequiresByName_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findPlanetRequiresByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findPlanetRequiresByName(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindPlanetRequiresByName(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PlanetRequires) + fc.Result = res + return marshalNPlanetRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetRequires(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findPlanetRequiresByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_PlanetRequires_name(ctx, ec, field) + case "size": + return fieldContext_PlanetRequires_size(ctx, ec, field) + case "diameter": + return fieldContext_PlanetRequires_diameter(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type PlanetRequires", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findPlanetRequiresByName_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findPlanetRequiresNestedByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findPlanetRequiresNestedByName(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindPlanetRequiresNestedByName(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PlanetRequiresNested) + fc.Result = res + return marshalNPlanetRequiresNested2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetRequiresNested(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findPlanetRequiresNestedByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_PlanetRequiresNested_name(ctx, ec, field) + case "world": + return fieldContext_PlanetRequiresNested_world(ctx, ec, field) + case "size": + return fieldContext_PlanetRequiresNested_size(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type PlanetRequiresNested", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findPlanetRequiresNestedByName_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findWorldByHelloNameAndFoo(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findWorldByHelloNameAndFoo(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindWorldByHelloNameAndFoo(rctx, fc.Args["helloName"].(string), fc.Args["foo"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.World) + fc.Result = res + return marshalNWorld2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorld(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findWorldByHelloNameAndFoo(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "foo": + return fieldContext_World_foo(ctx, ec, field) + case "bar": + return fieldContext_World_bar(ctx, ec, field) + case "hello": + return fieldContext_World_hello(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type World", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findWorldByHelloNameAndFoo_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findWorldNameByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findWorldNameByName(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindWorldNameByName(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.WorldName) + fc.Result = res + return marshalNWorldName2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldName(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findWorldNameByName(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_WorldName_name(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type WorldName", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findWorldNameByName_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findWorldWithMultipleKeysByHelloNameAndFoo(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findWorldWithMultipleKeysByHelloNameAndFoo(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindWorldWithMultipleKeysByHelloNameAndFoo(rctx, fc.Args["helloName"].(string), fc.Args["foo"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.WorldWithMultipleKeys) + fc.Result = res + return marshalNWorldWithMultipleKeys2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldWithMultipleKeys(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findWorldWithMultipleKeysByHelloNameAndFoo(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "foo": + return fieldContext_WorldWithMultipleKeys_foo(ctx, ec, field) + case "bar": + return fieldContext_WorldWithMultipleKeys_bar(ctx, ec, field) + case "hello": + return fieldContext_WorldWithMultipleKeys_hello(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type WorldWithMultipleKeys", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Entity_findWorldWithMultipleKeysByBar(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Entity_findWorldWithMultipleKeysByBar(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Entity().FindWorldWithMultipleKeysByBar(rctx, fc.Args["bar"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.WorldWithMultipleKeys) + fc.Result = res + return marshalNWorldWithMultipleKeys2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldWithMultipleKeys(ctx, ec, field.Selections, res) +} + +func fieldContext_Entity_findWorldWithMultipleKeysByBar(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Entity", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "foo": + return fieldContext_WorldWithMultipleKeys_foo(ctx, ec, field) + case "bar": + return fieldContext_WorldWithMultipleKeys_bar(ctx, ec, field) + case "hello": + return fieldContext_WorldWithMultipleKeys_hello(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type WorldWithMultipleKeys", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Entity_findWorldWithMultipleKeysByBar_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Hello_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.Hello) (ret graphql.Marshaler) { + fc, err := fieldContext_Hello_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_Hello_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Hello", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _Hello_secondary(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.Hello) (ret graphql.Marshaler) { + fc, err := fieldContext_Hello_secondary(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Secondary, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_Hello_secondary(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Hello", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _HelloMultiSingleKeys_key1(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.HelloMultiSingleKeys) (ret graphql.Marshaler) { + fc, err := fieldContext_HelloMultiSingleKeys_key1(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key1, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_HelloMultiSingleKeys_key1(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "HelloMultiSingleKeys", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _HelloMultiSingleKeys_key2(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.HelloMultiSingleKeys) (ret graphql.Marshaler) { + fc, err := fieldContext_HelloMultiSingleKeys_key2(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key2, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_HelloMultiSingleKeys_key2(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "HelloMultiSingleKeys", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _HelloWithErrors_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.HelloWithErrors) (ret graphql.Marshaler) { + fc, err := fieldContext_HelloWithErrors_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_HelloWithErrors_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "HelloWithErrors", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHello_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHello) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHello_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHello_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHello", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloMultipleRequires_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloMultipleRequires_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloMultipleRequires_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloMultipleRequires_key1(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloMultipleRequires_key1(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key1, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloMultipleRequires_key1(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloMultipleRequires_key2(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloMultipleRequires_key2(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key2, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloMultipleRequires_key2(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloMultipleRequires_key3(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloMultipleRequires_key3(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key3, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloMultipleRequires_key3(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloRequires_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloRequires_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloRequires_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloRequires_key1(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloRequires_key1(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key1, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloRequires_key1(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloRequires_key2(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloRequires_key2(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key2, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloRequires_key2(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiHelloWithError_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiHelloWithError) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiHelloWithError_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiHelloWithError_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiHelloWithError", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiPlanetRequiresNested_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiPlanetRequiresNested) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiPlanetRequiresNested_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiPlanetRequiresNested_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiPlanetRequiresNested", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _MultiPlanetRequiresNested_world(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiPlanetRequiresNested) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiPlanetRequiresNested_world(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.World, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.World) + fc.Result = res + return marshalNWorld2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorld(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiPlanetRequiresNested_world(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiPlanetRequiresNested", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "foo": + return fieldContext_World_foo(ctx, ec, field) + case "bar": + return fieldContext_World_bar(ctx, ec, field) + case "hello": + return fieldContext_World_hello(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type World", field.Name) + }, + } + return fc, nil +} + +func _MultiPlanetRequiresNested_size(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.MultiPlanetRequiresNested) (ret graphql.Marshaler) { + fc, err := fieldContext_MultiPlanetRequiresNested_size(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Size, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_MultiPlanetRequiresNested_size(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MultiPlanetRequiresNested", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _PlanetMultipleRequires_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetMultipleRequires_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetMultipleRequires_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _PlanetMultipleRequires_diameter(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetMultipleRequires_diameter(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Diameter, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetMultipleRequires_diameter(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _PlanetMultipleRequires_density(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetMultipleRequires_density(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Density, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetMultipleRequires_density(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _PlanetMultipleRequires_weight(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetMultipleRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetMultipleRequires_weight(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Weight, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetMultipleRequires_weight(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetMultipleRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _PlanetRequires_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetRequires_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetRequires_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _PlanetRequires_size(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetRequires_size(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Size, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetRequires_size(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _PlanetRequires_diameter(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetRequires) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetRequires_diameter(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Diameter, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetRequires_diameter(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetRequires", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _PlanetRequiresNested_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetRequiresNested) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetRequiresNested_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetRequiresNested_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetRequiresNested", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _PlanetRequiresNested_world(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetRequiresNested) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetRequiresNested_world(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.World, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.World) + fc.Result = res + return marshalNWorld2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorld(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetRequiresNested_world(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetRequiresNested", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "foo": + return fieldContext_World_foo(ctx, ec, field) + case "bar": + return fieldContext_World_bar(ctx, ec, field) + case "hello": + return fieldContext_World_hello(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type World", field.Name) + }, + } + return fc, nil +} + +func _PlanetRequiresNested_size(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.PlanetRequiresNested) (ret graphql.Marshaler) { + fc, err := fieldContext_PlanetRequiresNested_size(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Size, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_PlanetRequiresNested_size(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanetRequiresNested", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _Query__entities(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query__entities(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.__resolve_entities(ctx, fc.Args["representations"].([]map[string]interface{})), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]fedruntime.Entity) + fc.Result = res + return marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx, ec, field.Selections, res) +} + +func fieldContext_Query__entities(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type _Entity does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Query__entities_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Query__service(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query__service(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.__resolve__service(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(fedruntime.Service) + fc.Result = res + return marshalN_Service2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐService(ctx, ec, field.Selections, res) +} + +func fieldContext_Query__service(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "sdl": + return fieldContext__Service_sdl(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type _Service", field.Name) + }, + } + return fc, nil +} + +func _Query___type(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query___type(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext_Query___type(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field_Query___type_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func _Query___schema(ctx context.Context, ec *executionContext, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := fieldContext_Query___schema(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, ec, field.Selections, res) +} + +func fieldContext_Query___schema(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return fieldContext___Schema_description(ctx, ec, field) + case "types": + return fieldContext___Schema_types(ctx, ec, field) + case "queryType": + return fieldContext___Schema_queryType(ctx, ec, field) + case "mutationType": + return fieldContext___Schema_mutationType(ctx, ec, field) + case "subscriptionType": + return fieldContext___Schema_subscriptionType(ctx, ec, field) + case "directives": + return fieldContext___Schema_directives(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func _World_foo(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.World) (ret graphql.Marshaler) { + fc, err := fieldContext_World_foo(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Foo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_World_foo(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "World", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _World_bar(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.World) (ret graphql.Marshaler) { + fc, err := fieldContext_World_bar(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Bar, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_World_bar(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "World", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _World_hello(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.World) (ret graphql.Marshaler) { + fc, err := fieldContext_World_hello(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hello, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Hello) + fc.Result = res + return marshalOHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHello(ctx, ec, field.Selections, res) +} + +func fieldContext_World_hello(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "World", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_Hello_name(ctx, ec, field) + case "secondary": + return fieldContext_Hello_secondary(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type Hello", field.Name) + }, + } + return fc, nil +} + +func _WorldName_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.WorldName) (ret graphql.Marshaler) { + fc, err := fieldContext_WorldName_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_WorldName_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WorldName", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _WorldWithMultipleKeys_foo(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.WorldWithMultipleKeys) (ret graphql.Marshaler) { + fc, err := fieldContext_WorldWithMultipleKeys_foo(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Foo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext_WorldWithMultipleKeys_foo(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WorldWithMultipleKeys", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func _WorldWithMultipleKeys_bar(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.WorldWithMultipleKeys) (ret graphql.Marshaler) { + fc, err := fieldContext_WorldWithMultipleKeys_bar(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Bar, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return marshalNInt2int(ctx, ec, field.Selections, res) +} + +func fieldContext_WorldWithMultipleKeys_bar(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WorldWithMultipleKeys", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func _WorldWithMultipleKeys_hello(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *model.WorldWithMultipleKeys) (ret graphql.Marshaler) { + fc, err := fieldContext_WorldWithMultipleKeys_hello(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Hello, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Hello) + fc.Result = res + return marshalOHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHello(ctx, ec, field.Selections, res) +} + +func fieldContext_WorldWithMultipleKeys_hello(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WorldWithMultipleKeys", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext_Hello_name(ctx, ec, field) + case "secondary": + return fieldContext_Hello_secondary(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type Hello", field.Name) + }, + } + return fc, nil +} + +func __Service_sdl(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *fedruntime.Service) (ret graphql.Marshaler) { + fc, err := fieldContext__Service_sdl(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SDL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalOString2string(ctx, ec, field.Selections, res) +} + +func fieldContext__Service_sdl(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_Service", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_locations(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_locations(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return marshalN__DirectiveLocation2ᚕstringᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_locations(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func ___Directive_args(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_args(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_args(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___InputValue_name(ctx, ec, field) + case "description": + return fieldContext___InputValue_description(ctx, ec, field) + case "type": + return fieldContext___InputValue_type(ctx, ec, field) + case "defaultValue": + return fieldContext___InputValue_defaultValue(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func ___Directive_isRepeatable(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := fieldContext___Directive_isRepeatable(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext___Directive_isRepeatable(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_isDeprecated(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_isDeprecated(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_isDeprecated(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func ___EnumValue_deprecationReason(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := fieldContext___EnumValue_deprecationReason(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___EnumValue_deprecationReason(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Field_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Field_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Field_args(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_args(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_args(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___InputValue_name(ctx, ec, field) + case "description": + return fieldContext___InputValue_description(ctx, ec, field) + case "type": + return fieldContext___InputValue_type(ctx, ec, field) + case "defaultValue": + return fieldContext___InputValue_defaultValue(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func ___Field_type(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_type(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_type(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Field_isDeprecated(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_isDeprecated(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return marshalNBoolean2bool(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_isDeprecated(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func ___Field_deprecationReason(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := fieldContext___Field_deprecationReason(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Field_deprecationReason(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___InputValue_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalNString2string(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___InputValue_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___InputValue_type(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_type(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_type(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___InputValue_defaultValue(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := fieldContext___InputValue_defaultValue(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___InputValue_defaultValue(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Schema_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Schema_types(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_types(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_types(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_queryType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_queryType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_queryType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_mutationType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_mutationType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_mutationType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_subscriptionType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_subscriptionType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_subscriptionType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Schema_directives(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := fieldContext___Schema_directives(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Schema_directives(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___Directive_name(ctx, ec, field) + case "description": + return fieldContext___Directive_description(ctx, ec, field) + case "locations": + return fieldContext___Directive_locations(ctx, ec, field) + case "args": + return fieldContext___Directive_args(ctx, ec, field) + case "isRepeatable": + return fieldContext___Directive_isRepeatable(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func ___Type_kind(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_kind(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return marshalN__TypeKind2string(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_kind(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func ___Type_name(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_name(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_name(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Type_description(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_description(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_description(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func ___Type_fields(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_fields(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_fields(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___Field_name(ctx, ec, field) + case "description": + return fieldContext___Field_description(ctx, ec, field) + case "args": + return fieldContext___Field_args(ctx, ec, field) + case "type": + return fieldContext___Field_type(ctx, ec, field) + case "isDeprecated": + return fieldContext___Field_isDeprecated(ctx, ec, field) + case "deprecationReason": + return fieldContext___Field_deprecationReason(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field___Type_fields_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func ___Type_interfaces(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_interfaces(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_interfaces(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Type_possibleTypes(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_possibleTypes(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_possibleTypes(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Type_enumValues(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_enumValues(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_enumValues(ctx context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___EnumValue_name(ctx, ec, field) + case "description": + return fieldContext___EnumValue_description(ctx, ec, field) + case "isDeprecated": + return fieldContext___EnumValue_isDeprecated(ctx, ec, field) + case "deprecationReason": + return fieldContext___EnumValue_deprecationReason(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = field___Type_enumValues_args(ctx, ec, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func ___Type_inputFields(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_inputFields(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_inputFields(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return fieldContext___InputValue_name(ctx, ec, field) + case "description": + return fieldContext___InputValue_description(ctx, ec, field) + case "type": + return fieldContext___InputValue_type(ctx, ec, field) + case "defaultValue": + return fieldContext___InputValue_defaultValue(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func ___Type_ofType(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_ofType(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_ofType(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return fieldContext___Type_kind(ctx, ec, field) + case "name": + return fieldContext___Type_name(ctx, ec, field) + case "description": + return fieldContext___Type_description(ctx, ec, field) + case "fields": + return fieldContext___Type_fields(ctx, ec, field) + case "interfaces": + return fieldContext___Type_interfaces(ctx, ec, field) + case "possibleTypes": + return fieldContext___Type_possibleTypes(ctx, ec, field) + case "enumValues": + return fieldContext___Type_enumValues(ctx, ec, field) + case "inputFields": + return fieldContext___Type_inputFields(ctx, ec, field) + case "ofType": + return fieldContext___Type_ofType(ctx, ec, field) + case "specifiedByURL": + return fieldContext___Type_specifiedByURL(ctx, ec, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func ___Type_specifiedByURL(ctx context.Context, ec *executionContext, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := fieldContext___Type_specifiedByURL(ctx, ec, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return marshalOString2ᚖstring(ctx, ec, field.Selections, res) +} + +func fieldContext___Type_specifiedByURL(_ context.Context, ec *executionContext, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func unmarshalInputMultiHelloByNamesInput(ctx context.Context, ec *executionContext, obj interface{}) (model.MultiHelloByNamesInput, error) { + var it model.MultiHelloByNamesInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func unmarshalInputMultiHelloMultipleRequiresByNamesInput(ctx context.Context, ec *executionContext, obj interface{}) (model.MultiHelloMultipleRequiresByNamesInput, error) { + var it model.MultiHelloMultipleRequiresByNamesInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func unmarshalInputMultiHelloRequiresByNamesInput(ctx context.Context, ec *executionContext, obj interface{}) (model.MultiHelloRequiresByNamesInput, error) { + var it model.MultiHelloRequiresByNamesInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func unmarshalInputMultiHelloWithErrorByNamesInput(ctx context.Context, ec *executionContext, obj interface{}) (model.MultiHelloWithErrorByNamesInput, error) { + var it model.MultiHelloWithErrorByNamesInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func unmarshalInputMultiPlanetRequiresNestedByNamesInput(ctx context.Context, ec *executionContext, obj interface{}) (model.MultiPlanetRequiresNestedByNamesInput, error) { + var it model.MultiPlanetRequiresNestedByNamesInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"Name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "Name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + data, err := unmarshalNString2string(ctx, ec, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func __Entity(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj fedruntime.Entity) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case model.Hello: + return _Hello(ctx, ec, sel, &obj) + case *model.Hello: + if obj == nil { + return graphql.Null + } + return _Hello(ctx, ec, sel, obj) + case model.HelloMultiSingleKeys: + return _HelloMultiSingleKeys(ctx, ec, sel, &obj) + case *model.HelloMultiSingleKeys: + if obj == nil { + return graphql.Null + } + return _HelloMultiSingleKeys(ctx, ec, sel, obj) + case model.HelloWithErrors: + return _HelloWithErrors(ctx, ec, sel, &obj) + case *model.HelloWithErrors: + if obj == nil { + return graphql.Null + } + return _HelloWithErrors(ctx, ec, sel, obj) + case model.MultiHello: + return _MultiHello(ctx, ec, sel, &obj) + case *model.MultiHello: + if obj == nil { + return graphql.Null + } + return _MultiHello(ctx, ec, sel, obj) + case model.MultiHelloMultipleRequires: + return _MultiHelloMultipleRequires(ctx, ec, sel, &obj) + case *model.MultiHelloMultipleRequires: + if obj == nil { + return graphql.Null + } + return _MultiHelloMultipleRequires(ctx, ec, sel, obj) + case model.MultiHelloRequires: + return _MultiHelloRequires(ctx, ec, sel, &obj) + case *model.MultiHelloRequires: + if obj == nil { + return graphql.Null + } + return _MultiHelloRequires(ctx, ec, sel, obj) + case model.MultiHelloWithError: + return _MultiHelloWithError(ctx, ec, sel, &obj) + case *model.MultiHelloWithError: + if obj == nil { + return graphql.Null + } + return _MultiHelloWithError(ctx, ec, sel, obj) + case model.MultiPlanetRequiresNested: + return _MultiPlanetRequiresNested(ctx, ec, sel, &obj) + case *model.MultiPlanetRequiresNested: + if obj == nil { + return graphql.Null + } + return _MultiPlanetRequiresNested(ctx, ec, sel, obj) + case model.PlanetMultipleRequires: + return _PlanetMultipleRequires(ctx, ec, sel, &obj) + case *model.PlanetMultipleRequires: + if obj == nil { + return graphql.Null + } + return _PlanetMultipleRequires(ctx, ec, sel, obj) + case model.PlanetRequires: + return _PlanetRequires(ctx, ec, sel, &obj) + case *model.PlanetRequires: + if obj == nil { + return graphql.Null + } + return _PlanetRequires(ctx, ec, sel, obj) + case model.PlanetRequiresNested: + return _PlanetRequiresNested(ctx, ec, sel, &obj) + case *model.PlanetRequiresNested: + if obj == nil { + return graphql.Null + } + return _PlanetRequiresNested(ctx, ec, sel, obj) + case model.World: + return _World(ctx, ec, sel, &obj) + case *model.World: + if obj == nil { + return graphql.Null + } + return _World(ctx, ec, sel, obj) + case model.WorldName: + return _WorldName(ctx, ec, sel, &obj) + case *model.WorldName: + if obj == nil { + return graphql.Null + } + return _WorldName(ctx, ec, sel, obj) + case model.WorldWithMultipleKeys: + return _WorldWithMultipleKeys(ctx, ec, sel, &obj) + case *model.WorldWithMultipleKeys: + if obj == nil { + return graphql.Null + } + return _WorldWithMultipleKeys(ctx, ec, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var entityImplementors = []string{"Entity"} + +func _Entity(ctx context.Context, ec *executionContext, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, entityImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Entity", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Entity") + case "findHelloByName": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findHelloByName(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findHelloMultiSingleKeysByKey1AndKey2": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findHelloMultiSingleKeysByKey1AndKey2(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findHelloWithErrorsByName": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findHelloWithErrorsByName(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findManyMultiHelloByNames": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findManyMultiHelloByNames(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findManyMultiHelloMultipleRequiresByNames": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findManyMultiHelloMultipleRequiresByNames(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findManyMultiHelloRequiresByNames": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findManyMultiHelloRequiresByNames(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findManyMultiHelloWithErrorByNames": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findManyMultiHelloWithErrorByNames(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findManyMultiPlanetRequiresNestedByNames": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findManyMultiPlanetRequiresNestedByNames(ctx, ec, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findPlanetMultipleRequiresByName": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findPlanetMultipleRequiresByName(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findPlanetRequiresByName": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findPlanetRequiresByName(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findPlanetRequiresNestedByName": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findPlanetRequiresNestedByName(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findWorldByHelloNameAndFoo": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findWorldByHelloNameAndFoo(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findWorldNameByName": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findWorldNameByName(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findWorldWithMultipleKeysByHelloNameAndFoo": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findWorldWithMultipleKeysByHelloNameAndFoo(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "findWorldWithMultipleKeysByBar": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Entity_findWorldWithMultipleKeysByBar(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var helloImplementors = []string{"Hello", "_Entity"} + +func _Hello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.Hello) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, helloImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Hello") + case "name": + out.Values[i] = _Hello_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "secondary": + out.Values[i] = _Hello_secondary(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var helloMultiSingleKeysImplementors = []string{"HelloMultiSingleKeys", "_Entity"} + +func _HelloMultiSingleKeys(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.HelloMultiSingleKeys) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, helloMultiSingleKeysImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("HelloMultiSingleKeys") + case "key1": + out.Values[i] = _HelloMultiSingleKeys_key1(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "key2": + out.Values[i] = _HelloMultiSingleKeys_key2(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var helloWithErrorsImplementors = []string{"HelloWithErrors", "_Entity"} + +func _HelloWithErrors(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.HelloWithErrors) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, helloWithErrorsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("HelloWithErrors") + case "name": + out.Values[i] = _HelloWithErrors_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var multiHelloImplementors = []string{"MultiHello", "_Entity"} + +func _MultiHello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.MultiHello) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, multiHelloImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MultiHello") + case "name": + out.Values[i] = _MultiHello_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var multiHelloMultipleRequiresImplementors = []string{"MultiHelloMultipleRequires", "_Entity"} + +func _MultiHelloMultipleRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.MultiHelloMultipleRequires) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, multiHelloMultipleRequiresImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MultiHelloMultipleRequires") + case "name": + out.Values[i] = _MultiHelloMultipleRequires_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "key1": + out.Values[i] = _MultiHelloMultipleRequires_key1(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "key2": + out.Values[i] = _MultiHelloMultipleRequires_key2(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "key3": + out.Values[i] = _MultiHelloMultipleRequires_key3(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var multiHelloRequiresImplementors = []string{"MultiHelloRequires", "_Entity"} + +func _MultiHelloRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.MultiHelloRequires) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, multiHelloRequiresImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MultiHelloRequires") + case "name": + out.Values[i] = _MultiHelloRequires_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "key1": + out.Values[i] = _MultiHelloRequires_key1(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "key2": + out.Values[i] = _MultiHelloRequires_key2(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var multiHelloWithErrorImplementors = []string{"MultiHelloWithError", "_Entity"} + +func _MultiHelloWithError(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.MultiHelloWithError) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, multiHelloWithErrorImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MultiHelloWithError") + case "name": + out.Values[i] = _MultiHelloWithError_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var multiPlanetRequiresNestedImplementors = []string{"MultiPlanetRequiresNested", "_Entity"} + +func _MultiPlanetRequiresNested(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.MultiPlanetRequiresNested) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, multiPlanetRequiresNestedImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MultiPlanetRequiresNested") + case "name": + out.Values[i] = _MultiPlanetRequiresNested_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "world": + out.Values[i] = _MultiPlanetRequiresNested_world(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "size": + out.Values[i] = _MultiPlanetRequiresNested_size(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var planetMultipleRequiresImplementors = []string{"PlanetMultipleRequires", "_Entity"} + +func _PlanetMultipleRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.PlanetMultipleRequires) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, planetMultipleRequiresImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PlanetMultipleRequires") + case "name": + out.Values[i] = _PlanetMultipleRequires_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "diameter": + out.Values[i] = _PlanetMultipleRequires_diameter(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "density": + out.Values[i] = _PlanetMultipleRequires_density(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "weight": + out.Values[i] = _PlanetMultipleRequires_weight(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var planetRequiresImplementors = []string{"PlanetRequires", "_Entity"} + +func _PlanetRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.PlanetRequires) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, planetRequiresImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PlanetRequires") + case "name": + out.Values[i] = _PlanetRequires_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "size": + out.Values[i] = _PlanetRequires_size(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "diameter": + out.Values[i] = _PlanetRequires_diameter(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var planetRequiresNestedImplementors = []string{"PlanetRequiresNested", "_Entity"} + +func _PlanetRequiresNested(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.PlanetRequiresNested) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, planetRequiresNestedImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PlanetRequiresNested") + case "name": + out.Values[i] = _PlanetRequiresNested_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "world": + out.Values[i] = _PlanetRequiresNested_world(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "size": + out.Values[i] = _PlanetRequiresNested_size(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var queryImplementors = []string{"Query"} + +func _Query(ctx context.Context, ec *executionContext, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "_entities": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Query__entities(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "_service": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = _Query__service(ctx, ec, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return _Query___type(ctx, ec, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return _Query___schema(ctx, ec, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var worldImplementors = []string{"World", "_Entity"} + +func _World(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.World) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, worldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("World") + case "foo": + out.Values[i] = _World_foo(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "bar": + out.Values[i] = _World_bar(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "hello": + out.Values[i] = _World_hello(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var worldNameImplementors = []string{"WorldName", "_Entity"} + +func _WorldName(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.WorldName) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, worldNameImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("WorldName") + case "name": + out.Values[i] = _WorldName_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var worldWithMultipleKeysImplementors = []string{"WorldWithMultipleKeys", "_Entity"} + +func _WorldWithMultipleKeys(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *model.WorldWithMultipleKeys) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, worldWithMultipleKeysImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("WorldWithMultipleKeys") + case "foo": + out.Values[i] = _WorldWithMultipleKeys_foo(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "bar": + out.Values[i] = _WorldWithMultipleKeys_bar(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "hello": + out.Values[i] = _WorldWithMultipleKeys_hello(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var _ServiceImplementors = []string{"_Service"} + +func __Service(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *fedruntime.Service) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ServiceImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("_Service") + case "sdl": + out.Values[i] = __Service_sdl(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func ___Directive(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ___Directive_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___Directive_description(ctx, ec, field, obj) + case "locations": + out.Values[i] = ___Directive_locations(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ___Directive_args(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRepeatable": + out.Values[i] = ___Directive_isRepeatable(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func ___EnumValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ___EnumValue_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___EnumValue_description(ctx, ec, field, obj) + case "isDeprecated": + out.Values[i] = ___EnumValue_isDeprecated(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ___EnumValue_deprecationReason(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func ___Field(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ___Field_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___Field_description(ctx, ec, field, obj) + case "args": + out.Values[i] = ___Field_args(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ___Field_type(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ___Field_isDeprecated(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ___Field_deprecationReason(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func ___InputValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ___InputValue_name(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ___InputValue_description(ctx, ec, field, obj) + case "type": + out.Values[i] = ___InputValue_type(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ___InputValue_defaultValue(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func ___Schema(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ___Schema_description(ctx, ec, field, obj) + case "types": + out.Values[i] = ___Schema_types(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ___Schema_queryType(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ___Schema_mutationType(ctx, ec, field, obj) + case "subscriptionType": + out.Values[i] = ___Schema_subscriptionType(ctx, ec, field, obj) + case "directives": + out.Values[i] = ___Schema_directives(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func ___Type(ctx context.Context, ec *executionContext, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ___Type_kind(ctx, ec, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ___Type_name(ctx, ec, field, obj) + case "description": + out.Values[i] = ___Type_description(ctx, ec, field, obj) + case "fields": + out.Values[i] = ___Type_fields(ctx, ec, field, obj) + case "interfaces": + out.Values[i] = ___Type_interfaces(ctx, ec, field, obj) + case "possibleTypes": + out.Values[i] = ___Type_possibleTypes(ctx, ec, field, obj) + case "enumValues": + out.Values[i] = ___Type_enumValues(ctx, ec, field, obj) + case "inputFields": + out.Values[i] = ___Type_inputFields(ctx, ec, field, obj) + case "ofType": + out.Values[i] = ___Type_ofType(ctx, ec, field, obj) + case "specifiedByURL": + out.Values[i] = ___Type_specifiedByURL(ctx, ec, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func unmarshalNBoolean2bool(ctx context.Context, ec *executionContext, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNBoolean2bool(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func marshalNHello2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.Hello) graphql.Marshaler { + return _Hello(ctx, ec, sel, &v) +} + +func marshalNHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.Hello) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _Hello(ctx, ec, sel, v) +} + +func marshalNHelloMultiSingleKeys2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHelloMultiSingleKeys(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.HelloMultiSingleKeys) graphql.Marshaler { + return _HelloMultiSingleKeys(ctx, ec, sel, &v) +} + +func marshalNHelloMultiSingleKeys2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHelloMultiSingleKeys(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.HelloMultiSingleKeys) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _HelloMultiSingleKeys(ctx, ec, sel, v) +} + +func marshalNHelloWithErrors2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHelloWithErrors(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.HelloWithErrors) graphql.Marshaler { + return _HelloWithErrors(ctx, ec, sel, &v) +} + +func marshalNHelloWithErrors2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHelloWithErrors(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.HelloWithErrors) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _HelloWithErrors(ctx, ec, sel, v) +} + +func unmarshalNInt2int(ctx context.Context, ec *executionContext, v interface{}) (int, error) { + res, err := graphql.UnmarshalInt(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNInt2int(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v int) graphql.Marshaler { + res := graphql.MarshalInt(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalNMultiHelloByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloByNamesInput(ctx context.Context, ec *executionContext, v interface{}) ([]*model.MultiHelloByNamesInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.MultiHelloByNamesInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalOMultiHelloByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloByNamesInput(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func unmarshalNMultiHelloMultipleRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequiresByNamesInput(ctx context.Context, ec *executionContext, v interface{}) ([]*model.MultiHelloMultipleRequiresByNamesInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.MultiHelloMultipleRequiresByNamesInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalOMultiHelloMultipleRequiresByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequiresByNamesInput(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func unmarshalNMultiHelloRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequiresByNamesInput(ctx context.Context, ec *executionContext, v interface{}) ([]*model.MultiHelloRequiresByNamesInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.MultiHelloRequiresByNamesInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalOMultiHelloRequiresByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequiresByNamesInput(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func unmarshalNMultiHelloWithErrorByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithErrorByNamesInput(ctx context.Context, ec *executionContext, v interface{}) ([]*model.MultiHelloWithErrorByNamesInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.MultiHelloWithErrorByNamesInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalOMultiHelloWithErrorByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithErrorByNamesInput(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func unmarshalNMultiPlanetRequiresNestedByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNestedByNamesInput(ctx context.Context, ec *executionContext, v interface{}) ([]*model.MultiPlanetRequiresNestedByNamesInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.MultiPlanetRequiresNestedByNamesInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalOMultiPlanetRequiresNestedByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNestedByNamesInput(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func marshalNPlanetMultipleRequires2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetMultipleRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.PlanetMultipleRequires) graphql.Marshaler { + return _PlanetMultipleRequires(ctx, ec, sel, &v) +} + +func marshalNPlanetMultipleRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetMultipleRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.PlanetMultipleRequires) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _PlanetMultipleRequires(ctx, ec, sel, v) +} + +func marshalNPlanetRequires2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.PlanetRequires) graphql.Marshaler { + return _PlanetRequires(ctx, ec, sel, &v) +} + +func marshalNPlanetRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.PlanetRequires) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _PlanetRequires(ctx, ec, sel, v) +} + +func marshalNPlanetRequiresNested2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetRequiresNested(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.PlanetRequiresNested) graphql.Marshaler { + return _PlanetRequiresNested(ctx, ec, sel, &v) +} + +func marshalNPlanetRequiresNested2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐPlanetRequiresNested(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.PlanetRequiresNested) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _PlanetRequiresNested(ctx, ec, sel, v) +} + +func unmarshalNString2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalNString2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func marshalNWorld2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorld(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.World) graphql.Marshaler { + return _World(ctx, ec, sel, &v) +} + +func marshalNWorld2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorld(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.World) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _World(ctx, ec, sel, v) +} + +func marshalNWorldName2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldName(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.WorldName) graphql.Marshaler { + return _WorldName(ctx, ec, sel, &v) +} + +func marshalNWorldName2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldName(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.WorldName) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _WorldName(ctx, ec, sel, v) +} + +func marshalNWorldWithMultipleKeys2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldWithMultipleKeys(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v model.WorldWithMultipleKeys) graphql.Marshaler { + return _WorldWithMultipleKeys(ctx, ec, sel, &v) +} + +func marshalNWorldWithMultipleKeys2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐWorldWithMultipleKeys(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.WorldWithMultipleKeys) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return _WorldWithMultipleKeys(ctx, ec, sel, v) +} + +func unmarshalN_Any2map(ctx context.Context, ec *executionContext, v interface{}) (map[string]interface{}, error) { + res, err := graphql.UnmarshalMap(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalN_Any2map(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + res := graphql.MarshalMap(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalN_Any2ᚕmapᚄ(ctx context.Context, ec *executionContext, v interface{}) ([]map[string]interface{}, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]map[string]interface{}, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalN_Any2map(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func marshalN_Any2ᚕmapᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []map[string]interface{}) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = marshalN_Any2map(ctx, ec, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []fedruntime.Entity) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalO_Entity2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func unmarshalN_FieldSet2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalN_FieldSet2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func marshalN_Service2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐService(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v fedruntime.Service) graphql.Marshaler { + return __Service(ctx, ec, sel, &v) +} + +func marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ___Directive(ctx, ec, sel, &v) +} + +func marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func unmarshalN__DirectiveLocation2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalN__DirectiveLocation2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, ec *executionContext, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = unmarshalN__DirectiveLocation2string(ctx, ec, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__DirectiveLocation2string(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ___EnumValue(ctx, ec, sel, &v) +} + +func marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ___Field(ctx, ec, sel, &v) +} + +func marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ___InputValue(ctx, ec, sel, &v) +} + +func marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ___Type(ctx, ec, sel, &v) +} + +func marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ___Type(ctx, ec, sel, v) +} + +func unmarshalN__TypeKind2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalN__TypeKind2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func unmarshalOBoolean2bool(ctx context.Context, ec *executionContext, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOBoolean2bool(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + return res +} + +func unmarshalOBoolean2ᚖbool(ctx context.Context, ec *executionContext, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOBoolean2ᚖbool(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalBoolean(*v) + return res +} + +func marshalOHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐHello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.Hello) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _Hello(ctx, ec, sel, v) +} + +func marshalOMultiHello2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []*model.MultiHello) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalOMultiHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHello(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func marshalOMultiHello2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHello(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.MultiHello) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _MultiHello(ctx, ec, sel, v) +} + +func unmarshalOMultiHelloByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloByNamesInput(ctx context.Context, ec *executionContext, v interface{}) (*model.MultiHelloByNamesInput, error) { + if v == nil { + return nil, nil + } + res, err := unmarshalInputMultiHelloByNamesInput(ctx, ec, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOMultiHelloMultipleRequires2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []*model.MultiHelloMultipleRequires) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalOMultiHelloMultipleRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequires(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func marshalOMultiHelloMultipleRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.MultiHelloMultipleRequires) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _MultiHelloMultipleRequires(ctx, ec, sel, v) +} + +func unmarshalOMultiHelloMultipleRequiresByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloMultipleRequiresByNamesInput(ctx context.Context, ec *executionContext, v interface{}) (*model.MultiHelloMultipleRequiresByNamesInput, error) { + if v == nil { + return nil, nil + } + res, err := unmarshalInputMultiHelloMultipleRequiresByNamesInput(ctx, ec, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOMultiHelloRequires2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []*model.MultiHelloRequires) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalOMultiHelloRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequires(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func marshalOMultiHelloRequires2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequires(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.MultiHelloRequires) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _MultiHelloRequires(ctx, ec, sel, v) +} + +func unmarshalOMultiHelloRequiresByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloRequiresByNamesInput(ctx context.Context, ec *executionContext, v interface{}) (*model.MultiHelloRequiresByNamesInput, error) { + if v == nil { + return nil, nil + } + res, err := unmarshalInputMultiHelloRequiresByNamesInput(ctx, ec, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOMultiHelloWithError2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithError(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []*model.MultiHelloWithError) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalOMultiHelloWithError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithError(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func marshalOMultiHelloWithError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithError(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.MultiHelloWithError) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _MultiHelloWithError(ctx, ec, sel, v) +} + +func unmarshalOMultiHelloWithErrorByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiHelloWithErrorByNamesInput(ctx context.Context, ec *executionContext, v interface{}) (*model.MultiHelloWithErrorByNamesInput, error) { + if v == nil { + return nil, nil + } + res, err := unmarshalInputMultiHelloWithErrorByNamesInput(ctx, ec, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOMultiPlanetRequiresNested2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNested(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []*model.MultiPlanetRequiresNested) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalOMultiPlanetRequiresNested2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNested(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func marshalOMultiPlanetRequiresNested2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNested(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *model.MultiPlanetRequiresNested) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return _MultiPlanetRequiresNested(ctx, ec, sel, v) +} + +func unmarshalOMultiPlanetRequiresNestedByNamesInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋusefunctionsyntaxforexecutioncontextᚋgeneratedᚋmodelᚐMultiPlanetRequiresNestedByNamesInput(ctx context.Context, ec *executionContext, v interface{}) (*model.MultiPlanetRequiresNestedByNamesInput, error) { + if v == nil { + return nil, nil + } + res, err := unmarshalInputMultiPlanetRequiresNestedByNamesInput(ctx, ec, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func unmarshalOString2string(ctx context.Context, ec *executionContext, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOString2string(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + return res +} + +func unmarshalOString2ᚖstring(ctx context.Context, ec *executionContext, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func marshalOString2ᚖstring(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func marshalO_Entity2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v fedruntime.Entity) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return __Entity(ctx, ec, sel, v) +} + +func marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ___Schema(ctx, ec, sel, v) +} + +func marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, ec, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, ec *executionContext, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ___Type(ctx, ec, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/federation.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/federation.go new file mode 100644 index 00000000000..107b9e21bc6 --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/federation.go @@ -0,0 +1,1031 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package generated + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + + "github.com/99designs/gqlgen/plugin/federation/fedruntime" + "github.com/99designs/gqlgen/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model" +) + +var ( + ErrUnknownType = errors.New("unknown type") + ErrTypeNotFound = errors.New("type not found") +) + +func (ec *executionContext) __resolve__service(ctx context.Context) (fedruntime.Service, error) { + if ec.DisableIntrospection { + return fedruntime.Service{}, errors.New("federated introspection disabled") + } + + var sdl []string + + for _, src := range sources { + if src.BuiltIn { + continue + } + sdl = append(sdl, src.Input) + } + + return fedruntime.Service{ + SDL: strings.Join(sdl, "\n"), + }, nil +} + +func (ec *executionContext) __resolve_entities(ctx context.Context, representations []map[string]interface{}) []fedruntime.Entity { + list := make([]fedruntime.Entity, len(representations)) + + repsMap := ec.buildRepresentationGroups(ctx, representations) + + switch len(repsMap) { + case 0: + return list + case 1: + for typeName, reps := range repsMap { + ec.resolveEntityGroup(ctx, typeName, reps, list) + } + return list + default: + var g sync.WaitGroup + g.Add(len(repsMap)) + for typeName, reps := range repsMap { + go func(typeName string, reps []EntityWithIndex) { + ec.resolveEntityGroup(ctx, typeName, reps, list) + g.Done() + }(typeName, reps) + } + g.Wait() + return list + } +} + +type EntityWithIndex struct { + // The index in the original representation array + index int + entity EntityRepresentation +} + +// EntityRepresentation is the JSON representation of an entity sent by the Router +// used as the inputs for us to resolve. +// +// We make it a map because we know the top level JSON is always an object. +type EntityRepresentation map[string]any + +// We group entities by typename so that we can parallelize their resolution. +// This is particularly helpful when there are entity groups in multi mode. +func (ec *executionContext) buildRepresentationGroups( + ctx context.Context, + representations []map[string]any, +) map[string][]EntityWithIndex { + repsMap := make(map[string][]EntityWithIndex) + for i, rep := range representations { + typeName, ok := rep["__typename"].(string) + if !ok { + // If there is no __typename, we just skip the representation; + // we just won't be resolving these unknown types. + ec.Error(ctx, errors.New("__typename must be an existing string")) + continue + } + + repsMap[typeName] = append(repsMap[typeName], EntityWithIndex{ + index: i, + entity: rep, + }) + } + + return repsMap +} + +func (ec *executionContext) resolveEntityGroup( + ctx context.Context, + typeName string, + reps []EntityWithIndex, + list []fedruntime.Entity, +) { + if isMulti(typeName) { + err := ec.resolveManyEntities(ctx, typeName, reps, list) + if err != nil { + ec.Error(ctx, err) + } + } else { + // if there are multiple entities to resolve, parallelize (similar to + // graphql.FieldSet.Dispatch) + var e sync.WaitGroup + e.Add(len(reps)) + for i, rep := range reps { + i, rep := i, rep + go func(i int, rep EntityWithIndex) { + entity, err := ec.resolveEntity(ctx, typeName, rep.entity) + if err != nil { + ec.Error(ctx, err) + } else { + list[rep.index] = entity + } + e.Done() + }(i, rep) + } + e.Wait() + } +} + +func isMulti(typeName string) bool { + switch typeName { + case "MultiHello": + return true + case "MultiHelloMultipleRequires": + return true + case "MultiHelloRequires": + return true + case "MultiHelloWithError": + return true + case "MultiPlanetRequiresNested": + return true + default: + return false + } +} + +func (ec *executionContext) resolveEntity( + ctx context.Context, + typeName string, + rep EntityRepresentation, +) (e fedruntime.Entity, err error) { + // we need to do our own panic handling, because we may be called in a + // goroutine, where the usual panic handling can't catch us + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + } + }() + + switch typeName { + case "Hello": + resolverName, err := entityResolverNameForHello(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "Hello": %w`, err) + } + switch resolverName { + + case "findHelloByName": + id0, err := unmarshalNString2string(ctx, ec, rep["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findHelloByName(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindHelloByName(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "Hello": %w`, err) + } + + return entity, nil + } + case "HelloMultiSingleKeys": + resolverName, err := entityResolverNameForHelloMultiSingleKeys(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "HelloMultiSingleKeys": %w`, err) + } + switch resolverName { + + case "findHelloMultiSingleKeysByKey1AndKey2": + id0, err := unmarshalNString2string(ctx, ec, rep["key1"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findHelloMultiSingleKeysByKey1AndKey2(): %w`, err) + } + id1, err := unmarshalNString2string(ctx, ec, rep["key2"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 1 for findHelloMultiSingleKeysByKey1AndKey2(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindHelloMultiSingleKeysByKey1AndKey2(ctx, id0, id1) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "HelloMultiSingleKeys": %w`, err) + } + + return entity, nil + } + case "HelloWithErrors": + resolverName, err := entityResolverNameForHelloWithErrors(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "HelloWithErrors": %w`, err) + } + switch resolverName { + + case "findHelloWithErrorsByName": + id0, err := unmarshalNString2string(ctx, ec, rep["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findHelloWithErrorsByName(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindHelloWithErrorsByName(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "HelloWithErrors": %w`, err) + } + + return entity, nil + } + case "PlanetMultipleRequires": + resolverName, err := entityResolverNameForPlanetMultipleRequires(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "PlanetMultipleRequires": %w`, err) + } + switch resolverName { + + case "findPlanetMultipleRequiresByName": + id0, err := unmarshalNString2string(ctx, ec, rep["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findPlanetMultipleRequiresByName(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindPlanetMultipleRequiresByName(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "PlanetMultipleRequires": %w`, err) + } + + entity.Diameter, err = unmarshalNInt2int(ctx, ec, rep["diameter"]) + if err != nil { + return nil, err + } + entity.Density, err = unmarshalNInt2int(ctx, ec, rep["density"]) + if err != nil { + return nil, err + } + return entity, nil + } + case "PlanetRequires": + resolverName, err := entityResolverNameForPlanetRequires(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "PlanetRequires": %w`, err) + } + switch resolverName { + + case "findPlanetRequiresByName": + id0, err := unmarshalNString2string(ctx, ec, rep["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findPlanetRequiresByName(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindPlanetRequiresByName(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "PlanetRequires": %w`, err) + } + + entity.Diameter, err = unmarshalNInt2int(ctx, ec, rep["diameter"]) + if err != nil { + return nil, err + } + return entity, nil + } + case "PlanetRequiresNested": + resolverName, err := entityResolverNameForPlanetRequiresNested(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "PlanetRequiresNested": %w`, err) + } + switch resolverName { + + case "findPlanetRequiresNestedByName": + id0, err := unmarshalNString2string(ctx, ec, rep["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findPlanetRequiresNestedByName(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindPlanetRequiresNestedByName(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "PlanetRequiresNested": %w`, err) + } + + entity.World.Foo, err = unmarshalNString2string(ctx, ec, rep["world"].(map[string]interface{})["foo"]) + if err != nil { + return nil, err + } + return entity, nil + } + case "World": + resolverName, err := entityResolverNameForWorld(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "World": %w`, err) + } + switch resolverName { + + case "findWorldByHelloNameAndFoo": + id0, err := unmarshalNString2string(ctx, ec, rep["hello"].(map[string]interface{})["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findWorldByHelloNameAndFoo(): %w`, err) + } + id1, err := unmarshalNString2string(ctx, ec, rep["foo"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 1 for findWorldByHelloNameAndFoo(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindWorldByHelloNameAndFoo(ctx, id0, id1) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "World": %w`, err) + } + + return entity, nil + } + case "WorldName": + resolverName, err := entityResolverNameForWorldName(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "WorldName": %w`, err) + } + switch resolverName { + + case "findWorldNameByName": + id0, err := unmarshalNString2string(ctx, ec, rep["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findWorldNameByName(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindWorldNameByName(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "WorldName": %w`, err) + } + + return entity, nil + } + case "WorldWithMultipleKeys": + resolverName, err := entityResolverNameForWorldWithMultipleKeys(ctx, rep) + if err != nil { + return nil, fmt.Errorf(`finding resolver for Entity "WorldWithMultipleKeys": %w`, err) + } + switch resolverName { + + case "findWorldWithMultipleKeysByHelloNameAndFoo": + id0, err := unmarshalNString2string(ctx, ec, rep["hello"].(map[string]interface{})["name"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findWorldWithMultipleKeysByHelloNameAndFoo(): %w`, err) + } + id1, err := unmarshalNString2string(ctx, ec, rep["foo"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 1 for findWorldWithMultipleKeysByHelloNameAndFoo(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindWorldWithMultipleKeysByHelloNameAndFoo(ctx, id0, id1) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "WorldWithMultipleKeys": %w`, err) + } + + return entity, nil + case "findWorldWithMultipleKeysByBar": + id0, err := unmarshalNInt2int(ctx, ec, rep["bar"]) + if err != nil { + return nil, fmt.Errorf(`unmarshalling param 0 for findWorldWithMultipleKeysByBar(): %w`, err) + } + entity, err := ec.resolvers.Entity().FindWorldWithMultipleKeysByBar(ctx, id0) + if err != nil { + return nil, fmt.Errorf(`resolving Entity "WorldWithMultipleKeys": %w`, err) + } + + return entity, nil + } + + } + return nil, fmt.Errorf("%w: %s", ErrUnknownType, typeName) +} + +func (ec *executionContext) resolveManyEntities( + ctx context.Context, + typeName string, + reps []EntityWithIndex, + list []fedruntime.Entity, +) (err error) { + // we need to do our own panic handling, because we may be called in a + // goroutine, where the usual panic handling can't catch us + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + } + }() + + switch typeName { + + case "MultiHello": + resolverName, err := entityResolverNameForMultiHello(ctx, reps[0].entity) + if err != nil { + return fmt.Errorf(`finding resolver for Entity "MultiHello": %w`, err) + } + switch resolverName { + + case "findManyMultiHelloByNames": + typedReps := make([]*model.MultiHelloByNamesInput, len(reps)) + + for i, rep := range reps { + id0, err := unmarshalNString2string(ctx, ec, rep.entity["name"]) + if err != nil { + return errors.New(fmt.Sprintf("Field %s undefined in schema.", "name")) + } + + typedReps[i] = &model.MultiHelloByNamesInput{ + Name: id0, + } + } + + entities, err := ec.resolvers.Entity().FindManyMultiHelloByNames(ctx, typedReps) + if err != nil { + return err + } + + for i, entity := range entities { + list[reps[i].index] = entity + } + return nil + + default: + return fmt.Errorf("unknown resolver: %s", resolverName) + } + + case "MultiHelloMultipleRequires": + resolverName, err := entityResolverNameForMultiHelloMultipleRequires(ctx, reps[0].entity) + if err != nil { + return fmt.Errorf(`finding resolver for Entity "MultiHelloMultipleRequires": %w`, err) + } + switch resolverName { + + case "findManyMultiHelloMultipleRequiresByNames": + typedReps := make([]*model.MultiHelloMultipleRequiresByNamesInput, len(reps)) + + for i, rep := range reps { + id0, err := unmarshalNString2string(ctx, ec, rep.entity["name"]) + if err != nil { + return errors.New(fmt.Sprintf("Field %s undefined in schema.", "name")) + } + + typedReps[i] = &model.MultiHelloMultipleRequiresByNamesInput{ + Name: id0, + } + } + + entities, err := ec.resolvers.Entity().FindManyMultiHelloMultipleRequiresByNames(ctx, typedReps) + if err != nil { + return err + } + + for i, entity := range entities { + entity.Key1, err = unmarshalNString2string(ctx, ec, reps[i].entity["key1"]) + if err != nil { + return err + } + entity.Key2, err = unmarshalNString2string(ctx, ec, reps[i].entity["key2"]) + if err != nil { + return err + } + list[reps[i].index] = entity + } + return nil + + default: + return fmt.Errorf("unknown resolver: %s", resolverName) + } + + case "MultiHelloRequires": + resolverName, err := entityResolverNameForMultiHelloRequires(ctx, reps[0].entity) + if err != nil { + return fmt.Errorf(`finding resolver for Entity "MultiHelloRequires": %w`, err) + } + switch resolverName { + + case "findManyMultiHelloRequiresByNames": + typedReps := make([]*model.MultiHelloRequiresByNamesInput, len(reps)) + + for i, rep := range reps { + id0, err := unmarshalNString2string(ctx, ec, rep.entity["name"]) + if err != nil { + return errors.New(fmt.Sprintf("Field %s undefined in schema.", "name")) + } + + typedReps[i] = &model.MultiHelloRequiresByNamesInput{ + Name: id0, + } + } + + entities, err := ec.resolvers.Entity().FindManyMultiHelloRequiresByNames(ctx, typedReps) + if err != nil { + return err + } + + for i, entity := range entities { + entity.Key1, err = unmarshalNString2string(ctx, ec, reps[i].entity["key1"]) + if err != nil { + return err + } + list[reps[i].index] = entity + } + return nil + + default: + return fmt.Errorf("unknown resolver: %s", resolverName) + } + + case "MultiHelloWithError": + resolverName, err := entityResolverNameForMultiHelloWithError(ctx, reps[0].entity) + if err != nil { + return fmt.Errorf(`finding resolver for Entity "MultiHelloWithError": %w`, err) + } + switch resolverName { + + case "findManyMultiHelloWithErrorByNames": + typedReps := make([]*model.MultiHelloWithErrorByNamesInput, len(reps)) + + for i, rep := range reps { + id0, err := unmarshalNString2string(ctx, ec, rep.entity["name"]) + if err != nil { + return errors.New(fmt.Sprintf("Field %s undefined in schema.", "name")) + } + + typedReps[i] = &model.MultiHelloWithErrorByNamesInput{ + Name: id0, + } + } + + entities, err := ec.resolvers.Entity().FindManyMultiHelloWithErrorByNames(ctx, typedReps) + if err != nil { + return err + } + + for i, entity := range entities { + list[reps[i].index] = entity + } + return nil + + default: + return fmt.Errorf("unknown resolver: %s", resolverName) + } + + case "MultiPlanetRequiresNested": + resolverName, err := entityResolverNameForMultiPlanetRequiresNested(ctx, reps[0].entity) + if err != nil { + return fmt.Errorf(`finding resolver for Entity "MultiPlanetRequiresNested": %w`, err) + } + switch resolverName { + + case "findManyMultiPlanetRequiresNestedByNames": + typedReps := make([]*model.MultiPlanetRequiresNestedByNamesInput, len(reps)) + + for i, rep := range reps { + id0, err := unmarshalNString2string(ctx, ec, rep.entity["name"]) + if err != nil { + return errors.New(fmt.Sprintf("Field %s undefined in schema.", "name")) + } + + typedReps[i] = &model.MultiPlanetRequiresNestedByNamesInput{ + Name: id0, + } + } + + entities, err := ec.resolvers.Entity().FindManyMultiPlanetRequiresNestedByNames(ctx, typedReps) + if err != nil { + return err + } + + for i, entity := range entities { + entity.World.Foo, err = unmarshalNString2string(ctx, ec, reps[i].entity["world"].(map[string]interface{})["foo"]) + if err != nil { + return err + } + list[reps[i].index] = entity + } + return nil + + default: + return fmt.Errorf("unknown resolver: %s", resolverName) + } + + default: + return errors.New("unknown type: " + typeName) + } +} + +func entityResolverNameForHello(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findHelloByName", nil + } + return "", fmt.Errorf("%w for Hello", ErrTypeNotFound) +} + +func entityResolverNameForHelloMultiSingleKeys(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["key1"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + m = rep + val, ok = m["key2"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findHelloMultiSingleKeysByKey1AndKey2", nil + } + return "", fmt.Errorf("%w for HelloMultiSingleKeys", ErrTypeNotFound) +} + +func entityResolverNameForHelloWithErrors(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findHelloWithErrorsByName", nil + } + return "", fmt.Errorf("%w for HelloWithErrors", ErrTypeNotFound) +} + +func entityResolverNameForMultiHello(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findManyMultiHelloByNames", nil + } + return "", fmt.Errorf("%w for MultiHello", ErrTypeNotFound) +} + +func entityResolverNameForMultiHelloMultipleRequires(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findManyMultiHelloMultipleRequiresByNames", nil + } + return "", fmt.Errorf("%w for MultiHelloMultipleRequires", ErrTypeNotFound) +} + +func entityResolverNameForMultiHelloRequires(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findManyMultiHelloRequiresByNames", nil + } + return "", fmt.Errorf("%w for MultiHelloRequires", ErrTypeNotFound) +} + +func entityResolverNameForMultiHelloWithError(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findManyMultiHelloWithErrorByNames", nil + } + return "", fmt.Errorf("%w for MultiHelloWithError", ErrTypeNotFound) +} + +func entityResolverNameForMultiPlanetRequiresNested(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findManyMultiPlanetRequiresNestedByNames", nil + } + return "", fmt.Errorf("%w for MultiPlanetRequiresNested", ErrTypeNotFound) +} + +func entityResolverNameForPlanetMultipleRequires(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findPlanetMultipleRequiresByName", nil + } + return "", fmt.Errorf("%w for PlanetMultipleRequires", ErrTypeNotFound) +} + +func entityResolverNameForPlanetRequires(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findPlanetRequiresByName", nil + } + return "", fmt.Errorf("%w for PlanetRequires", ErrTypeNotFound) +} + +func entityResolverNameForPlanetRequiresNested(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findPlanetRequiresNestedByName", nil + } + return "", fmt.Errorf("%w for PlanetRequiresNested", ErrTypeNotFound) +} + +func entityResolverNameForWorld(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["hello"] + if !ok { + break + } + if m, ok = val.(map[string]interface{}); !ok { + break + } + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + m = rep + val, ok = m["foo"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findWorldByHelloNameAndFoo", nil + } + return "", fmt.Errorf("%w for World", ErrTypeNotFound) +} + +func entityResolverNameForWorldName(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findWorldNameByName", nil + } + return "", fmt.Errorf("%w for WorldName", ErrTypeNotFound) +} + +func entityResolverNameForWorldWithMultipleKeys(ctx context.Context, rep EntityRepresentation) (string, error) { + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["hello"] + if !ok { + break + } + if m, ok = val.(map[string]interface{}); !ok { + break + } + val, ok = m["name"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + m = rep + val, ok = m["foo"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findWorldWithMultipleKeysByHelloNameAndFoo", nil + } + for { + var ( + m EntityRepresentation + val interface{} + ok bool + ) + _ = val + // if all of the KeyFields values for this resolver are null, + // we shouldn't use use it + allNull := true + m = rep + val, ok = m["bar"] + if !ok { + break + } + if allNull { + allNull = val == nil + } + if allNull { + break + } + return "findWorldWithMultipleKeysByBar", nil + } + return "", fmt.Errorf("%w for WorldWithMultipleKeys", ErrTypeNotFound) +} diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model/models.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model/models.go new file mode 100644 index 00000000000..47af26e797d --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/generated/model/models.go @@ -0,0 +1,130 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package model + +type Hello struct { + Name string `json:"name"` + Secondary string `json:"secondary"` +} + +func (Hello) IsEntity() {} + +type HelloMultiSingleKeys struct { + Key1 string `json:"key1"` + Key2 string `json:"key2"` +} + +func (HelloMultiSingleKeys) IsEntity() {} + +type HelloWithErrors struct { + Name string `json:"name"` +} + +func (HelloWithErrors) IsEntity() {} + +type MultiHello struct { + Name string `json:"name"` +} + +func (MultiHello) IsEntity() {} + +type MultiHelloByNamesInput struct { + Name string `json:"Name"` +} + +type MultiHelloMultipleRequires struct { + Name string `json:"name"` + Key1 string `json:"key1"` + Key2 string `json:"key2"` + Key3 string `json:"key3"` +} + +func (MultiHelloMultipleRequires) IsEntity() {} + +type MultiHelloMultipleRequiresByNamesInput struct { + Name string `json:"Name"` +} + +type MultiHelloRequires struct { + Name string `json:"name"` + Key1 string `json:"key1"` + Key2 string `json:"key2"` +} + +func (MultiHelloRequires) IsEntity() {} + +type MultiHelloRequiresByNamesInput struct { + Name string `json:"Name"` +} + +type MultiHelloWithError struct { + Name string `json:"name"` +} + +func (MultiHelloWithError) IsEntity() {} + +type MultiHelloWithErrorByNamesInput struct { + Name string `json:"Name"` +} + +type MultiPlanetRequiresNested struct { + Name string `json:"name"` + World *World `json:"world"` + Size int `json:"size"` +} + +func (MultiPlanetRequiresNested) IsEntity() {} + +type MultiPlanetRequiresNestedByNamesInput struct { + Name string `json:"Name"` +} + +type PlanetMultipleRequires struct { + Name string `json:"name"` + Diameter int `json:"diameter"` + Density int `json:"density"` + Weight int `json:"weight"` +} + +func (PlanetMultipleRequires) IsEntity() {} + +type PlanetRequires struct { + Name string `json:"name"` + Size int `json:"size"` + Diameter int `json:"diameter"` +} + +func (PlanetRequires) IsEntity() {} + +type PlanetRequiresNested struct { + Name string `json:"name"` + World *World `json:"world"` + Size int `json:"size"` +} + +func (PlanetRequiresNested) IsEntity() {} + +type Query struct { +} + +type World struct { + Foo string `json:"foo"` + Bar int `json:"bar"` + Hello *Hello `json:"hello,omitempty"` +} + +func (World) IsEntity() {} + +type WorldName struct { + Name string `json:"name"` +} + +func (WorldName) IsEntity() {} + +type WorldWithMultipleKeys struct { + Foo string `json:"foo"` + Bar int `json:"bar"` + Hello *Hello `json:"hello,omitempty"` +} + +func (WorldWithMultipleKeys) IsEntity() {} diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/gqlgen.yml b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/gqlgen.yml new file mode 100644 index 00000000000..169f3d620d1 --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/gqlgen.yml @@ -0,0 +1,15 @@ +schema: + - "testdata/usefunctionsyntaxforexecutioncontext/schema.graphql" +use_function_syntax_for_execution_context: true +exec: + filename: testdata/usefunctionsyntaxforexecutioncontext/generated/exec.go +federation: + filename: testdata/usefunctionsyntaxforexecutioncontext/generated/federation.go +model: + filename: testdata/usefunctionsyntaxforexecutioncontext/generated/model/models.go + package: model +resolver: + filename: testdata/usefunctionsyntaxforexecutioncontext/resolver.go + layout: follow-schema + dir: testdata/usefunctionsyntaxforexecutioncontext + package: usefunctionsyntaxforexecutioncontext diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/resolver.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/resolver.go new file mode 100644 index 00000000000..ad74366a147 --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/resolver.go @@ -0,0 +1,10 @@ +package usefunctionsyntaxforexecutioncontext + +// This file will not be regenerated automatically. +// +// It serves as dependency injection for your app, add any dependencies you require here. + +type Resolver struct{} + +// FindWorldWithMultipleKeysByHelloNameAndFooBarValue shows we hit the FindWorldWithMultipleKeysByHelloNameAndFoo resolver +const FindWorldWithMultipleKeysByHelloNameAndFooBarValue = 99 diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.graphql b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.graphql new file mode 100644 index 00000000000..a5588d8d65e --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.graphql @@ -0,0 +1,77 @@ +directive @entityResolver(multi: Boolean) on OBJECT + +type Hello @key(fields: "name") { + name: String! + secondary: String! +} + +type World @key(fields: "hello { name } foo ") { + foo: String! + bar: Int! + hello: Hello +} + +type WorldWithMultipleKeys @key(fields: "hello { name } foo ") @key(fields: "bar") { + foo: String! + bar: Int! + hello: Hello +} + +type WorldName @key(fields: "name") { + name: String! +} + +type HelloWithErrors @key(fields: "name") { + name: String! +} + +type PlanetRequires @key(fields: "name") { + name: String! + size: Int! @requires(fields: "diameter") + diameter: Int! +} + +type PlanetMultipleRequires @key(fields: "name") { + name: String! @external + diameter: Int! @external + density: Int! @external + weight: Int! @requires(fields: "diameter density") +} + +type PlanetRequiresNested @key(fields: "name") { + name: String! @external + world: World! @external + size: Int! @requires(fields: "world{ foo }") +} + +type MultiPlanetRequiresNested @key(fields: "name") @entityResolver(multi: true) { + name: String! @external + world: World! @external + size: Int! @requires(fields: "world{ foo }") +} + +type MultiHello @key(fields: "name") @entityResolver(multi: true) { + name: String! +} + +type MultiHelloWithError @key(fields: "name") @entityResolver(multi: true) { + name: String! +} + +type HelloMultiSingleKeys @key(fields: "key1 key2") { + key1: String! + key2: String! +} + +type MultiHelloRequires @key(fields: "name") @entityResolver(multi: true) { + name: String! @external + key1: String! @external + key2: String! @requires(fields: "key1") +} + +type MultiHelloMultipleRequires @key(fields: "name") @entityResolver(multi: true) { + name: String! @external + key1: String! @external + key2: String! @external + key3: String! @requires(fields: "key1 key2") +} diff --git a/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.resolvers.go b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.resolvers.go new file mode 100644 index 00000000000..15d2de2982c --- /dev/null +++ b/plugin/federation/testdata/usefunctionsyntaxforexecutioncontext/schema.resolvers.go @@ -0,0 +1,4 @@ +package usefunctionsyntaxforexecutioncontext + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. From ab37f571cbb13c0cd1ccda94f3ab22b64e18a816 Mon Sep 17 00:00:00 2001 From: Parag Kanodia Date: Sat, 7 Dec 2024 14:18:55 +0530 Subject: [PATCH 2/4] added coverage execption for testdata --- .github/workflows/check-coverage | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/check-coverage b/.github/workflows/check-coverage index f2195aad27a..9244270d602 100755 --- a/.github/workflows/check-coverage +++ b/.github/workflows/check-coverage @@ -7,29 +7,4 @@ go test -covermode atomic -coverprofile=/tmp/coverage.out.tmp -coverpkg=./... $( # ignore protobuf files cat /tmp/coverage.out.tmp | grep -v ".pb.go" > /tmp/coverage.out -join () { - local IFS="$1" - shift - echo "$*" -} - -ignore_list=( - '_examples/*/*' - '_examples/*/*/*' - 'integration/*' - 'integration/*/*' - 'codegen/testserver/**/*generated*' - 'codegen/testserver/**/*generated*/**' - 'codegen/testserver/**/models-gen.go' - 'codegen/testserver/**/resolver.go' - 'plugin/resolvergen/testdata/*/*' - 'plugin/modelgen/*/*' - 'plugin/federation/testdata/*/*/*' - '*/generated.go' - '*/*/generated.go' - '*/*/*/generated.go' - 'graphql/executable_schema_mock.go' -) -ignore=$(join , "${ignore_list[@]}") - -goveralls -coverprofile=/tmp/coverage.out -service=github "-ignore=$ignore" +goveralls -coverprofile=/tmp/coverage.out -service=github -ignore='_examples/*/*,_examples/*/*/*,integration/*,integration/*/*,codegen/testserver/*/*,plugin/resolvergen/testdata/*/*,plugin/modelgen/*/*,plugin/federation/testdata/*/*/*,*/generated.go,*/*/generated.go,*/*/*/generated.go,graphql/executable_schema_mock.go' From 2fbba698d02cc5018fdb1fd44ae22cec17727e12 Mon Sep 17 00:00:00 2001 From: Parag Kanodia Date: Mon, 9 Dec 2024 14:49:48 +0530 Subject: [PATCH 3/4] updated test cases to resolve linting issues in them --- .github/workflows/check-coverage | 27 ++++++++++++++++++- .../generated_test.go | 10 ++++--- ...ction_syntax_for_execution_context_test.go | 8 ++++-- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-coverage b/.github/workflows/check-coverage index 9244270d602..f2195aad27a 100755 --- a/.github/workflows/check-coverage +++ b/.github/workflows/check-coverage @@ -7,4 +7,29 @@ go test -covermode atomic -coverprofile=/tmp/coverage.out.tmp -coverpkg=./... $( # ignore protobuf files cat /tmp/coverage.out.tmp | grep -v ".pb.go" > /tmp/coverage.out -goveralls -coverprofile=/tmp/coverage.out -service=github -ignore='_examples/*/*,_examples/*/*/*,integration/*,integration/*/*,codegen/testserver/*/*,plugin/resolvergen/testdata/*/*,plugin/modelgen/*/*,plugin/federation/testdata/*/*/*,*/generated.go,*/*/generated.go,*/*/*/generated.go,graphql/executable_schema_mock.go' +join () { + local IFS="$1" + shift + echo "$*" +} + +ignore_list=( + '_examples/*/*' + '_examples/*/*/*' + 'integration/*' + 'integration/*/*' + 'codegen/testserver/**/*generated*' + 'codegen/testserver/**/*generated*/**' + 'codegen/testserver/**/models-gen.go' + 'codegen/testserver/**/resolver.go' + 'plugin/resolvergen/testdata/*/*' + 'plugin/modelgen/*/*' + 'plugin/federation/testdata/*/*/*' + '*/generated.go' + '*/*/generated.go' + '*/*/*/generated.go' + 'graphql/executable_schema_mock.go' +) +ignore=$(join , "${ignore_list[@]}") + +goveralls -coverprofile=/tmp/coverage.out -service=github "-ignore=$ignore" diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go index c25e9353ee9..159933adec0 100644 --- a/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go @@ -8,6 +8,7 @@ import ( "encoding/json" "testing" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" "github.com/99designs/gqlgen/client" @@ -16,12 +17,13 @@ import ( func TestQuery(t *testing.T) { resolvers := &Stub{} - srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + srv := handler.New(NewExecutableSchema(Config{ Resolvers: resolvers, Directives: DirectiveRoot{ Log: LogDirective, }, })) + srv.AddTransport(transport.POST{}) c := client.New(srv) testAge := new(int) @@ -139,12 +141,13 @@ func TestQuery(t *testing.T) { func TestMutation(t *testing.T) { resolvers := &Stub{} - srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + srv := handler.New(NewExecutableSchema(Config{ Resolvers: resolvers, Directives: DirectiveRoot{ Log: LogDirective, }, })) + srv.AddTransport(transport.POST{}) c := client.New(srv) createdAt := "2021-01-01" @@ -224,12 +227,13 @@ func TestMutation(t *testing.T) { func TestSubscription(t *testing.T) { resolvers := &Stub{} - srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + srv := handler.New(NewExecutableSchema(Config{ Resolvers: resolvers, Directives: DirectiveRoot{ Log: LogDirective, }, })) + srv.AddTransport(transport.POST{}) c := client.New(srv) createdAt := "2021-01-01" diff --git a/plugin/federation/federation_use_function_syntax_for_execution_context_test.go b/plugin/federation/federation_use_function_syntax_for_execution_context_test.go index a102603e20e..018b056af19 100644 --- a/plugin/federation/federation_use_function_syntax_for_execution_context_test.go +++ b/plugin/federation/federation_use_function_syntax_for_execution_context_test.go @@ -4,6 +4,7 @@ package federation import ( "testing" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" "github.com/99designs/gqlgen/client" @@ -13,11 +14,14 @@ import ( ) func TestFederationWithUseFunctionSyntaxForExecutionContext(t *testing.T) { - c := client.New(handler.NewDefaultServer( + srv := handler.New( generated.NewExecutableSchema(generated.Config{ Resolvers: &usefunctionsyntaxforexecutioncontext.Resolver{}, }), - )) + ) + srv.AddTransport(transport.POST{}) + c := client.New(srv) + t.Run("Hello entities", func(t *testing.T) { representations := []map[string]any{ From 410870365bda87b05811b2204a5efe4e576cfd61 Mon Sep 17 00:00:00 2001 From: Parag Kanodia Date: Mon, 9 Dec 2024 14:59:53 +0530 Subject: [PATCH 4/4] fixed lint issues and test failures --- .../usefunctionsyntaxforexecutioncontext/generated_test.go | 4 ++++ ...deration_use_function_syntax_for_execution_context_test.go | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go index 159933adec0..f47e11fe352 100644 --- a/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go +++ b/codegen/testserver/usefunctionsyntaxforexecutioncontext/generated_test.go @@ -7,6 +7,7 @@ import ( "context" "encoding/json" "testing" + "time" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" @@ -233,6 +234,9 @@ func TestSubscription(t *testing.T) { Log: LogDirective, }, })) + srv.AddTransport(transport.Websocket{ + KeepAlivePingInterval: time.Second, + }) srv.AddTransport(transport.POST{}) c := client.New(srv) diff --git a/plugin/federation/federation_use_function_syntax_for_execution_context_test.go b/plugin/federation/federation_use_function_syntax_for_execution_context_test.go index 018b056af19..b08672d38c1 100644 --- a/plugin/federation/federation_use_function_syntax_for_execution_context_test.go +++ b/plugin/federation/federation_use_function_syntax_for_execution_context_test.go @@ -22,7 +22,6 @@ func TestFederationWithUseFunctionSyntaxForExecutionContext(t *testing.T) { srv.AddTransport(transport.POST{}) c := client.New(srv) - t.Run("Hello entities", func(t *testing.T) { representations := []map[string]any{ {