From 249b602d487fd189787bcd3605ff4c3a459771e9 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Sep 2019 17:49:27 +1000 Subject: [PATCH 01/53] Start drafting new handler interfaces --- go.mod | 1 + go.sum | 2 + graphql/esmock.go | 279 +++++++++++++++++++++++++++++++++ graphql/exec.go | 2 + graphql/handler/http_get.go | 55 +++++++ graphql/handler/server.go | 132 ++++++++++++++++ graphql/handler/server_test.go | 103 ++++++++++++ 7 files changed, 574 insertions(+) create mode 100644 graphql/esmock.go create mode 100644 graphql/handler/http_get.go create mode 100644 graphql/handler/server.go create mode 100644 graphql/handler/server_test.go diff --git a/go.mod b/go.mod index 8df60052cbd..90b6ece5162 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/gorilla/websocket v1.2.0 github.com/hashicorp/golang-lru v0.5.0 github.com/kr/pretty v0.1.0 // indirect + github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd // indirect github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 github.com/opentracing/basictracer-go v1.0.0 // indirect github.com/opentracing/opentracing-go v1.0.2 diff --git a/go.sum b/go.sum index b2d54b1f731..bed0abdeb63 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd h1:HvFwW+cm9bCbZ/+vuGNq7CRWXql8c0y8nGeYpqmpvmk= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8= github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/opentracing/basictracer-go v1.0.0 h1:YyUAhaEfjoWXclZVJ9sGoNct7j4TVk7lZWlQw5UXuoo= diff --git a/graphql/esmock.go b/graphql/esmock.go new file mode 100644 index 00000000000..4064c8ba05f --- /dev/null +++ b/graphql/esmock.go @@ -0,0 +1,279 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package graphql + +import ( + "context" + "github.com/vektah/gqlparser/ast" + "sync" +) + +var ( + lockExecutableSchemaMockComplexity sync.RWMutex + lockExecutableSchemaMockMutation sync.RWMutex + lockExecutableSchemaMockQuery sync.RWMutex + lockExecutableSchemaMockSchema sync.RWMutex + lockExecutableSchemaMockSubscription sync.RWMutex +) + +// Ensure, that ExecutableSchemaMock does implement ExecutableSchema. +// If this is not the case, regenerate this file with moq. +var _ ExecutableSchema = &ExecutableSchemaMock{} + +// ExecutableSchemaMock is a mock implementation of ExecutableSchema. +// +// func TestSomethingThatUsesExecutableSchema(t *testing.T) { +// +// // make and configure a mocked ExecutableSchema +// mockedExecutableSchema := &ExecutableSchemaMock{ +// ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { +// panic("mock out the Complexity method") +// }, +// MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *Response { +// panic("mock out the Mutation method") +// }, +// QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *Response { +// panic("mock out the Query method") +// }, +// SchemaFunc: func() *ast.Schema { +// panic("mock out the Schema method") +// }, +// SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *Response { +// panic("mock out the Subscription method") +// }, +// } +// +// // use mockedExecutableSchema in code that requires ExecutableSchema +// // and then make assertions. +// +// } +type ExecutableSchemaMock struct { + // ComplexityFunc mocks the Complexity method. + ComplexityFunc func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) + + // MutationFunc mocks the Mutation method. + MutationFunc func(ctx context.Context, op *ast.OperationDefinition) *Response + + // QueryFunc mocks the Query method. + QueryFunc func(ctx context.Context, op *ast.OperationDefinition) *Response + + // SchemaFunc mocks the Schema method. + SchemaFunc func() *ast.Schema + + // SubscriptionFunc mocks the Subscription method. + SubscriptionFunc func(ctx context.Context, op *ast.OperationDefinition) func() *Response + + // calls tracks calls to the methods. + calls struct { + // Complexity holds details about calls to the Complexity method. + Complexity []struct { + // TypeName is the typeName argument value. + TypeName string + // FieldName is the fieldName argument value. + FieldName string + // ChildComplexity is the childComplexity argument value. + ChildComplexity int + // Args is the args argument value. + Args map[string]interface{} + } + // Mutation holds details about calls to the Mutation method. + Mutation []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Op is the op argument value. + Op *ast.OperationDefinition + } + // Query holds details about calls to the Query method. + Query []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Op is the op argument value. + Op *ast.OperationDefinition + } + // Schema holds details about calls to the Schema method. + Schema []struct { + } + // Subscription holds details about calls to the Subscription method. + Subscription []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Op is the op argument value. + Op *ast.OperationDefinition + } + } +} + +// Complexity calls ComplexityFunc. +func (mock *ExecutableSchemaMock) Complexity(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { + if mock.ComplexityFunc == nil { + panic("ExecutableSchemaMock.ComplexityFunc: method is nil but ExecutableSchema.Complexity was just called") + } + callInfo := struct { + TypeName string + FieldName string + ChildComplexity int + Args map[string]interface{} + }{ + TypeName: typeName, + FieldName: fieldName, + ChildComplexity: childComplexity, + Args: args, + } + lockExecutableSchemaMockComplexity.Lock() + mock.calls.Complexity = append(mock.calls.Complexity, callInfo) + lockExecutableSchemaMockComplexity.Unlock() + return mock.ComplexityFunc(typeName, fieldName, childComplexity, args) +} + +// ComplexityCalls gets all the calls that were made to Complexity. +// Check the length with: +// len(mockedExecutableSchema.ComplexityCalls()) +func (mock *ExecutableSchemaMock) ComplexityCalls() []struct { + TypeName string + FieldName string + ChildComplexity int + Args map[string]interface{} +} { + var calls []struct { + TypeName string + FieldName string + ChildComplexity int + Args map[string]interface{} + } + lockExecutableSchemaMockComplexity.RLock() + calls = mock.calls.Complexity + lockExecutableSchemaMockComplexity.RUnlock() + return calls +} + +// Mutation calls MutationFunc. +func (mock *ExecutableSchemaMock) Mutation(ctx context.Context, op *ast.OperationDefinition) *Response { + if mock.MutationFunc == nil { + panic("ExecutableSchemaMock.MutationFunc: method is nil but ExecutableSchema.Mutation was just called") + } + callInfo := struct { + Ctx context.Context + Op *ast.OperationDefinition + }{ + Ctx: ctx, + Op: op, + } + lockExecutableSchemaMockMutation.Lock() + mock.calls.Mutation = append(mock.calls.Mutation, callInfo) + lockExecutableSchemaMockMutation.Unlock() + return mock.MutationFunc(ctx, op) +} + +// MutationCalls gets all the calls that were made to Mutation. +// Check the length with: +// len(mockedExecutableSchema.MutationCalls()) +func (mock *ExecutableSchemaMock) MutationCalls() []struct { + Ctx context.Context + Op *ast.OperationDefinition +} { + var calls []struct { + Ctx context.Context + Op *ast.OperationDefinition + } + lockExecutableSchemaMockMutation.RLock() + calls = mock.calls.Mutation + lockExecutableSchemaMockMutation.RUnlock() + return calls +} + +// Query calls QueryFunc. +func (mock *ExecutableSchemaMock) Query(ctx context.Context, op *ast.OperationDefinition) *Response { + if mock.QueryFunc == nil { + panic("ExecutableSchemaMock.QueryFunc: method is nil but ExecutableSchema.Query was just called") + } + callInfo := struct { + Ctx context.Context + Op *ast.OperationDefinition + }{ + Ctx: ctx, + Op: op, + } + lockExecutableSchemaMockQuery.Lock() + mock.calls.Query = append(mock.calls.Query, callInfo) + lockExecutableSchemaMockQuery.Unlock() + return mock.QueryFunc(ctx, op) +} + +// QueryCalls gets all the calls that were made to Query. +// Check the length with: +// len(mockedExecutableSchema.QueryCalls()) +func (mock *ExecutableSchemaMock) QueryCalls() []struct { + Ctx context.Context + Op *ast.OperationDefinition +} { + var calls []struct { + Ctx context.Context + Op *ast.OperationDefinition + } + lockExecutableSchemaMockQuery.RLock() + calls = mock.calls.Query + lockExecutableSchemaMockQuery.RUnlock() + return calls +} + +// Schema calls SchemaFunc. +func (mock *ExecutableSchemaMock) Schema() *ast.Schema { + if mock.SchemaFunc == nil { + panic("ExecutableSchemaMock.SchemaFunc: method is nil but ExecutableSchema.Schema was just called") + } + callInfo := struct { + }{} + lockExecutableSchemaMockSchema.Lock() + mock.calls.Schema = append(mock.calls.Schema, callInfo) + lockExecutableSchemaMockSchema.Unlock() + return mock.SchemaFunc() +} + +// SchemaCalls gets all the calls that were made to Schema. +// Check the length with: +// len(mockedExecutableSchema.SchemaCalls()) +func (mock *ExecutableSchemaMock) SchemaCalls() []struct { +} { + var calls []struct { + } + lockExecutableSchemaMockSchema.RLock() + calls = mock.calls.Schema + lockExecutableSchemaMockSchema.RUnlock() + return calls +} + +// Subscription calls SubscriptionFunc. +func (mock *ExecutableSchemaMock) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *Response { + if mock.SubscriptionFunc == nil { + panic("ExecutableSchemaMock.SubscriptionFunc: method is nil but ExecutableSchema.Subscription was just called") + } + callInfo := struct { + Ctx context.Context + Op *ast.OperationDefinition + }{ + Ctx: ctx, + Op: op, + } + lockExecutableSchemaMockSubscription.Lock() + mock.calls.Subscription = append(mock.calls.Subscription, callInfo) + lockExecutableSchemaMockSubscription.Unlock() + return mock.SubscriptionFunc(ctx, op) +} + +// SubscriptionCalls gets all the calls that were made to Subscription. +// Check the length with: +// len(mockedExecutableSchema.SubscriptionCalls()) +func (mock *ExecutableSchemaMock) SubscriptionCalls() []struct { + Ctx context.Context + Op *ast.OperationDefinition +} { + var calls []struct { + Ctx context.Context + Op *ast.OperationDefinition + } + lockExecutableSchemaMockSubscription.RLock() + calls = mock.calls.Subscription + lockExecutableSchemaMockSubscription.RUnlock() + return calls +} diff --git a/graphql/exec.go b/graphql/exec.go index 3e00a4d57b1..6ebc5b1a626 100644 --- a/graphql/exec.go +++ b/graphql/exec.go @@ -1,3 +1,5 @@ +//go:generate go run github.com/matryer/moq -out esmock.go . ExecutableSchema + package graphql import ( diff --git a/graphql/handler/http_get.go b/graphql/handler/http_get.go new file mode 100644 index 00000000000..35aeee4666a --- /dev/null +++ b/graphql/handler/http_get.go @@ -0,0 +1,55 @@ +package handler + +import ( + "encoding/json" + "io" + "net/http" + "strings" + + "github.com/99designs/gqlgen/graphql" +) + +type HTTPGet struct{} + +func (H HTTPGet) Supports(r *http.Request) bool { + if r.Header.Get("Upgrade") != "" { + return false + } + + return r.Method == "GET" +} + +func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) { + var reqParams graphql.RequestContext + + reqParams.RawQuery = r.URL.Query().Get("query") + reqParams.OperationName = r.URL.Query().Get("operationName") + + if variables := r.URL.Query().Get("variables"); variables != "" { + if err := jsonDecode(strings.NewReader(variables), &reqParams.Variables); err != nil { + sendErrorf(w, http.StatusBadRequest, "variables could not be decoded") + return nil, nil + } + } + + if extensions := r.URL.Query().Get("extensions"); extensions != "" { + if err := jsonDecode(strings.NewReader(extensions), &reqParams.Extensions); err != nil { + sendErrorf(w, http.StatusBadRequest, "extensions could not be decoded") + return nil, nil + } + } + + return &reqParams, func(response *graphql.Response) { + b, err := json.Marshal(response) + if err != nil { + panic(err) + } + w.Write(b) + } +} + +func jsonDecode(r io.Reader, val interface{}) error { + dec := json.NewDecoder(r) + dec.UseNumber() + return dec.Decode(val) +} diff --git a/graphql/handler/server.go b/graphql/handler/server.go new file mode 100644 index 00000000000..9bff842c9dd --- /dev/null +++ b/graphql/handler/server.go @@ -0,0 +1,132 @@ +package handler + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/ast" + "github.com/vektah/gqlparser/gqlerror" + "github.com/vektah/gqlparser/parser" +) + +type ( + Server struct { + es graphql.ExecutableSchema + transports []Transport + middlewares []Middleware + } + + Handler func(ctx context.Context, writer Writer) + + Writer func(*graphql.Response) + + Middleware func(next Handler) Handler + + Transport interface { + Supports(r *http.Request) bool + Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) + } + + Option func(Server) + + ResponseStream func() *graphql.Response +) + +func (s *Server) AddTransport(transport Transport) { + s.transports = append(s.transports, transport) +} + +func (s *Server) Use(middleware Middleware) { + s.middlewares = append(s.middlewares, middleware) +} + +func New(es graphql.ExecutableSchema) *Server { + return &Server{ + es: es, + } +} + +func (s *Server) getTransport(r *http.Request) Transport { + for _, t := range s.transports { + if t.Supports(r) { + return t + } + } + return nil +} + +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + transport := s.getTransport(r) + if transport == nil { + sendErrorf(w, http.StatusBadRequest, "transport not supported") + return + } + + rc, writer := transport.Do(w, r) + + handler := s.executableSchemaHandler + + for i := len(s.middlewares) - 1; i >= 0; i-- { + handler = s.middlewares[i](handler) + } + + ctx := graphql.WithRequestContext(r.Context(), rc) + handler(ctx, writer) +} + +// executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware +// and sends responses to the transport so it can be returned to the client +func (s *Server) executableSchemaHandler(ctx context.Context, write Writer) { + r := graphql.GetRequestContext(ctx) + + var gerr *gqlerror.Error + + // todo: hmm... how should this work? + if r.Doc == nil { + r.Doc, gerr = s.parseOperation(ctx, r.RawQuery) + if gerr != nil { + write(&graphql.Response{Errors: []*gqlerror.Error{gerr}}) + return + } + } + + op := r.Doc.Operations.ForName(r.OperationName) + + switch op.Operation { + case ast.Query: + resp := s.es.Query(ctx, op) + write(resp) + case ast.Mutation: + resp := s.es.Mutation(ctx, op) + write(resp) + case ast.Subscription: + resp := s.es.Subscription(ctx, op) + + for w := resp(); w != nil; w = resp() { + write(w) + } + default: + write(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +func (s *Server) parseOperation(ctx context.Context, query string) (*ast.QueryDocument, *gqlerror.Error) { + // todo: tracing + return parser.ParseQuery(&ast.Source{Input: query}) +} + +func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { + w.WriteHeader(code) + b, err := json.Marshal(&graphql.Response{Errors: errors}) + if err != nil { + panic(err) + } + w.Write(b) +} + +func sendErrorf(w http.ResponseWriter, code int, format string, args ...interface{}) { + sendError(w, code, &gqlerror.Error{Message: fmt.Sprintf(format, args...)}) +} diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go new file mode 100644 index 00000000000..ad5f0fe60d4 --- /dev/null +++ b/graphql/handler/server_test.go @@ -0,0 +1,103 @@ +package handler + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "testing" + + "github.com/99designs/gqlgen/graphql" + "github.com/stretchr/testify/assert" + "github.com/vektah/gqlparser/ast" +) + +func TestServer(t *testing.T) { + es := &graphql.ExecutableSchemaMock{ + QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return &graphql.Response{Data: []byte(`"query resp"`)} + }, + MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return &graphql.Response{Data: []byte(`"mutation resp"`)} + }, + SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { + called := 0 + return func() *graphql.Response { + fmt.Println("asdf") + called++ + if called > 2 { + return nil + } + return &graphql.Response{Data: []byte(`"subscription resp"`)} + } + }, + } + srv := New(es) + srv.AddTransport(&HTTPGet{}) + srv.Use(func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + next(ctx, writer) + } + }) + + t.Run("returns an error if no transport matches", func(t *testing.T) { + resp := post(srv, "/foo", "application/json") + assert.Equal(t, http.StatusBadRequest, resp.Code) + assert.Equal(t, `{"errors":[{"message":"transport not supported"}],"data":null}`, resp.Body.String()) + }) + + t.Run("calls query on executable schema", func(t *testing.T) { + resp := get(srv, "/foo?query={a}") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":"query resp"}`, resp.Body.String()) + }) + + t.Run("calls mutation on executable schema", func(t *testing.T) { + resp := get(srv, "/foo?query=mutation{a}") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":"mutation resp"}`, resp.Body.String()) + }) + + t.Run("calls subscription repeatedly on executable schema", func(t *testing.T) { + resp := get(srv, "/foo?query=subscription{a}") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":"subscription resp"}{"data":"subscription resp"}`, resp.Body.String()) + }) + + t.Run("invokes middleware in order", func(t *testing.T) { + var calls []string + srv.Use(func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + calls = append(calls, "first") + next(ctx, writer) + } + }) + srv.Use(func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + calls = append(calls, "second") + next(ctx, writer) + } + }) + + resp := get(srv, "/foo?query={a}") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, []string{"first", "second"}, calls) + }) +} + +func get(handler http.Handler, target string) *httptest.ResponseRecorder { + r := httptest.NewRequest("GET", target, nil) + w := httptest.NewRecorder() + + handler.ServeHTTP(w, r) + return w +} + +func post(handler http.Handler, target, contentType string) *httptest.ResponseRecorder { + r := httptest.NewRequest("POST", target, nil) + r.Header.Set("Content-Type", contentType) + w := httptest.NewRecorder() + + handler.ServeHTTP(w, r) + return w +} From da986181d7e6ca9da2999fb62d8fbc7c33eda21f Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Oct 2019 13:35:24 +1000 Subject: [PATCH 02/53] port over the setter request context middleware --- graphql/handler/complexity.go | 33 ++++++++++++++++++++++ graphql/handler/complexity_test.go | 26 +++++++++++++++++ graphql/handler/errors.go | 30 ++++++++++++++++++++ graphql/handler/errors_test.go | 32 +++++++++++++++++++++ graphql/handler/introspection.go | 17 ++++++++++++ graphql/handler/introspection_test.go | 19 +++++++++++++ graphql/handler/utils_test.go | 30 ++++++++++++++++++++ handler/graphql.go | 40 --------------------------- 8 files changed, 187 insertions(+), 40 deletions(-) create mode 100644 graphql/handler/complexity.go create mode 100644 graphql/handler/complexity_test.go create mode 100644 graphql/handler/errors.go create mode 100644 graphql/handler/errors_test.go create mode 100644 graphql/handler/introspection.go create mode 100644 graphql/handler/introspection_test.go create mode 100644 graphql/handler/utils_test.go diff --git a/graphql/handler/complexity.go b/graphql/handler/complexity.go new file mode 100644 index 00000000000..0cae2d56162 --- /dev/null +++ b/graphql/handler/complexity.go @@ -0,0 +1,33 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" +) + +// ComplexityLimit sets a maximum query complexity that is allowed to be executed. +// +// If a query is submitted that exceeds the limit, a 422 status code will be returned. +func ComplexityLimit(limit int) Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + graphql.GetRequestContext(ctx).ComplexityLimit = limit + next(ctx, writer) + } + } +} + +// ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed +// to be executed. This is mostly just a wrapper to preserve the old interface, consider writing your own middleware +// instead. +// +// If a query is submitted that exceeds the limit, a 422 status code will be returned. +func ComplexityLimitFunc(f graphql.ComplexityLimitFunc) Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + graphql.GetRequestContext(ctx).ComplexityLimit = f(ctx) + next(ctx, writer) + } + } +} diff --git a/graphql/handler/complexity_test.go b/graphql/handler/complexity_test.go new file mode 100644 index 00000000000..8ee346fa38d --- /dev/null +++ b/graphql/handler/complexity_test.go @@ -0,0 +1,26 @@ +package handler + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestComplexityLimit(t *testing.T) { + rc := testMiddleware(ComplexityLimitFunc(func(ctx context.Context) int { + return 10 + })) + + require.True(t, rc.InvokedNext) + require.Equal(t, 10, rc.ComplexityLimit) +} + +func TestComplexityLimitFunc(t *testing.T) { + rc := testMiddleware(ComplexityLimitFunc(func(ctx context.Context) int { + return 22 + })) + + require.True(t, rc.InvokedNext) + require.Equal(t, 22, rc.ComplexityLimit) +} diff --git a/graphql/handler/errors.go b/graphql/handler/errors.go new file mode 100644 index 00000000000..f4c9f97c471 --- /dev/null +++ b/graphql/handler/errors.go @@ -0,0 +1,30 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" +) + +// ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides +// a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default +// implementation in graphql.DefaultErrorPresenter for an example. +func ErrorPresenter(ep graphql.ErrorPresenterFunc) Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + graphql.GetRequestContext(ctx).ErrorPresenter = ep + next(ctx, writer) + } + } +} + +// RecoverFunc is called to recover from panics inside goroutines. It can be used to send errors to error trackers +// and hide internal error types from clients. +func RecoverFunc(recover graphql.RecoverFunc) Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + graphql.GetRequestContext(ctx).Recover = recover + next(ctx, writer) + } + } +} diff --git a/graphql/handler/errors_test.go b/graphql/handler/errors_test.go new file mode 100644 index 00000000000..683d2a0bd2d --- /dev/null +++ b/graphql/handler/errors_test.go @@ -0,0 +1,32 @@ +package handler + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/stretchr/testify/assert" + "github.com/vektah/gqlparser/gqlerror" +) + +func TestErrorPresenter(t *testing.T) { + rc := testMiddleware(ErrorPresenter(func(i context.Context, e error) *gqlerror.Error { + return &gqlerror.Error{Message: "boom"} + })) + + require.True(t, rc.InvokedNext) + // cant test for function equality in go, so testing the return type instead + require.Equal(t, "boom", rc.ErrorPresenter(nil, nil).Message) +} + +func TestRecoverFunc(t *testing.T) { + rc := testMiddleware(RecoverFunc(func(ctx context.Context, err interface{}) (userMessage error) { + return fmt.Errorf("boom") + })) + + require.True(t, rc.InvokedNext) + // cant test for function equality in go, so testing the return type instead + assert.Equal(t, "boom", rc.Recover(nil, nil).Error()) +} diff --git a/graphql/handler/introspection.go b/graphql/handler/introspection.go new file mode 100644 index 00000000000..279d8fdb0b1 --- /dev/null +++ b/graphql/handler/introspection.go @@ -0,0 +1,17 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" +) + +// Introspection enables clients to reflect all of the types available on the graph. +func Introspection() Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + graphql.GetRequestContext(ctx).DisableIntrospection = false + next(ctx, writer) + } + } +} diff --git a/graphql/handler/introspection_test.go b/graphql/handler/introspection_test.go new file mode 100644 index 00000000000..d4b65236b0f --- /dev/null +++ b/graphql/handler/introspection_test.go @@ -0,0 +1,19 @@ +package handler + +import ( + "testing" + + "github.com/99designs/gqlgen/graphql" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestIntrospection(t *testing.T) { + rc := testMiddleware(Introspection(), graphql.RequestContext{ + DisableIntrospection: true, + }) + + require.True(t, rc.InvokedNext) + // cant test for function equality in go, so testing the return type instead + assert.False(t, rc.DisableIntrospection) +} diff --git a/graphql/handler/utils_test.go b/graphql/handler/utils_test.go new file mode 100644 index 00000000000..f5feae8318f --- /dev/null +++ b/graphql/handler/utils_test.go @@ -0,0 +1,30 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" +) + +type middlewareContext struct { + *graphql.RequestContext + InvokedNext bool +} + +func testMiddleware(m Middleware, initialContexts ...graphql.RequestContext) middlewareContext { + rc := &graphql.RequestContext{} + if len(initialContexts) > 0 { + rc = &initialContexts[0] + } + + m(func(ctx context.Context, writer Writer) { + rc = graphql.GetRequestContext(ctx) + })(graphql.WithRequestContext(context.Background(), rc), noopWriter) + + return middlewareContext{ + InvokedNext: rc != nil, + RequestContext: rc, + } +} + +func noopWriter(response *graphql.Response) {} diff --git a/handler/graphql.go b/handler/graphql.go index 3d262518dde..ed0317a3f2e 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -105,46 +105,6 @@ func WebsocketUpgrader(upgrader websocket.Upgrader) Option { } } -func RecoverFunc(recover graphql.RecoverFunc) Option { - return func(cfg *Config) { - cfg.recover = recover - } -} - -// ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides -// a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default -// implementation in graphql.DefaultErrorPresenter for an example. -func ErrorPresenter(f graphql.ErrorPresenterFunc) Option { - return func(cfg *Config) { - cfg.errorPresenter = f - } -} - -// IntrospectionEnabled = false will forbid clients from calling introspection endpoints. Can be useful in prod when you dont -// want clients introspecting the full schema. -func IntrospectionEnabled(enabled bool) Option { - return func(cfg *Config) { - cfg.disableIntrospection = !enabled - } -} - -// ComplexityLimit sets a maximum query complexity that is allowed to be executed. -// If a query is submitted that exceeds the limit, a 422 status code will be returned. -func ComplexityLimit(limit int) Option { - return func(cfg *Config) { - cfg.complexityLimit = limit - } -} - -// ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed -// to be executed. -// If a query is submitted that exceeds the limit, a 422 status code will be returned. -func ComplexityLimitFunc(complexityLimitFunc graphql.ComplexityLimitFunc) Option { - return func(cfg *Config) { - cfg.complexityLimitFunc = complexityLimitFunc - } -} - // ResolverMiddleware allows you to define a function that will be called around every resolver, // useful for logging. func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { From 311887d6a9336c1c5f6f9a59752a94afa6be5b52 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Oct 2019 23:27:27 +1000 Subject: [PATCH 03/53] convert APQ to middleware --- graphql/handler/apq.go | 70 ++++++++++++++ graphql/handler/apq_test.go | 128 ++++++++++++++++++++++++++ graphql/handler/cache.go | 24 +++++ graphql/handler/complexity_test.go | 4 +- graphql/handler/errors_test.go | 4 +- graphql/handler/introspection_test.go | 2 +- graphql/handler/server.go | 12 +++ graphql/handler/utils_test.go | 24 ++--- handler/graphql.go | 62 +------------ handler/graphql_test.go | 66 ------------- 10 files changed, 252 insertions(+), 144 deletions(-) create mode 100644 graphql/handler/apq.go create mode 100644 graphql/handler/apq_test.go create mode 100644 graphql/handler/cache.go diff --git a/graphql/handler/apq.go b/graphql/handler/apq.go new file mode 100644 index 00000000000..ba8c21499c5 --- /dev/null +++ b/graphql/handler/apq.go @@ -0,0 +1,70 @@ +package handler + +import ( + "context" + "crypto/sha256" + "encoding/hex" + + "github.com/99designs/gqlgen/graphql" + "github.com/mitchellh/mapstructure" +) + +const ( + errPersistedQueryNotSupported = "PersistedQueryNotSupported" + errPersistedQueryNotFound = "PersistedQueryNotFound" +) + +// AutomaticPersistedQuery saves client upload by optimistically sending only the hashes of queries, if the server +// does not yet know what the query is for the hash it will respond telling the client to send the query along with the +// hash in the next request. +// see https://github.com/apollographql/apollo-link-persisted-queries +func AutomaticPersistedQuery(cache Cache) Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + rc := graphql.GetRequestContext(ctx) + + if rc.Extensions["persistedQuery"] == nil { + next(ctx, writer) + return + } + + var extension struct { + Sha256 string `json:"sha256Hash"` + Version int64 `json:"version"` + } + + if err := mapstructure.Decode(rc.Extensions["persistedQuery"], &extension); err != nil { + writer.Error("Invalid APQ extension data") + return + } + + if extension.Version != 1 { + writer.Error("Unsupported APQ version") + return + } + + if rc.RawQuery == "" { + // client sent optimistic query hash without query string, get it from the cache + query, ok := cache.Get(extension.Sha256) + if !ok { + writer.Error(errPersistedQueryNotFound) + return + } + rc.RawQuery = query.(string) + } else { + // client sent optimistic query hash with query string, verify and store it + if computeQueryHash(rc.RawQuery) != extension.Sha256 { + writer.Error("Provided APQ hash does not match query") + return + } + cache.Add(extension.Sha256, rc.RawQuery) + } + next(ctx, writer) + } + } +} + +func computeQueryHash(query string) string { + b := sha256.Sum256([]byte(query)) + return hex.EncodeToString(b[:]) +} diff --git a/graphql/handler/apq_test.go b/graphql/handler/apq_test.go new file mode 100644 index 00000000000..28f2f825862 --- /dev/null +++ b/graphql/handler/apq_test.go @@ -0,0 +1,128 @@ +package handler + +import ( + "testing" + + "github.com/99designs/gqlgen/graphql" + "github.com/stretchr/testify/require" +) + +func TestAPQ(t *testing.T) { + const query = "{ me { name } }" + const hash = "b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88" + + t.Run("with query and no hash", func(t *testing.T) { + rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + RawQuery: "original query", + }) + + require.True(t, rc.InvokedNext) + require.Equal(t, "original query", rc.ResultContext.RawQuery) + }) + + t.Run("with hash miss and no query", func(t *testing.T) { + rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + RawQuery: "", + Extensions: map[string]interface{}{ + "persistedQuery": map[string]interface{}{ + "sha256": hash, + "version": 1, + }, + }, + }) + + require.False(t, rc.InvokedNext) + require.Equal(t, "PersistedQueryNotFound", rc.Response.Errors[0].Message) + }) + + t.Run("with hash miss and query", func(t *testing.T) { + cache := MapCache{} + rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ + RawQuery: query, + Extensions: map[string]interface{}{ + "persistedQuery": map[string]interface{}{ + "sha256": hash, + "version": 1, + }, + }, + }) + + require.True(t, rc.InvokedNext, rc.Response.Errors) + require.Equal(t, "{ me { name } }", rc.ResultContext.RawQuery) + require.Equal(t, "{ me { name } }", cache[hash]) + }) + + t.Run("with hash miss and query", func(t *testing.T) { + cache := MapCache{} + rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ + RawQuery: query, + Extensions: map[string]interface{}{ + "persistedQuery": map[string]interface{}{ + "sha256": hash, + "version": 1, + }, + }, + }) + + require.True(t, rc.InvokedNext, rc.Response.Errors) + require.Equal(t, "{ me { name } }", rc.ResultContext.RawQuery) + require.Equal(t, "{ me { name } }", cache[hash]) + }) + + t.Run("with hash hit and no query", func(t *testing.T) { + cache := MapCache{ + hash: query, + } + rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ + RawQuery: "", + Extensions: map[string]interface{}{ + "persistedQuery": map[string]interface{}{ + "sha256": hash, + "version": 1, + }, + }, + }) + + require.True(t, rc.InvokedNext, rc.Response.Errors) + require.Equal(t, "{ me { name } }", rc.ResultContext.RawQuery) + }) + + t.Run("with malformed extension payload", func(t *testing.T) { + rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + Extensions: map[string]interface{}{ + "persistedQuery": "asdf", + }, + }) + + require.False(t, rc.InvokedNext) + require.Equal(t, "Invalid APQ extension data", rc.Response.Errors[0].Message) + }) + + t.Run("with invalid extension version", func(t *testing.T) { + rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + Extensions: map[string]interface{}{ + "persistedQuery": map[string]interface{}{ + "version": 2, + }, + }, + }) + + require.False(t, rc.InvokedNext) + require.Equal(t, "Unsupported APQ version", rc.Response.Errors[0].Message) + }) + + t.Run("with hash mismatch", func(t *testing.T) { + rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + RawQuery: query, + Extensions: map[string]interface{}{ + "persistedQuery": map[string]interface{}{ + "sha256": "badhash", + "version": 1, + }, + }, + }) + + require.False(t, rc.InvokedNext) + require.Equal(t, "Provided APQ hash does not match query", rc.Response.Errors[0].Message) + }) +} diff --git a/graphql/handler/cache.go b/graphql/handler/cache.go new file mode 100644 index 00000000000..dff56702779 --- /dev/null +++ b/graphql/handler/cache.go @@ -0,0 +1,24 @@ +package handler + +// Cache is a shared store for APQ and query AST caching +type Cache interface { + // Get looks up a key's value from the cache. + Get(key string) (value interface{}, ok bool) + + // Add adds a value to the cache. + Add(key, value string) +} + +// MapCache is the simplest implementation of a cache, because it can not evict it should only be used in tests +type MapCache map[string]interface{} + +// Get looks up a key's value from the cache. +func (m MapCache) Get(key string) (value interface{}, ok bool) { + v, ok := m[key] + return v, ok +} + +// Add adds a value to the cache. +func (m MapCache) Add(key, value string) { + m[key] = value +} diff --git a/graphql/handler/complexity_test.go b/graphql/handler/complexity_test.go index 8ee346fa38d..c53e858a364 100644 --- a/graphql/handler/complexity_test.go +++ b/graphql/handler/complexity_test.go @@ -13,7 +13,7 @@ func TestComplexityLimit(t *testing.T) { })) require.True(t, rc.InvokedNext) - require.Equal(t, 10, rc.ComplexityLimit) + require.Equal(t, 10, rc.ResultContext.ComplexityLimit) } func TestComplexityLimitFunc(t *testing.T) { @@ -22,5 +22,5 @@ func TestComplexityLimitFunc(t *testing.T) { })) require.True(t, rc.InvokedNext) - require.Equal(t, 22, rc.ComplexityLimit) + require.Equal(t, 22, rc.ResultContext.ComplexityLimit) } diff --git a/graphql/handler/errors_test.go b/graphql/handler/errors_test.go index 683d2a0bd2d..2ccacba9386 100644 --- a/graphql/handler/errors_test.go +++ b/graphql/handler/errors_test.go @@ -18,7 +18,7 @@ func TestErrorPresenter(t *testing.T) { require.True(t, rc.InvokedNext) // cant test for function equality in go, so testing the return type instead - require.Equal(t, "boom", rc.ErrorPresenter(nil, nil).Message) + require.Equal(t, "boom", rc.ResultContext.ErrorPresenter(nil, nil).Message) } func TestRecoverFunc(t *testing.T) { @@ -28,5 +28,5 @@ func TestRecoverFunc(t *testing.T) { require.True(t, rc.InvokedNext) // cant test for function equality in go, so testing the return type instead - assert.Equal(t, "boom", rc.Recover(nil, nil).Error()) + assert.Equal(t, "boom", rc.ResultContext.Recover(nil, nil).Error()) } diff --git a/graphql/handler/introspection_test.go b/graphql/handler/introspection_test.go index d4b65236b0f..e40de31cb04 100644 --- a/graphql/handler/introspection_test.go +++ b/graphql/handler/introspection_test.go @@ -15,5 +15,5 @@ func TestIntrospection(t *testing.T) { require.True(t, rc.InvokedNext) // cant test for function equality in go, so testing the return type instead - assert.False(t, rc.DisableIntrospection) + assert.False(t, rc.ResultContext.DisableIntrospection) } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 9bff842c9dd..6fd06ab3787 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -35,6 +35,18 @@ type ( ResponseStream func() *graphql.Response ) +func (w Writer) Errorf(format string, args ...interface{}) { + w(&graphql.Response{ + Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}, + }) +} + +func (w Writer) Error(msg string) { + w(&graphql.Response{ + Errors: gqlerror.List{{Message: msg}}, + }) +} + func (s *Server) AddTransport(transport Transport) { s.transports = append(s.transports, transport) } diff --git a/graphql/handler/utils_test.go b/graphql/handler/utils_test.go index f5feae8318f..3ec9dae658f 100644 --- a/graphql/handler/utils_test.go +++ b/graphql/handler/utils_test.go @@ -7,24 +7,24 @@ import ( ) type middlewareContext struct { - *graphql.RequestContext - InvokedNext bool + InvokedNext bool + ResultContext graphql.RequestContext + Response graphql.Response } func testMiddleware(m Middleware, initialContexts ...graphql.RequestContext) middlewareContext { - rc := &graphql.RequestContext{} + var c middlewareContext + initial := &graphql.RequestContext{} if len(initialContexts) > 0 { - rc = &initialContexts[0] + initial = &initialContexts[0] } m(func(ctx context.Context, writer Writer) { - rc = graphql.GetRequestContext(ctx) - })(graphql.WithRequestContext(context.Background(), rc), noopWriter) + c.ResultContext = *graphql.GetRequestContext(ctx) + c.InvokedNext = true + })(graphql.WithRequestContext(context.Background(), initial), func(response *graphql.Response) { + c.Response = *response + }) - return middlewareContext{ - InvokedNext: rc != nil, - RequestContext: rc, - } + return c } - -func noopWriter(response *graphql.Response) {} diff --git a/handler/graphql.go b/handler/graphql.go index ed0317a3f2e..28f4a9e7030 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -2,8 +2,6 @@ package handler import ( "context" - "crypto/sha256" - "encoding/hex" "encoding/json" "errors" "fmt" @@ -42,16 +40,6 @@ type persistedQuery struct { Version int64 `json:"version"` } -const ( - errPersistedQueryNotSupported = "PersistedQueryNotSupported" - errPersistedQueryNotFound = "PersistedQueryNotFound" -) - -type PersistedQueryCache interface { - Add(ctx context.Context, hash string, query string) - Get(ctx context.Context, hash string) (string, bool) -} - type websocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error) type Config struct { @@ -69,7 +57,6 @@ type Config struct { connectionKeepAlivePingInterval time.Duration uploadMaxMemory int64 uploadMaxSize int64 - apqCache PersistedQueryCache } func (c *Config) newRequestContext(ctx context.Context, es graphql.ExecutableSchema, doc *ast.QueryDocument, op *ast.OperationDefinition, operationName, query string, variables map[string]interface{}) (*graphql.RequestContext, error) { @@ -271,13 +258,6 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option { } } -// Add cache that will hold queries for automatic persisted queries (APQ) -func EnablePersistedQueryCache(cache PersistedQueryCache) Option { - return func(cfg *Config) { - cfg.apqCache = cache - } -} - const DefaultCacheSize = 1000 const DefaultConnectionKeepAlivePingInterval = 25 * time.Second @@ -337,11 +317,6 @@ type graphqlHandler struct { exec graphql.ExecutableSchema } -func computeQueryHash(query string) string { - b := sha256.Sum256([]byte(query)) - return hex.EncodeToString(b[:]) -} - func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if r.Method == http.MethodOptions { w.Header().Set("Allow", "OPTIONS, GET, POST") @@ -414,37 +389,7 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() - var queryHash string - apqRegister := false - apq := reqParams.Extensions != nil && reqParams.Extensions.PersistedQuery != nil - if apq { - // client has enabled apq - queryHash = reqParams.Extensions.PersistedQuery.Sha256 - if gh.cfg.apqCache == nil { - // server has disabled apq - sendErrorf(w, http.StatusOK, errPersistedQueryNotSupported) - return - } - if reqParams.Extensions.PersistedQuery.Version != 1 { - sendErrorf(w, http.StatusOK, "Unsupported persisted query version") - return - } - if reqParams.Query == "" { - // client sent optimistic query hash without query string - query, ok := gh.cfg.apqCache.Get(ctx, queryHash) - if !ok { - sendErrorf(w, http.StatusOK, errPersistedQueryNotFound) - return - } - reqParams.Query = query - } else { - if computeQueryHash(reqParams.Query) != queryHash { - sendErrorf(w, http.StatusOK, "provided sha does not match query") - return - } - apqRegister = true - } - } else if reqParams.Query == "" { + if reqParams.Query == "" { sendErrorf(w, http.StatusUnprocessableEntity, "Must provide query string") return } @@ -507,11 +452,6 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - if apqRegister && gh.cfg.apqCache != nil { - // Add to persisted query cache - gh.cfg.apqCache.Add(ctx, queryHash, reqParams.Query) - } - switch op.Operation { case ast.Query: b, err := json.Marshal(gh.exec.Query(ctx, op)) diff --git a/handler/graphql_test.go b/handler/graphql_test.go index 06ba718429a..c932e9a0729 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -15,7 +15,6 @@ import ( "testing" "github.com/99designs/gqlgen/graphql" - lru "github.com/hashicorp/golang-lru" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/vektah/gqlparser/ast" @@ -765,68 +764,3 @@ func TestBytesRead(t *testing.T) { require.Equal(t, "0193456789", string(got)) }) } - -type memoryPersistedQueryCache struct { - cache *lru.Cache -} - -func newMemoryPersistedQueryCache(size int) (*memoryPersistedQueryCache, error) { - cache, err := lru.New(size) - return &memoryPersistedQueryCache{cache: cache}, err -} - -func (c *memoryPersistedQueryCache) Add(ctx context.Context, hash string, query string) { - c.cache.Add(hash, query) -} - -func (c *memoryPersistedQueryCache) Get(ctx context.Context, hash string) (string, bool) { - val, ok := c.cache.Get(hash) - if !ok { - return "", ok - } - return val.(string), ok -} -func TestAutomaticPersistedQuery(t *testing.T) { - cache, err := newMemoryPersistedQueryCache(1000) - require.NoError(t, err) - h := GraphQL(&executableSchemaStub{}, EnablePersistedQueryCache(cache)) - t.Run("automatic persisted query POST", func(t *testing.T) { - // normal queries should be unaffected - resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - - // first pass: optimistic hash without query string - resp = doRequest(h, "POST", "/graphql", `{"extensions":{"persistedQuery":{"sha256Hash":"b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88","version":1}}}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"errors":[{"message":"PersistedQueryNotFound"}],"data":null}`, resp.Body.String()) - // second pass: query with query string and query hash - resp = doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }", "extensions":{"persistedQuery":{"sha256Hash":"b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88","version":1}}}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - // future requests without query string - resp = doRequest(h, "POST", "/graphql", `{"extensions":{"persistedQuery":{"sha256Hash":"b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88","version":1}}}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - - t.Run("automatic persisted query GET", func(t *testing.T) { - // normal queries should be unaffected - resp := doRequest(h, "GET", "/graphql?query={me{name}}", "") - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - - // first pass: optimistic hash without query string - resp = doRequest(h, "GET", `/graphql?extensions={"persistedQuery":{"version":1,"sha256Hash":"b58723c4fd7ce18043ae53635b304ba6cee765a67009645b04ca01e80ce1c065"}}`, "") - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"errors":[{"message":"PersistedQueryNotFound"}],"data":null}`, resp.Body.String()) - // second pass: query with query string and query hash - resp = doRequest(h, "GET", `/graphql?query={me{name}}&extensions={"persistedQuery":{"sha256Hash":"b58723c4fd7ce18043ae53635b304ba6cee765a67009645b04ca01e80ce1c065","version":1}}}`, "") - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - // future requests without query string - resp = doRequest(h, "GET", `/graphql?extensions={"persistedQuery":{"version":1,"sha256Hash":"b58723c4fd7ce18043ae53635b304ba6cee765a67009645b04ca01e80ce1c065"}}`, "") - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) -} From afe241b56cd44394a2b32447f7d817a8361f909d Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 2 Oct 2019 21:58:57 +1000 Subject: [PATCH 04/53] port over tracing --- graphql/context.go | 28 +++++++++ graphql/handler/tracer.go | 26 ++++++++ graphql/handler/tracer_test.go | 17 ++++++ graphql/tracer.go | 61 +++++++++++++++++++ handler/graphql.go | 105 --------------------------------- 5 files changed, 132 insertions(+), 105 deletions(-) create mode 100644 graphql/handler/tracer.go create mode 100644 graphql/handler/tracer_test.go diff --git a/graphql/context.go b/graphql/context.go index eb98251d79b..cee727e5eaf 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -75,6 +75,34 @@ func (rc *RequestContext) Validate(ctx context.Context) error { return nil } +// AddRequestMiddleware allows you to define a function that will be called around the root request, +// after the query has been parsed. This is useful for logging +func (cfg *RequestContext) AddRequestMiddleware(middleware RequestMiddleware) { + if cfg.RequestMiddleware == nil { + cfg.RequestMiddleware = middleware + return + } + + lastResolve := cfg.RequestMiddleware + cfg.RequestMiddleware = func(ctx context.Context, next func(ctx context.Context) []byte) []byte { + return lastResolve(ctx, func(ctx context.Context) []byte { + return middleware(ctx, next) + }) + } +} + +func (cfg *RequestContext) AddTracer(tracer Tracer) { + if cfg.Tracer == nil { + cfg.Tracer = tracer + return + } + lastTracer := cfg.Tracer + cfg.Tracer = &tracerWrapper{ + tracer1: lastTracer, + tracer2: tracer, + } +} + func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { return next(ctx) } diff --git a/graphql/handler/tracer.go b/graphql/handler/tracer.go new file mode 100644 index 00000000000..4ab1baed40e --- /dev/null +++ b/graphql/handler/tracer.go @@ -0,0 +1,26 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" +) + +// Tracer allows you to add a request/resolver tracer that will be called around the root request, +// calling resolver. This is useful for tracing +func Tracer(tracer graphql.Tracer) Middleware { + return func(next Handler) Handler { + return func(ctx context.Context, writer Writer) { + rc := graphql.GetRequestContext(ctx) + rc.AddTracer(tracer) + rc.AddRequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { + ctx = tracer.StartOperationExecution(ctx) + resp := next(ctx) + tracer.EndOperationExecution(ctx) + + return resp + }) + next(ctx, writer) + } + } +} diff --git a/graphql/handler/tracer_test.go b/graphql/handler/tracer_test.go new file mode 100644 index 00000000000..25e3eaa8e0d --- /dev/null +++ b/graphql/handler/tracer_test.go @@ -0,0 +1,17 @@ +package handler + +import ( + "testing" + + "github.com/99designs/gqlgen/graphql" + "github.com/stretchr/testify/require" +) + +func TestTracer(t *testing.T) { + tracer := &graphql.NopTracer{} + rc := testMiddleware(Tracer(tracer)) + + require.True(t, rc.InvokedNext) + require.Equal(t, tracer, rc.ResultContext.Tracer) + require.NotNil(t, tracer, rc.ResultContext.RequestMiddleware) +} diff --git a/graphql/tracer.go b/graphql/tracer.go index 0597ce8cc8a..441ac0d4677 100644 --- a/graphql/tracer.go +++ b/graphql/tracer.go @@ -56,3 +56,64 @@ func (NopTracer) EndFieldExecution(ctx context.Context) { func (NopTracer) EndOperationExecution(ctx context.Context) { } + +type tracerWrapper struct { + tracer1 Tracer + tracer2 Tracer +} + +func (tw *tracerWrapper) StartOperationParsing(ctx context.Context) context.Context { + ctx = tw.tracer1.StartOperationParsing(ctx) + ctx = tw.tracer2.StartOperationParsing(ctx) + return ctx +} + +func (tw *tracerWrapper) EndOperationParsing(ctx context.Context) { + tw.tracer2.EndOperationParsing(ctx) + tw.tracer1.EndOperationParsing(ctx) +} + +func (tw *tracerWrapper) StartOperationValidation(ctx context.Context) context.Context { + ctx = tw.tracer1.StartOperationValidation(ctx) + ctx = tw.tracer2.StartOperationValidation(ctx) + return ctx +} + +func (tw *tracerWrapper) EndOperationValidation(ctx context.Context) { + tw.tracer2.EndOperationValidation(ctx) + tw.tracer1.EndOperationValidation(ctx) +} + +func (tw *tracerWrapper) StartOperationExecution(ctx context.Context) context.Context { + ctx = tw.tracer1.StartOperationExecution(ctx) + ctx = tw.tracer2.StartOperationExecution(ctx) + return ctx +} + +func (tw *tracerWrapper) StartFieldExecution(ctx context.Context, field CollectedField) context.Context { + ctx = tw.tracer1.StartFieldExecution(ctx, field) + ctx = tw.tracer2.StartFieldExecution(ctx, field) + return ctx +} + +func (tw *tracerWrapper) StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context { + ctx = tw.tracer1.StartFieldResolverExecution(ctx, rc) + ctx = tw.tracer2.StartFieldResolverExecution(ctx, rc) + return ctx +} + +func (tw *tracerWrapper) StartFieldChildExecution(ctx context.Context) context.Context { + ctx = tw.tracer1.StartFieldChildExecution(ctx) + ctx = tw.tracer2.StartFieldChildExecution(ctx) + return ctx +} + +func (tw *tracerWrapper) EndFieldExecution(ctx context.Context) { + tw.tracer2.EndFieldExecution(ctx) + tw.tracer1.EndFieldExecution(ctx) +} + +func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) { + tw.tracer2.EndOperationExecution(ctx) + tw.tracer1.EndOperationExecution(ctx) +} diff --git a/handler/graphql.go b/handler/graphql.go index 28f4a9e7030..3c3f6e7ecfd 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -110,111 +110,6 @@ func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { } } -// RequestMiddleware allows you to define a function that will be called around the root request, -// after the query has been parsed. This is useful for logging -func RequestMiddleware(middleware graphql.RequestMiddleware) Option { - return func(cfg *Config) { - if cfg.requestHook == nil { - cfg.requestHook = middleware - return - } - - lastResolve := cfg.requestHook - cfg.requestHook = func(ctx context.Context, next func(ctx context.Context) []byte) []byte { - return lastResolve(ctx, func(ctx context.Context) []byte { - return middleware(ctx, next) - }) - } - } -} - -// Tracer allows you to add a request/resolver tracer that will be called around the root request, -// calling resolver. This is useful for tracing -func Tracer(tracer graphql.Tracer) Option { - return func(cfg *Config) { - if cfg.tracer == nil { - cfg.tracer = tracer - - } else { - lastResolve := cfg.tracer - cfg.tracer = &tracerWrapper{ - tracer1: lastResolve, - tracer2: tracer, - } - } - - opt := RequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { - ctx = tracer.StartOperationExecution(ctx) - resp := next(ctx) - tracer.EndOperationExecution(ctx) - - return resp - }) - opt(cfg) - } -} - -type tracerWrapper struct { - tracer1 graphql.Tracer - tracer2 graphql.Tracer -} - -func (tw *tracerWrapper) StartOperationParsing(ctx context.Context) context.Context { - ctx = tw.tracer1.StartOperationParsing(ctx) - ctx = tw.tracer2.StartOperationParsing(ctx) - return ctx -} - -func (tw *tracerWrapper) EndOperationParsing(ctx context.Context) { - tw.tracer2.EndOperationParsing(ctx) - tw.tracer1.EndOperationParsing(ctx) -} - -func (tw *tracerWrapper) StartOperationValidation(ctx context.Context) context.Context { - ctx = tw.tracer1.StartOperationValidation(ctx) - ctx = tw.tracer2.StartOperationValidation(ctx) - return ctx -} - -func (tw *tracerWrapper) EndOperationValidation(ctx context.Context) { - tw.tracer2.EndOperationValidation(ctx) - tw.tracer1.EndOperationValidation(ctx) -} - -func (tw *tracerWrapper) StartOperationExecution(ctx context.Context) context.Context { - ctx = tw.tracer1.StartOperationExecution(ctx) - ctx = tw.tracer2.StartOperationExecution(ctx) - return ctx -} - -func (tw *tracerWrapper) StartFieldExecution(ctx context.Context, field graphql.CollectedField) context.Context { - ctx = tw.tracer1.StartFieldExecution(ctx, field) - ctx = tw.tracer2.StartFieldExecution(ctx, field) - return ctx -} - -func (tw *tracerWrapper) StartFieldResolverExecution(ctx context.Context, rc *graphql.ResolverContext) context.Context { - ctx = tw.tracer1.StartFieldResolverExecution(ctx, rc) - ctx = tw.tracer2.StartFieldResolverExecution(ctx, rc) - return ctx -} - -func (tw *tracerWrapper) StartFieldChildExecution(ctx context.Context) context.Context { - ctx = tw.tracer1.StartFieldChildExecution(ctx) - ctx = tw.tracer2.StartFieldChildExecution(ctx) - return ctx -} - -func (tw *tracerWrapper) EndFieldExecution(ctx context.Context) { - tw.tracer2.EndFieldExecution(ctx) - tw.tracer1.EndFieldExecution(ctx) -} - -func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) { - tw.tracer2.EndOperationExecution(ctx) - tw.tracer1.EndOperationExecution(ctx) -} - // WebsocketInitFunc is called when the server receives connection init message from the client. // This can be used to check initial payload to see whether to accept the websocket connection. func WebsocketInitFunc(websocketInitFunc websocketInitFunc) Option { From d0f683034fbf877457990060a8c2423b1ccfce0d Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 2 Oct 2019 22:51:12 +1000 Subject: [PATCH 05/53] port json post --- graphql/handler/http_get.go | 10 +- graphql/handler/jsonpost.go | 58 +++++++++++ graphql/handler/jsonpost_test.go | 156 ++++++++++++++++++++++++++++++ graphql/handler/requestcontext.go | 15 +++ graphql/handler/server.go | 54 +++++++++-- handler/graphql_test.go | 112 --------------------- 6 files changed, 283 insertions(+), 122 deletions(-) create mode 100644 graphql/handler/jsonpost.go create mode 100644 graphql/handler/jsonpost_test.go create mode 100644 graphql/handler/requestcontext.go diff --git a/graphql/handler/http_get.go b/graphql/handler/http_get.go index 35aeee4666a..c31301dc609 100644 --- a/graphql/handler/http_get.go +++ b/graphql/handler/http_get.go @@ -20,8 +20,7 @@ func (H HTTPGet) Supports(r *http.Request) bool { } func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) { - var reqParams graphql.RequestContext - + reqParams := newRequestContext() reqParams.RawQuery = r.URL.Query().Get("query") reqParams.OperationName = r.URL.Query().Get("operationName") @@ -39,7 +38,12 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestCon } } - return &reqParams, func(response *graphql.Response) { + // TODO: FIXME + //if op.Operation != ast.Query && args.R.Method == http.MethodGet { + // return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("GET requests only allow query operations")} + //} + + return reqParams, func(response *graphql.Response) { b, err := json.Marshal(response) if err != nil { panic(err) diff --git a/graphql/handler/jsonpost.go b/graphql/handler/jsonpost.go new file mode 100644 index 00000000000..f9395826b11 --- /dev/null +++ b/graphql/handler/jsonpost.go @@ -0,0 +1,58 @@ +package handler + +import ( + "encoding/json" + "mime" + "net/http" + + "github.com/99designs/gqlgen/graphql" +) + +type JsonPostTransport struct{} + +var _ Transport = JsonPostTransport{} + +func (H JsonPostTransport) Supports(r *http.Request) bool { + if r.Header.Get("Upgrade") != "" { + return false + } + + mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return false + } + + return r.Method == "POST" && mediaType == "application/json" +} + +func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) { + w.Header().Set("Content-Type", "application/json") + + write := Writer(func(response *graphql.Response) { + b, err := json.Marshal(response) + if err != nil { + panic(err) + } + w.Write(b) + }) + + var params struct { + Query string `json:"query"` + OperationName string `json:"operationName"` + Variables map[string]interface{} `json:"variables"` + Extensions map[string]interface{} `json:"extensions"` + } + if err := jsonDecode(r.Body, ¶ms); err != nil { + w.WriteHeader(http.StatusBadRequest) + write.Errorf("json body could not be decoded: " + err.Error()) + return nil, nil + } + + reqParams := newRequestContext() + reqParams.RawQuery = params.Query + reqParams.OperationName = params.OperationName + reqParams.Variables = params.Variables + reqParams.Extensions = params.Extensions + + return reqParams, write +} diff --git a/graphql/handler/jsonpost_test.go b/graphql/handler/jsonpost_test.go new file mode 100644 index 00000000000..0031098236a --- /dev/null +++ b/graphql/handler/jsonpost_test.go @@ -0,0 +1,156 @@ +package handler + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/99designs/gqlgen/graphql" + "github.com/stretchr/testify/assert" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" +) + +func TestJsonPost(t *testing.T) { + es := &graphql.ExecutableSchemaMock{ + QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return &graphql.Response{Data: []byte(`{"name":"test"}`)} + }, + MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "mutations are not supported") + }, + SchemaFunc: func() *ast.Schema { + return gqlparser.MustLoadSchema(&ast.Source{Input: ` + schema { query: Query } + type Query { + me: User! + user(id: Int): User! + } + type User { name: String! } + `}) + }, + } + h := New(es) + h.AddTransport(JsonPostTransport{}) + + t.Run("success", func(t *testing.T) { + resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) + + // Todo: Extract + //t.Run("query caching", func(t *testing.T) { + // // Run enough unique queries to evict a bunch of them + // for i := 0; i < 2000; i++ { + // query := `{"query":"` + strings.Repeat(" ", i) + "{ me { name } }" + `"}` + // resp := doRequest(h, "POST", "/graphql", query) + // assert.Equal(t, http.StatusOK, resp.Code) + // assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + // } + // + // t.Run("evicted queries run", func(t *testing.T) { + // query := `{"query":"` + strings.Repeat(" ", 0) + "{ me { name } }" + `"}` + // resp := doRequest(h, "POST", "/graphql", query) + // assert.Equal(t, http.StatusOK, resp.Code) + // assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + // }) + // + // t.Run("non-evicted queries run", func(t *testing.T) { + // query := `{"query":"` + strings.Repeat(" ", 1999) + "{ me { name } }" + `"}` + // resp := doRequest(h, "POST", "/graphql", query) + // assert.Equal(t, http.StatusOK, resp.Code) + // assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + // }) + //}) + + t.Run("decode failure", func(t *testing.T) { + resp := doRequest(h, "POST", "/graphql", "notjson") + assert.Equal(t, http.StatusBadRequest, resp.Code) + assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") + assert.Equal(t, `{"errors":[{"message":"json body could not be decoded: invalid character 'o' in literal null (expecting 'u')"}],"data":null}`, resp.Body.String()) + }) + + t.Run("parse failure", func(t *testing.T) { + resp := doRequest(h, "POST", "/graphql", `{"query": "!"}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") + assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, resp.Body.String()) + }) + + t.Run("validation failure", func(t *testing.T) { + resp := doRequest(h, "POST", "/graphql", `{"query": "{ me { title }}"}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") + assert.Equal(t, `{"errors":[{"message":"Cannot query field \"title\" on type \"User\".","locations":[{"line":1,"column":8}]}],"data":null}`, resp.Body.String()) + }) + + t.Run("invalid variable", func(t *testing.T) { + resp := doRequest(h, "POST", "/graphql", `{"query": "query($id:Int!){user(id:$id){name}}","variables":{"id":false}}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") + assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) + }) + + t.Run("execution failure", func(t *testing.T) { + resp := doRequest(h, "POST", "/graphql", `{"query": "mutation { me { name } }"}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") + assert.Equal(t, `{"errors":[{"message":"mutations are not supported"}],"data":null}`, resp.Body.String()) + }) + + t.Run("validate content type", func(t *testing.T) { + doReq := func(handler http.Handler, method string, target string, body string, contentType string) *httptest.ResponseRecorder { + r := httptest.NewRequest(method, target, strings.NewReader(body)) + if contentType != "" { + r.Header.Set("Content-Type", contentType) + } + w := httptest.NewRecorder() + + handler.ServeHTTP(w, r) + return w + } + + validContentTypes := []string{ + "application/json", + "application/json; charset=utf-8", + } + + for _, contentType := range validContentTypes { + t.Run(fmt.Sprintf("allow for content type %s", contentType), func(t *testing.T) { + resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, contentType) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) + } + + invalidContentTypes := []string{ + "", + "text/plain", + + // These content types are currently not supported, but they are supported by other GraphQL servers, like express-graphql. + "application/x-www-form-urlencoded", + "application/graphql", + } + + for _, tc := range invalidContentTypes { + t.Run(fmt.Sprintf("reject for content type %s", tc), func(t *testing.T) { + resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, tc) + assert.Equal(t, http.StatusBadRequest, resp.Code) + assert.Equal(t, fmt.Sprintf(`{"errors":[{"message":"%s"}],"data":null}`, "transport not supported"), resp.Body.String()) + }) + } + }) +} + +func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { + r := httptest.NewRequest(method, target, strings.NewReader(body)) + r.Header.Set("Content-Type", "application/json") + w := httptest.NewRecorder() + + handler.ServeHTTP(w, r) + return w +} diff --git a/graphql/handler/requestcontext.go b/graphql/handler/requestcontext.go new file mode 100644 index 00000000000..98568232c68 --- /dev/null +++ b/graphql/handler/requestcontext.go @@ -0,0 +1,15 @@ +package handler + +import "github.com/99designs/gqlgen/graphql" + +func newRequestContext() *graphql.RequestContext { + return &graphql.RequestContext{ + DisableIntrospection: true, + Recover: graphql.DefaultRecover, + ErrorPresenter: graphql.DefaultErrorPresenter, + ResolverMiddleware: nil, + RequestMiddleware: nil, + Tracer: graphql.NopTracer{}, + ComplexityLimit: 0, + } +} diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 6fd06ab3787..7675760ca22 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -6,6 +6,8 @@ import ( "fmt" "net/http" + "github.com/vektah/gqlparser/validator" + "github.com/99designs/gqlgen/graphql" "github.com/vektah/gqlparser/ast" "github.com/vektah/gqlparser/gqlerror" @@ -78,6 +80,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } rc, writer := transport.Do(w, r) + if rc == nil { + return + } handler := s.executableSchemaHandler @@ -92,20 +97,36 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware // and sends responses to the transport so it can be returned to the client func (s *Server) executableSchemaHandler(ctx context.Context, write Writer) { - r := graphql.GetRequestContext(ctx) + rc := graphql.GetRequestContext(ctx) var gerr *gqlerror.Error // todo: hmm... how should this work? - if r.Doc == nil { - r.Doc, gerr = s.parseOperation(ctx, r.RawQuery) + if rc.Doc == nil { + rc.Doc, gerr = s.parseOperation(ctx, rc) if gerr != nil { write(&graphql.Response{Errors: []*gqlerror.Error{gerr}}) return } } - op := r.Doc.Operations.ForName(r.OperationName) + ctx, op, listErr := s.validateOperation(ctx, rc) + if len(listErr) != 0 { + write(&graphql.Response{ + Errors: listErr, + }) + return + } + + vars, err := validator.VariableValues(s.es.Schema(), op, rc.Variables) + if err != nil { + write(&graphql.Response{ + Errors: gqlerror.List{err}, + }) + return + } + + rc.Variables = vars switch op.Operation { case ast.Query: @@ -125,9 +146,28 @@ func (s *Server) executableSchemaHandler(ctx context.Context, write Writer) { } } -func (s *Server) parseOperation(ctx context.Context, query string) (*ast.QueryDocument, *gqlerror.Error) { - // todo: tracing - return parser.ParseQuery(&ast.Source{Input: query}) +func (s *Server) parseOperation(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, *gqlerror.Error) { + ctx = rc.Tracer.StartOperationValidation(ctx) + defer func() { rc.Tracer.EndOperationValidation(ctx) }() + + return parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) +} + +func (gh *Server) validateOperation(ctx context.Context, rc *graphql.RequestContext) (context.Context, *ast.OperationDefinition, gqlerror.List) { + ctx = rc.Tracer.StartOperationValidation(ctx) + defer func() { rc.Tracer.EndOperationValidation(ctx) }() + + listErr := validator.Validate(gh.es.Schema(), rc.Doc) + if len(listErr) != 0 { + return ctx, nil, listErr + } + + op := rc.Doc.Operations.ForName(rc.OperationName) + if op == nil { + return ctx, nil, gqlerror.List{gqlerror.Errorf("operation %s not found", rc.OperationName)} + } + + return ctx, op, nil } func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { diff --git a/handler/graphql_test.go b/handler/graphql_test.go index c932e9a0729..96ac4924b5d 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -20,118 +20,6 @@ import ( "github.com/vektah/gqlparser/ast" ) -func TestHandlerPOST(t *testing.T) { - h := GraphQL(&executableSchemaStub{}) - - t.Run("success", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - - t.Run("query caching", func(t *testing.T) { - // Run enough unique queries to evict a bunch of them - for i := 0; i < 2000; i++ { - query := `{"query":"` + strings.Repeat(" ", i) + "{ me { name } }" + `"}` - resp := doRequest(h, "POST", "/graphql", query) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - } - - t.Run("evicted queries run", func(t *testing.T) { - query := `{"query":"` + strings.Repeat(" ", 0) + "{ me { name } }" + `"}` - resp := doRequest(h, "POST", "/graphql", query) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - - t.Run("non-evicted queries run", func(t *testing.T) { - query := `{"query":"` + strings.Repeat(" ", 1999) + "{ me { name } }" + `"}` - resp := doRequest(h, "POST", "/graphql", query) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - }) - - t.Run("decode failure", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", "notjson") - assert.Equal(t, http.StatusBadRequest, resp.Code) - assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") - assert.Equal(t, `{"errors":[{"message":"json body could not be decoded: invalid character 'o' in literal null (expecting 'u')"}],"data":null}`, resp.Body.String()) - }) - - t.Run("parse failure", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "!"}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") - assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, resp.Body.String()) - }) - - t.Run("validation failure", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "{ me { title }}"}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") - assert.Equal(t, `{"errors":[{"message":"Cannot query field \"title\" on type \"User\".","locations":[{"line":1,"column":8}]}],"data":null}`, resp.Body.String()) - }) - - t.Run("invalid variable", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "query($id:Int!){user(id:$id){name}}","variables":{"id":false}}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") - assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) - }) - - t.Run("execution failure", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "mutation { me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") - assert.Equal(t, `{"errors":[{"message":"mutations are not supported"}],"data":null}`, resp.Body.String()) - }) - - t.Run("validate content type", func(t *testing.T) { - doReq := func(handler http.Handler, method string, target string, body string, contentType string) *httptest.ResponseRecorder { - r := httptest.NewRequest(method, target, strings.NewReader(body)) - if contentType != "" { - r.Header.Set("Content-Type", contentType) - } - w := httptest.NewRecorder() - - handler.ServeHTTP(w, r) - return w - } - - validContentTypes := []string{ - "application/json", - "application/json; charset=utf-8", - } - - for _, contentType := range validContentTypes { - t.Run(fmt.Sprintf("allow for content type %s", contentType), func(t *testing.T) { - resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, contentType) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - } - - invalidContentTypes := []struct{ contentType, expectedError string }{ - {"", "error parsing request Content-Type"}, - {"text/plain", "unsupported Content-Type: text/plain"}, - - // These content types are currently not supported, but they are supported by other GraphQL servers, like express-graphql. - {"application/x-www-form-urlencoded", "unsupported Content-Type: application/x-www-form-urlencoded"}, - {"application/graphql", "unsupported Content-Type: application/graphql"}, - } - - for _, tc := range invalidContentTypes { - t.Run(fmt.Sprintf("reject for content type %s", tc.contentType), func(t *testing.T) { - resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, tc.contentType) - assert.Equal(t, http.StatusBadRequest, resp.Code) - assert.Equal(t, fmt.Sprintf(`{"errors":[{"message":"%s"}],"data":null}`, tc.expectedError), resp.Body.String()) - }) - } - }) -} - func TestHandlerGET(t *testing.T) { h := GraphQL(&executableSchemaStub{}) From b5089cac400ddf2ffb00d75c849656731d2cb29e Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 11:05:47 +1100 Subject: [PATCH 06/53] Split transports into subpackage --- graphql/handler/apq.go | 4 ++- graphql/handler/complexity.go | 6 ++-- graphql/handler/errors.go | 6 ++-- graphql/handler/introspection.go | 4 ++- graphql/handler/server.go | 31 +++++-------------- graphql/handler/server_test.go | 12 ++++--- graphql/handler/tracer.go | 4 ++- graphql/handler/{ => transport}/http_get.go | 22 +++++++------ graphql/handler/{ => transport}/jsonpost.go | 2 +- .../handler/{ => transport}/jsonpost_test.go | 8 +++-- .../handler/{ => transport}/requestcontext.go | 2 +- graphql/handler/transport/transport.go | 29 +++++++++++++++++ graphql/handler/utils_test.go | 3 +- 13 files changed, 82 insertions(+), 51 deletions(-) rename graphql/handler/{ => transport}/http_get.go (85%) rename graphql/handler/{ => transport}/jsonpost.go (98%) rename graphql/handler/{ => transport}/jsonpost_test.go (96%) rename graphql/handler/{ => transport}/requestcontext.go (95%) create mode 100644 graphql/handler/transport/transport.go diff --git a/graphql/handler/apq.go b/graphql/handler/apq.go index ba8c21499c5..1f4a456ae70 100644 --- a/graphql/handler/apq.go +++ b/graphql/handler/apq.go @@ -5,6 +5,8 @@ import ( "crypto/sha256" "encoding/hex" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql" "github.com/mitchellh/mapstructure" ) @@ -20,7 +22,7 @@ const ( // see https://github.com/apollographql/apollo-link-persisted-queries func AutomaticPersistedQuery(cache Cache) Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { rc := graphql.GetRequestContext(ctx) if rc.Extensions["persistedQuery"] == nil { diff --git a/graphql/handler/complexity.go b/graphql/handler/complexity.go index 0cae2d56162..41219df0fe2 100644 --- a/graphql/handler/complexity.go +++ b/graphql/handler/complexity.go @@ -3,6 +3,8 @@ package handler import ( "context" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql" ) @@ -11,7 +13,7 @@ import ( // If a query is submitted that exceeds the limit, a 422 status code will be returned. func ComplexityLimit(limit int) Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { graphql.GetRequestContext(ctx).ComplexityLimit = limit next(ctx, writer) } @@ -25,7 +27,7 @@ func ComplexityLimit(limit int) Middleware { // If a query is submitted that exceeds the limit, a 422 status code will be returned. func ComplexityLimitFunc(f graphql.ComplexityLimitFunc) Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { graphql.GetRequestContext(ctx).ComplexityLimit = f(ctx) next(ctx, writer) } diff --git a/graphql/handler/errors.go b/graphql/handler/errors.go index f4c9f97c471..a238fd36509 100644 --- a/graphql/handler/errors.go +++ b/graphql/handler/errors.go @@ -3,6 +3,8 @@ package handler import ( "context" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql" ) @@ -11,7 +13,7 @@ import ( // implementation in graphql.DefaultErrorPresenter for an example. func ErrorPresenter(ep graphql.ErrorPresenterFunc) Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { graphql.GetRequestContext(ctx).ErrorPresenter = ep next(ctx, writer) } @@ -22,7 +24,7 @@ func ErrorPresenter(ep graphql.ErrorPresenterFunc) Middleware { // and hide internal error types from clients. func RecoverFunc(recover graphql.RecoverFunc) Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { graphql.GetRequestContext(ctx).Recover = recover next(ctx, writer) } diff --git a/graphql/handler/introspection.go b/graphql/handler/introspection.go index 279d8fdb0b1..0d435ba72fb 100644 --- a/graphql/handler/introspection.go +++ b/graphql/handler/introspection.go @@ -3,13 +3,15 @@ package handler import ( "context" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql" ) // Introspection enables clients to reflect all of the types available on the graph. func Introspection() Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { graphql.GetRequestContext(ctx).DisableIntrospection = false next(ctx, writer) } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 7675760ca22..091b0f48932 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -6,6 +6,8 @@ import ( "fmt" "net/http" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/vektah/gqlparser/validator" "github.com/99designs/gqlgen/graphql" @@ -17,39 +19,20 @@ import ( type ( Server struct { es graphql.ExecutableSchema - transports []Transport + transports []transport.Transport middlewares []Middleware } - Handler func(ctx context.Context, writer Writer) - - Writer func(*graphql.Response) + Handler func(ctx context.Context, writer transport.Writer) Middleware func(next Handler) Handler - Transport interface { - Supports(r *http.Request) bool - Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) - } - Option func(Server) ResponseStream func() *graphql.Response ) -func (w Writer) Errorf(format string, args ...interface{}) { - w(&graphql.Response{ - Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}, - }) -} - -func (w Writer) Error(msg string) { - w(&graphql.Response{ - Errors: gqlerror.List{{Message: msg}}, - }) -} - -func (s *Server) AddTransport(transport Transport) { +func (s *Server) AddTransport(transport transport.Transport) { s.transports = append(s.transports, transport) } @@ -63,7 +46,7 @@ func New(es graphql.ExecutableSchema) *Server { } } -func (s *Server) getTransport(r *http.Request) Transport { +func (s *Server) getTransport(r *http.Request) transport.Transport { for _, t := range s.transports { if t.Supports(r) { return t @@ -96,7 +79,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware // and sends responses to the transport so it can be returned to the client -func (s *Server) executableSchemaHandler(ctx context.Context, write Writer) { +func (s *Server) executableSchemaHandler(ctx context.Context, write transport.Writer) { rc := graphql.GetRequestContext(ctx) var gerr *gqlerror.Error diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index ad5f0fe60d4..d5919f0c255 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" "github.com/vektah/gqlparser/ast" ) @@ -31,11 +32,14 @@ func TestServer(t *testing.T) { return &graphql.Response{Data: []byte(`"subscription resp"`)} } }, + SchemaFunc: func() *ast.Schema { + return &ast.Schema{} + }, } srv := New(es) - srv.AddTransport(&HTTPGet{}) + srv.AddTransport(&transport.HTTPGet{}) srv.Use(func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { next(ctx, writer) } }) @@ -67,13 +71,13 @@ func TestServer(t *testing.T) { t.Run("invokes middleware in order", func(t *testing.T) { var calls []string srv.Use(func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { calls = append(calls, "first") next(ctx, writer) } }) srv.Use(func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { calls = append(calls, "second") next(ctx, writer) } diff --git a/graphql/handler/tracer.go b/graphql/handler/tracer.go index 4ab1baed40e..ccdb605681e 100644 --- a/graphql/handler/tracer.go +++ b/graphql/handler/tracer.go @@ -3,6 +3,8 @@ package handler import ( "context" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql" ) @@ -10,7 +12,7 @@ import ( // calling resolver. This is useful for tracing func Tracer(tracer graphql.Tracer) Middleware { return func(next Handler) Handler { - return func(ctx context.Context, writer Writer) { + return func(ctx context.Context, writer transport.Writer) { rc := graphql.GetRequestContext(ctx) rc.AddTracer(tracer) rc.AddRequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { diff --git a/graphql/handler/http_get.go b/graphql/handler/transport/http_get.go similarity index 85% rename from graphql/handler/http_get.go rename to graphql/handler/transport/http_get.go index c31301dc609..15720b2b309 100644 --- a/graphql/handler/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -1,4 +1,4 @@ -package handler +package transport import ( "encoding/json" @@ -24,16 +24,24 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestCon reqParams.RawQuery = r.URL.Query().Get("query") reqParams.OperationName = r.URL.Query().Get("operationName") + writer := Writer(func(response *graphql.Response) { + b, err := json.Marshal(response) + if err != nil { + panic(err) + } + w.Write(b) + }) + if variables := r.URL.Query().Get("variables"); variables != "" { if err := jsonDecode(strings.NewReader(variables), &reqParams.Variables); err != nil { - sendErrorf(w, http.StatusBadRequest, "variables could not be decoded") + writer.Errorf("variables could not be decoded") return nil, nil } } if extensions := r.URL.Query().Get("extensions"); extensions != "" { if err := jsonDecode(strings.NewReader(extensions), &reqParams.Extensions); err != nil { - sendErrorf(w, http.StatusBadRequest, "extensions could not be decoded") + writer.Errorf("extensions could not be decoded") return nil, nil } } @@ -43,13 +51,7 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestCon // return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("GET requests only allow query operations")} //} - return reqParams, func(response *graphql.Response) { - b, err := json.Marshal(response) - if err != nil { - panic(err) - } - w.Write(b) - } + return reqParams, writer } func jsonDecode(r io.Reader, val interface{}) error { diff --git a/graphql/handler/jsonpost.go b/graphql/handler/transport/jsonpost.go similarity index 98% rename from graphql/handler/jsonpost.go rename to graphql/handler/transport/jsonpost.go index f9395826b11..4f103a7c9f2 100644 --- a/graphql/handler/jsonpost.go +++ b/graphql/handler/transport/jsonpost.go @@ -1,4 +1,4 @@ -package handler +package transport import ( "encoding/json" diff --git a/graphql/handler/jsonpost_test.go b/graphql/handler/transport/jsonpost_test.go similarity index 96% rename from graphql/handler/jsonpost_test.go rename to graphql/handler/transport/jsonpost_test.go index 0031098236a..3c6d83d7678 100644 --- a/graphql/handler/jsonpost_test.go +++ b/graphql/handler/transport/jsonpost_test.go @@ -1,4 +1,4 @@ -package handler +package transport_test import ( "context" @@ -9,6 +9,8 @@ import ( "testing" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" "github.com/vektah/gqlparser" "github.com/vektah/gqlparser/ast" @@ -33,8 +35,8 @@ func TestJsonPost(t *testing.T) { `}) }, } - h := New(es) - h.AddTransport(JsonPostTransport{}) + h := handler.New(es) + h.AddTransport(transport.JsonPostTransport{}) t.Run("success", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) diff --git a/graphql/handler/requestcontext.go b/graphql/handler/transport/requestcontext.go similarity index 95% rename from graphql/handler/requestcontext.go rename to graphql/handler/transport/requestcontext.go index 98568232c68..b5e443d0681 100644 --- a/graphql/handler/requestcontext.go +++ b/graphql/handler/transport/requestcontext.go @@ -1,4 +1,4 @@ -package handler +package transport import "github.com/99designs/gqlgen/graphql" diff --git a/graphql/handler/transport/transport.go b/graphql/handler/transport/transport.go new file mode 100644 index 00000000000..ecb62d72868 --- /dev/null +++ b/graphql/handler/transport/transport.go @@ -0,0 +1,29 @@ +package transport + +import ( + "fmt" + "net/http" + + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/gqlerror" +) + +type ( + Transport interface { + Supports(r *http.Request) bool + Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) + } + Writer func(*graphql.Response) +) + +func (w Writer) Errorf(format string, args ...interface{}) { + w(&graphql.Response{ + Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}, + }) +} + +func (w Writer) Error(msg string) { + w(&graphql.Response{ + Errors: gqlerror.List{{Message: msg}}, + }) +} diff --git a/graphql/handler/utils_test.go b/graphql/handler/utils_test.go index 3ec9dae658f..2c806983767 100644 --- a/graphql/handler/utils_test.go +++ b/graphql/handler/utils_test.go @@ -4,6 +4,7 @@ import ( "context" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/transport" ) type middlewareContext struct { @@ -19,7 +20,7 @@ func testMiddleware(m Middleware, initialContexts ...graphql.RequestContext) mid initial = &initialContexts[0] } - m(func(ctx context.Context, writer Writer) { + m(func(ctx context.Context, writer transport.Writer) { c.ResultContext = *graphql.GetRequestContext(ctx) c.InvokedNext = true })(graphql.WithRequestContext(context.Background(), initial), func(response *graphql.Response) { From eed1515c7abeb08a00291e9ab241f88af860d8aa Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 13:17:32 +1100 Subject: [PATCH 07/53] Split middlware out of handler package --- graphql/{handler => }/cache.go | 2 +- .../transport/transport.go => handler.go} | 16 ++++++++----- graphql/handler/{ => middleware}/apq.go | 10 ++++---- graphql/handler/{ => middleware}/apq_test.go | 18 +++++++-------- .../handler/{ => middleware}/complexity.go | 16 ++++++------- .../{ => middleware}/complexity_test.go | 2 +- graphql/handler/{ => middleware}/errors.go | 16 ++++++------- .../handler/{ => middleware}/errors_test.go | 2 +- .../handler/{ => middleware}/introspection.go | 10 ++++---- .../{ => middleware}/introspection_test.go | 2 +- graphql/handler/{ => middleware}/tracer.go | 10 ++++---- .../handler/{ => middleware}/tracer_test.go | 2 +- .../handler/{ => middleware}/utils_test.go | 7 +++--- graphql/handler/server.go | 23 ++++++------------- graphql/handler/server_test.go | 12 +++++----- graphql/handler/transport/http_get.go | 4 ++-- graphql/handler/transport/jsonpost.go | 6 ++--- 17 files changed, 71 insertions(+), 87 deletions(-) rename graphql/{handler => }/cache.go (97%) rename graphql/{handler/transport/transport.go => handler.go} (55%) rename graphql/handler/{ => middleware}/apq.go (88%) rename graphql/handler/{ => middleware}/apq_test.go (84%) rename graphql/handler/{ => middleware}/complexity.go (66%) rename graphql/handler/{ => middleware}/complexity_test.go (96%) rename graphql/handler/{ => middleware}/errors.go (63%) rename graphql/handler/{ => middleware}/errors_test.go (97%) rename graphql/handler/{ => middleware}/introspection.go (53%) rename graphql/handler/{ => middleware}/introspection_test.go (95%) rename graphql/handler/{ => middleware}/tracer.go (70%) rename graphql/handler/{ => middleware}/tracer_test.go (94%) rename graphql/handler/{ => middleware}/utils_test.go (70%) diff --git a/graphql/handler/cache.go b/graphql/cache.go similarity index 97% rename from graphql/handler/cache.go rename to graphql/cache.go index dff56702779..bd55f0b8e14 100644 --- a/graphql/handler/cache.go +++ b/graphql/cache.go @@ -1,4 +1,4 @@ -package handler +package graphql // Cache is a shared store for APQ and query AST caching type Cache interface { diff --git a/graphql/handler/transport/transport.go b/graphql/handler.go similarity index 55% rename from graphql/handler/transport/transport.go rename to graphql/handler.go index ecb62d72868..8798e59e4a7 100644 --- a/graphql/handler/transport/transport.go +++ b/graphql/handler.go @@ -1,29 +1,33 @@ -package transport +package graphql import ( + "context" "fmt" "net/http" - "github.com/99designs/gqlgen/graphql" "github.com/vektah/gqlparser/gqlerror" ) type ( + Handler func(ctx context.Context, writer Writer) + Middleware func(next Handler) Handler + ResponseStream func() *Response + Writer func(*Response) + Transport interface { Supports(r *http.Request) bool - Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) + Do(w http.ResponseWriter, r *http.Request) (*RequestContext, Writer) } - Writer func(*graphql.Response) ) func (w Writer) Errorf(format string, args ...interface{}) { - w(&graphql.Response{ + w(&Response{ Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}, }) } func (w Writer) Error(msg string) { - w(&graphql.Response{ + w(&Response{ Errors: gqlerror.List{{Message: msg}}, }) } diff --git a/graphql/handler/apq.go b/graphql/handler/middleware/apq.go similarity index 88% rename from graphql/handler/apq.go rename to graphql/handler/middleware/apq.go index 1f4a456ae70..62315c9b49c 100644 --- a/graphql/handler/apq.go +++ b/graphql/handler/middleware/apq.go @@ -1,12 +1,10 @@ -package handler +package middleware import ( "context" "crypto/sha256" "encoding/hex" - "github.com/99designs/gqlgen/graphql/handler/transport" - "github.com/99designs/gqlgen/graphql" "github.com/mitchellh/mapstructure" ) @@ -20,9 +18,9 @@ const ( // does not yet know what the query is for the hash it will respond telling the client to send the query along with the // hash in the next request. // see https://github.com/apollographql/apollo-link-persisted-queries -func AutomaticPersistedQuery(cache Cache) Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func AutomaticPersistedQuery(cache graphql.Cache) graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { rc := graphql.GetRequestContext(ctx) if rc.Extensions["persistedQuery"] == nil { diff --git a/graphql/handler/apq_test.go b/graphql/handler/middleware/apq_test.go similarity index 84% rename from graphql/handler/apq_test.go rename to graphql/handler/middleware/apq_test.go index 28f2f825862..d1a872cf04b 100644 --- a/graphql/handler/apq_test.go +++ b/graphql/handler/middleware/apq_test.go @@ -1,4 +1,4 @@ -package handler +package middleware import ( "testing" @@ -12,7 +12,7 @@ func TestAPQ(t *testing.T) { const hash = "b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88" t.Run("with query and no hash", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ RawQuery: "original query", }) @@ -21,7 +21,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash miss and no query", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ RawQuery: "", Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ @@ -36,7 +36,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash miss and query", func(t *testing.T) { - cache := MapCache{} + cache := graphql.MapCache{} rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ RawQuery: query, Extensions: map[string]interface{}{ @@ -53,7 +53,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash miss and query", func(t *testing.T) { - cache := MapCache{} + cache := graphql.MapCache{} rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ RawQuery: query, Extensions: map[string]interface{}{ @@ -70,7 +70,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash hit and no query", func(t *testing.T) { - cache := MapCache{ + cache := graphql.MapCache{ hash: query, } rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ @@ -88,7 +88,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with malformed extension payload", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ Extensions: map[string]interface{}{ "persistedQuery": "asdf", }, @@ -99,7 +99,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with invalid extension version", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "version": 2, @@ -112,7 +112,7 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash mismatch", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(MapCache{}), graphql.RequestContext{ + rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ RawQuery: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ diff --git a/graphql/handler/complexity.go b/graphql/handler/middleware/complexity.go similarity index 66% rename from graphql/handler/complexity.go rename to graphql/handler/middleware/complexity.go index 41219df0fe2..fc65e3bebcd 100644 --- a/graphql/handler/complexity.go +++ b/graphql/handler/middleware/complexity.go @@ -1,19 +1,17 @@ -package handler +package middleware import ( "context" - "github.com/99designs/gqlgen/graphql/handler/transport" - "github.com/99designs/gqlgen/graphql" ) // ComplexityLimit sets a maximum query complexity that is allowed to be executed. // // If a query is submitted that exceeds the limit, a 422 status code will be returned. -func ComplexityLimit(limit int) Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func ComplexityLimit(limit int) graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { graphql.GetRequestContext(ctx).ComplexityLimit = limit next(ctx, writer) } @@ -25,9 +23,9 @@ func ComplexityLimit(limit int) Middleware { // instead. // // If a query is submitted that exceeds the limit, a 422 status code will be returned. -func ComplexityLimitFunc(f graphql.ComplexityLimitFunc) Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func ComplexityLimitFunc(f graphql.ComplexityLimitFunc) graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { graphql.GetRequestContext(ctx).ComplexityLimit = f(ctx) next(ctx, writer) } diff --git a/graphql/handler/complexity_test.go b/graphql/handler/middleware/complexity_test.go similarity index 96% rename from graphql/handler/complexity_test.go rename to graphql/handler/middleware/complexity_test.go index c53e858a364..0e141826a3a 100644 --- a/graphql/handler/complexity_test.go +++ b/graphql/handler/middleware/complexity_test.go @@ -1,4 +1,4 @@ -package handler +package middleware import ( "context" diff --git a/graphql/handler/errors.go b/graphql/handler/middleware/errors.go similarity index 63% rename from graphql/handler/errors.go rename to graphql/handler/middleware/errors.go index a238fd36509..584f6524b57 100644 --- a/graphql/handler/errors.go +++ b/graphql/handler/middleware/errors.go @@ -1,19 +1,17 @@ -package handler +package middleware import ( "context" - "github.com/99designs/gqlgen/graphql/handler/transport" - "github.com/99designs/gqlgen/graphql" ) // ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides // a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default // implementation in graphql.DefaultErrorPresenter for an example. -func ErrorPresenter(ep graphql.ErrorPresenterFunc) Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func ErrorPresenter(ep graphql.ErrorPresenterFunc) graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { graphql.GetRequestContext(ctx).ErrorPresenter = ep next(ctx, writer) } @@ -22,9 +20,9 @@ func ErrorPresenter(ep graphql.ErrorPresenterFunc) Middleware { // RecoverFunc is called to recover from panics inside goroutines. It can be used to send errors to error trackers // and hide internal error types from clients. -func RecoverFunc(recover graphql.RecoverFunc) Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func RecoverFunc(recover graphql.RecoverFunc) graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { graphql.GetRequestContext(ctx).Recover = recover next(ctx, writer) } diff --git a/graphql/handler/errors_test.go b/graphql/handler/middleware/errors_test.go similarity index 97% rename from graphql/handler/errors_test.go rename to graphql/handler/middleware/errors_test.go index 2ccacba9386..9471b6ae3bc 100644 --- a/graphql/handler/errors_test.go +++ b/graphql/handler/middleware/errors_test.go @@ -1,4 +1,4 @@ -package handler +package middleware import ( "context" diff --git a/graphql/handler/introspection.go b/graphql/handler/middleware/introspection.go similarity index 53% rename from graphql/handler/introspection.go rename to graphql/handler/middleware/introspection.go index 0d435ba72fb..681df097012 100644 --- a/graphql/handler/introspection.go +++ b/graphql/handler/middleware/introspection.go @@ -1,17 +1,15 @@ -package handler +package middleware import ( "context" - "github.com/99designs/gqlgen/graphql/handler/transport" - "github.com/99designs/gqlgen/graphql" ) // Introspection enables clients to reflect all of the types available on the graph. -func Introspection() Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func Introspection() graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { graphql.GetRequestContext(ctx).DisableIntrospection = false next(ctx, writer) } diff --git a/graphql/handler/introspection_test.go b/graphql/handler/middleware/introspection_test.go similarity index 95% rename from graphql/handler/introspection_test.go rename to graphql/handler/middleware/introspection_test.go index e40de31cb04..475c908a2d7 100644 --- a/graphql/handler/introspection_test.go +++ b/graphql/handler/middleware/introspection_test.go @@ -1,4 +1,4 @@ -package handler +package middleware import ( "testing" diff --git a/graphql/handler/tracer.go b/graphql/handler/middleware/tracer.go similarity index 70% rename from graphql/handler/tracer.go rename to graphql/handler/middleware/tracer.go index ccdb605681e..983f03ea02e 100644 --- a/graphql/handler/tracer.go +++ b/graphql/handler/middleware/tracer.go @@ -1,18 +1,16 @@ -package handler +package middleware import ( "context" - "github.com/99designs/gqlgen/graphql/handler/transport" - "github.com/99designs/gqlgen/graphql" ) // Tracer allows you to add a request/resolver tracer that will be called around the root request, // calling resolver. This is useful for tracing -func Tracer(tracer graphql.Tracer) Middleware { - return func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { +func Tracer(tracer graphql.Tracer) graphql.Middleware { + return func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { rc := graphql.GetRequestContext(ctx) rc.AddTracer(tracer) rc.AddRequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { diff --git a/graphql/handler/tracer_test.go b/graphql/handler/middleware/tracer_test.go similarity index 94% rename from graphql/handler/tracer_test.go rename to graphql/handler/middleware/tracer_test.go index 25e3eaa8e0d..bdaf821511d 100644 --- a/graphql/handler/tracer_test.go +++ b/graphql/handler/middleware/tracer_test.go @@ -1,4 +1,4 @@ -package handler +package middleware import ( "testing" diff --git a/graphql/handler/utils_test.go b/graphql/handler/middleware/utils_test.go similarity index 70% rename from graphql/handler/utils_test.go rename to graphql/handler/middleware/utils_test.go index 2c806983767..e2ac94f99ed 100644 --- a/graphql/handler/utils_test.go +++ b/graphql/handler/middleware/utils_test.go @@ -1,10 +1,9 @@ -package handler +package middleware import ( "context" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/handler/transport" ) type middlewareContext struct { @@ -13,14 +12,14 @@ type middlewareContext struct { Response graphql.Response } -func testMiddleware(m Middleware, initialContexts ...graphql.RequestContext) middlewareContext { +func testMiddleware(m graphql.Middleware, initialContexts ...graphql.RequestContext) middlewareContext { var c middlewareContext initial := &graphql.RequestContext{} if len(initialContexts) > 0 { initial = &initialContexts[0] } - m(func(ctx context.Context, writer transport.Writer) { + m(func(ctx context.Context, writer graphql.Writer) { c.ResultContext = *graphql.GetRequestContext(ctx) c.InvokedNext = true })(graphql.WithRequestContext(context.Background(), initial), func(response *graphql.Response) { diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 091b0f48932..606a4b1971e 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -6,37 +6,28 @@ import ( "fmt" "net/http" - "github.com/99designs/gqlgen/graphql/handler/transport" - - "github.com/vektah/gqlparser/validator" - "github.com/99designs/gqlgen/graphql" "github.com/vektah/gqlparser/ast" "github.com/vektah/gqlparser/gqlerror" "github.com/vektah/gqlparser/parser" + "github.com/vektah/gqlparser/validator" ) type ( Server struct { es graphql.ExecutableSchema - transports []transport.Transport - middlewares []Middleware + transports []graphql.Transport + middlewares []graphql.Middleware } - Handler func(ctx context.Context, writer transport.Writer) - - Middleware func(next Handler) Handler - Option func(Server) - - ResponseStream func() *graphql.Response ) -func (s *Server) AddTransport(transport transport.Transport) { +func (s *Server) AddTransport(transport graphql.Transport) { s.transports = append(s.transports, transport) } -func (s *Server) Use(middleware Middleware) { +func (s *Server) Use(middleware graphql.Middleware) { s.middlewares = append(s.middlewares, middleware) } @@ -46,7 +37,7 @@ func New(es graphql.ExecutableSchema) *Server { } } -func (s *Server) getTransport(r *http.Request) transport.Transport { +func (s *Server) getTransport(r *http.Request) graphql.Transport { for _, t := range s.transports { if t.Supports(r) { return t @@ -79,7 +70,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware // and sends responses to the transport so it can be returned to the client -func (s *Server) executableSchemaHandler(ctx context.Context, write transport.Writer) { +func (s *Server) executableSchemaHandler(ctx context.Context, write graphql.Writer) { rc := graphql.GetRequestContext(ctx) var gerr *gqlerror.Error diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index d5919f0c255..feee8c9d6fc 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -38,8 +38,8 @@ func TestServer(t *testing.T) { } srv := New(es) srv.AddTransport(&transport.HTTPGet{}) - srv.Use(func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { + srv.Use(func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { next(ctx, writer) } }) @@ -70,14 +70,14 @@ func TestServer(t *testing.T) { t.Run("invokes middleware in order", func(t *testing.T) { var calls []string - srv.Use(func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { + srv.Use(func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "first") next(ctx, writer) } }) - srv.Use(func(next Handler) Handler { - return func(ctx context.Context, writer transport.Writer) { + srv.Use(func(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "second") next(ctx, writer) } diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 15720b2b309..caefc255958 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -19,12 +19,12 @@ func (H HTTPGet) Supports(r *http.Request) bool { return r.Method == "GET" } -func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) { +func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, graphql.Writer) { reqParams := newRequestContext() reqParams.RawQuery = r.URL.Query().Get("query") reqParams.OperationName = r.URL.Query().Get("operationName") - writer := Writer(func(response *graphql.Response) { + writer := graphql.Writer(func(response *graphql.Response) { b, err := json.Marshal(response) if err != nil { panic(err) diff --git a/graphql/handler/transport/jsonpost.go b/graphql/handler/transport/jsonpost.go index 4f103a7c9f2..c8c94279126 100644 --- a/graphql/handler/transport/jsonpost.go +++ b/graphql/handler/transport/jsonpost.go @@ -10,7 +10,7 @@ import ( type JsonPostTransport struct{} -var _ Transport = JsonPostTransport{} +var _ graphql.Transport = JsonPostTransport{} func (H JsonPostTransport) Supports(r *http.Request) bool { if r.Header.Get("Upgrade") != "" { @@ -25,10 +25,10 @@ func (H JsonPostTransport) Supports(r *http.Request) bool { return r.Method == "POST" && mediaType == "application/json" } -func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, Writer) { +func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, graphql.Writer) { w.Header().Set("Content-Type", "application/json") - write := Writer(func(response *graphql.Response) { + write := graphql.Writer(func(response *graphql.Response) { b, err := json.Marshal(response) if err != nil { panic(err) From cb99b42ed0e4974aeb1fc2d9cee43d061c1152cf Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 14:22:26 +1100 Subject: [PATCH 08/53] Add websocket transport --- graphql/handler.go | 2 +- graphql/handler/server.go | 10 +- graphql/handler/transport/error.go | 26 ++ graphql/handler/transport/http_get.go | 21 +- graphql/handler/transport/jsonpost.go | 24 +- graphql/handler/transport/raw.go | 8 + .../handler/transport}/websocket.go | 168 ++++----- .../handler/transport/websocket_init.go | 14 +- graphql/handler/transport/websocket_test.go | 347 ++++++++++++++++++ handler/websocket_test.go | 272 -------------- 10 files changed, 476 insertions(+), 416 deletions(-) create mode 100644 graphql/handler/transport/error.go create mode 100644 graphql/handler/transport/raw.go rename {handler => graphql/handler/transport}/websocket.go (61%) rename handler/context.go => graphql/handler/transport/websocket_init.go (78%) create mode 100644 graphql/handler/transport/websocket_test.go delete mode 100644 handler/websocket_test.go diff --git a/graphql/handler.go b/graphql/handler.go index 8798e59e4a7..6a9cd705ef0 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -16,7 +16,7 @@ type ( Transport interface { Supports(r *http.Request) bool - Do(w http.ResponseWriter, r *http.Request) (*RequestContext, Writer) + Do(w http.ResponseWriter, r *http.Request, handler Handler) } ) diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 606a4b1971e..b45352db857 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -53,19 +53,13 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - rc, writer := transport.Do(w, r) - if rc == nil { - return - } - + // todo: Should be done statically at server init rather than per request. handler := s.executableSchemaHandler - for i := len(s.middlewares) - 1; i >= 0; i-- { handler = s.middlewares[i](handler) } - ctx := graphql.WithRequestContext(r.Context(), rc) - handler(ctx, writer) + transport.Do(w, r, handler) } // executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware diff --git a/graphql/handler/transport/error.go b/graphql/handler/transport/error.go new file mode 100644 index 00000000000..e03481c9c0d --- /dev/null +++ b/graphql/handler/transport/error.go @@ -0,0 +1,26 @@ +package transport + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/gqlerror" +) + +// SendError sends a best effort error to a raw response writer. It assumes the client can understand the standard +// json error response +func SendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { + w.WriteHeader(code) + b, err := json.Marshal(&graphql.Response{Errors: errors}) + if err != nil { + panic(err) + } + w.Write(b) +} + +// SendErrorf wraps SendError to add formatted messages +func SendErrorf(w http.ResponseWriter, code int, format string, args ...interface{}) { + SendError(w, code, &gqlerror.Error{Message: fmt.Sprintf(format, args...)}) +} diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index caefc255958..b9cc22205cf 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -11,6 +11,8 @@ import ( type HTTPGet struct{} +var _ graphql.Transport = HTTPGet{} + func (H HTTPGet) Supports(r *http.Request) bool { if r.Header.Get("Upgrade") != "" { return false @@ -19,10 +21,10 @@ func (H HTTPGet) Supports(r *http.Request) bool { return r.Method == "GET" } -func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, graphql.Writer) { - reqParams := newRequestContext() - reqParams.RawQuery = r.URL.Query().Get("query") - reqParams.OperationName = r.URL.Query().Get("operationName") +func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { + rc := newRequestContext() + rc.RawQuery = r.URL.Query().Get("query") + rc.OperationName = r.URL.Query().Get("operationName") writer := graphql.Writer(func(response *graphql.Response) { b, err := json.Marshal(response) @@ -33,16 +35,16 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestCon }) if variables := r.URL.Query().Get("variables"); variables != "" { - if err := jsonDecode(strings.NewReader(variables), &reqParams.Variables); err != nil { + if err := jsonDecode(strings.NewReader(variables), &rc.Variables); err != nil { writer.Errorf("variables could not be decoded") - return nil, nil + return } } if extensions := r.URL.Query().Get("extensions"); extensions != "" { - if err := jsonDecode(strings.NewReader(extensions), &reqParams.Extensions); err != nil { + if err := jsonDecode(strings.NewReader(extensions), &rc.Extensions); err != nil { writer.Errorf("extensions could not be decoded") - return nil, nil + return } } @@ -51,7 +53,8 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestCon // return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("GET requests only allow query operations")} //} - return reqParams, writer + ctx := graphql.WithRequestContext(r.Context(), rc) + handler(ctx, writer) } func jsonDecode(r io.Reader, val interface{}) error { diff --git a/graphql/handler/transport/jsonpost.go b/graphql/handler/transport/jsonpost.go index c8c94279126..8094f744849 100644 --- a/graphql/handler/transport/jsonpost.go +++ b/graphql/handler/transport/jsonpost.go @@ -25,7 +25,7 @@ func (H JsonPostTransport) Supports(r *http.Request) bool { return r.Method == "POST" && mediaType == "application/json" } -func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request) (*graphql.RequestContext, graphql.Writer) { +func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { w.Header().Set("Content-Type", "application/json") write := graphql.Writer(func(response *graphql.Response) { @@ -36,23 +36,19 @@ func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request) (*graphql. w.Write(b) }) - var params struct { - Query string `json:"query"` - OperationName string `json:"operationName"` - Variables map[string]interface{} `json:"variables"` - Extensions map[string]interface{} `json:"extensions"` - } + var params rawParams if err := jsonDecode(r.Body, ¶ms); err != nil { w.WriteHeader(http.StatusBadRequest) write.Errorf("json body could not be decoded: " + err.Error()) - return nil, nil + return } - reqParams := newRequestContext() - reqParams.RawQuery = params.Query - reqParams.OperationName = params.OperationName - reqParams.Variables = params.Variables - reqParams.Extensions = params.Extensions + rc := newRequestContext() + rc.RawQuery = params.Query + rc.OperationName = params.OperationName + rc.Variables = params.Variables + rc.Extensions = params.Extensions - return reqParams, write + ctx := graphql.WithRequestContext(r.Context(), rc) + handler(ctx, write) } diff --git a/graphql/handler/transport/raw.go b/graphql/handler/transport/raw.go new file mode 100644 index 00000000000..64b0ea8eff2 --- /dev/null +++ b/graphql/handler/transport/raw.go @@ -0,0 +1,8 @@ +package transport + +type rawParams struct { + Query string `json:"query"` + OperationName string `json:"operationName"` + Variables map[string]interface{} `json:"variables"` + Extensions map[string]interface{} `json:"extensions"` +} diff --git a/handler/websocket.go b/graphql/handler/transport/websocket.go similarity index 61% rename from handler/websocket.go rename to graphql/handler/transport/websocket.go index 3d1cc36cfcb..1d89a8705e2 100644 --- a/handler/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -1,4 +1,4 @@ -package handler +package transport import ( "bytes" @@ -10,13 +10,10 @@ import ( "sync" "time" + "github.com/vektah/gqlparser/gqlerror" + "github.com/99designs/gqlgen/graphql" "github.com/gorilla/websocket" - lru "github.com/hashicorp/golang-lru" - "github.com/vektah/gqlparser" - "github.com/vektah/gqlparser/ast" - "github.com/vektah/gqlparser/gqlerror" - "github.com/vektah/gqlparser/validator" ) const ( @@ -32,42 +29,53 @@ const ( connectionKeepAliveMsg = "ka" // Server -> Client ) -type operationMessage struct { - Payload json.RawMessage `json:"payload,omitempty"` - ID string `json:"id,omitempty"` - Type string `json:"type"` -} +type ( + WebsocketTransport struct { + Upgrader websocket.Upgrader + InitFunc websocketInitFunc + KeepAlivePingInterval time.Duration + } + wsConnection struct { + WebsocketTransport + ctx context.Context + conn *websocket.Conn + active map[string]context.CancelFunc + mu sync.Mutex + keepAliveTicker *time.Ticker + handler graphql.Handler + + initPayload InitPayload + } + operationMessage struct { + Payload json.RawMessage `json:"payload,omitempty"` + ID string `json:"id,omitempty"` + Type string `json:"type"` + } + websocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error) +) + +var _ graphql.Transport = WebsocketTransport{} -type wsConnection struct { - ctx context.Context - conn *websocket.Conn - exec graphql.ExecutableSchema - active map[string]context.CancelFunc - mu sync.Mutex - cfg *Config - cache *lru.Cache - keepAliveTicker *time.Ticker - - initPayload InitPayload +func (t WebsocketTransport) Supports(r *http.Request) bool { + return r.Header.Get("Upgrade") != "" } -func connectWs(exec graphql.ExecutableSchema, w http.ResponseWriter, r *http.Request, cfg *Config, cache *lru.Cache) { - ws, err := cfg.upgrader.Upgrade(w, r, http.Header{ +func (t WebsocketTransport) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { + ws, err := t.Upgrader.Upgrade(w, r, http.Header{ "Sec-Websocket-Protocol": []string{"graphql-ws"}, }) if err != nil { log.Printf("unable to upgrade %T to websocket %s: ", w, err.Error()) - sendErrorf(w, http.StatusBadRequest, "unable to upgrade") + SendErrorf(w, http.StatusBadRequest, "unable to upgrade") return } conn := wsConnection{ - active: map[string]context.CancelFunc{}, - exec: exec, - conn: ws, - ctx: r.Context(), - cfg: cfg, - cache: cache, + active: map[string]context.CancelFunc{}, + conn: ws, + ctx: r.Context(), + handler: handler, + WebsocketTransport: t, } if !conn.init() { @@ -94,8 +102,8 @@ func (c *wsConnection) init() bool { } } - if c.cfg.websocketInitFunc != nil { - ctx, err := c.cfg.websocketInitFunc(c.ctx, c.initPayload) + if c.InitFunc != nil { + ctx, err := c.InitFunc(c.ctx, c.initPayload) if err != nil { c.sendConnectionError(err.Error()) c.close(websocket.CloseNormalClosure, "terminated") @@ -131,9 +139,9 @@ func (c *wsConnection) run() { defer cancel() // Create a timer that will fire every interval to keep the connection alive. - if c.cfg.connectionKeepAlivePingInterval != 0 { + if c.KeepAlivePingInterval != 0 { c.mu.Lock() - c.keepAliveTicker = time.NewTicker(c.cfg.connectionKeepAlivePingInterval) + c.keepAliveTicker = time.NewTicker(c.KeepAlivePingInterval) c.mu.Unlock() go c.keepAlive(ctx) @@ -184,70 +192,24 @@ func (c *wsConnection) keepAlive(ctx context.Context) { } func (c *wsConnection) subscribe(message *operationMessage) bool { - var reqParams params - if err := jsonDecode(bytes.NewReader(message.Payload), &reqParams); err != nil { + var params rawParams + if err := jsonDecode(bytes.NewReader(message.Payload), ¶ms); err != nil { c.sendConnectionError("invalid json") return false } - var ( - doc *ast.QueryDocument - cacheHit bool - ) - if c.cache != nil { - val, ok := c.cache.Get(reqParams.Query) - if ok { - doc = val.(*ast.QueryDocument) - cacheHit = true - } - } - if !cacheHit { - var qErr gqlerror.List - doc, qErr = gqlparser.LoadQuery(c.exec.Schema(), reqParams.Query) - if qErr != nil { - c.sendError(message.ID, qErr...) - return true - } - if c.cache != nil { - c.cache.Add(reqParams.Query, doc) - } - } - - op := doc.Operations.ForName(reqParams.OperationName) - if op == nil { - c.sendError(message.ID, gqlerror.Errorf("operation %s not found", reqParams.OperationName)) - return true - } + rc := newRequestContext() + rc.RawQuery = params.Query + rc.OperationName = params.OperationName + rc.Variables = params.Variables + rc.Extensions = params.Extensions - vars, err := validator.VariableValues(c.exec.Schema(), op, reqParams.Variables) - if err != nil { - c.sendError(message.ID, err) - return true - } - reqCtx, err2 := c.cfg.newRequestContext(c.ctx, c.exec, doc, op, reqParams.OperationName, reqParams.Query, vars) - if err2 != nil { - c.sendError(message.ID, gqlerror.Errorf(err2.Error())) - return true - } - ctx := graphql.WithRequestContext(c.ctx, reqCtx) + ctx := graphql.WithRequestContext(c.ctx, rc) if c.initPayload != nil { ctx = withInitPayload(ctx, c.initPayload) } - if op.Operation != ast.Subscription { - var result *graphql.Response - if op.Operation == ast.Query { - result = c.exec.Query(ctx, op) - } else { - result = c.exec.Mutation(ctx, op) - } - - c.sendData(message.ID, result) - c.write(&operationMessage{ID: message.ID, Type: completeMsg}) - return true - } - ctx, cancel := context.WithCancel(ctx) c.mu.Lock() c.active[message.ID] = cancel @@ -255,15 +217,21 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { go func() { defer func() { if r := recover(); r != nil { - userErr := reqCtx.Recover(ctx, r) + userErr := rc.Recover(ctx, r) c.sendError(message.ID, &gqlerror.Error{Message: userErr.Error()}) } }() - next := c.exec.Subscription(ctx, op) - for result := next(); result != nil; result = next() { - c.sendData(message.ID, result) - } - + c.handler(ctx, func(response *graphql.Response) { + b, err := json.Marshal(response) + if err != nil { + panic(err) + } + c.write(&operationMessage{ + Payload: b, + ID: message.ID, + Type: dataMsg, + }) + }) c.write(&operationMessage{ID: message.ID, Type: completeMsg}) c.mu.Lock() @@ -275,16 +243,6 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { return true } -func (c *wsConnection) sendData(id string, response *graphql.Response) { - b, err := json.Marshal(response) - if err != nil { - c.sendError(id, gqlerror.Errorf("unable to encode json response: %s", err.Error())) - return - } - - c.write(&operationMessage{Type: dataMsg, ID: id, Payload: b}) -} - func (c *wsConnection) sendError(id string, errors ...*gqlerror.Error) { errs := make([]error, len(errors)) for i, err := range errors { diff --git a/handler/context.go b/graphql/handler/transport/websocket_init.go similarity index 78% rename from handler/context.go rename to graphql/handler/transport/websocket_init.go index 2992aa3d4fe..a5f84ba2dc6 100644 --- a/handler/context.go +++ b/graphql/handler/transport/websocket_init.go @@ -1,4 +1,4 @@ -package handler +package transport import "context" @@ -14,12 +14,12 @@ type InitPayload map[string]interface{} // GetString safely gets a string value from the payload. It returns an empty string if the // payload is nil or the value isn't set. -func (payload InitPayload) GetString(key string) string { - if payload == nil { +func (p InitPayload) GetString(key string) string { + if p == nil { return "" } - if value, ok := payload[key]; ok { + if value, ok := p[key]; ok { res, _ := value.(string) return res } @@ -29,12 +29,12 @@ func (payload InitPayload) GetString(key string) string { // Authorization is a short hand for getting the Authorization header from the // payload. -func (payload InitPayload) Authorization() string { - if value := payload.GetString("Authorization"); value != "" { +func (p InitPayload) Authorization() string { + if value := p.GetString("Authorization"); value != "" { return value } - if value := payload.GetString("authorization"); value != "" { + if value := p.GetString("authorization"); value != "" { return value } diff --git a/graphql/handler/transport/websocket_test.go b/graphql/handler/transport/websocket_test.go new file mode 100644 index 00000000000..b87ac6ff3bc --- /dev/null +++ b/graphql/handler/transport/websocket_test.go @@ -0,0 +1,347 @@ +package transport_test + +import ( + "context" + "encoding/json" + "errors" + "net/http/httptest" + "strings" + "testing" + "time" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/gorilla/websocket" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" +) + +func TestWebsocket(t *testing.T) { + next := make(chan struct{}) + handler := newServer(next) + handler.AddTransport(transport.WebsocketTransport{}) + + srv := httptest.NewServer(handler) + defer srv.Close() + + t.Run("client must send valid json", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + writeRaw(c, "hello") + + msg := readOp(c) + assert.Equal(t, "connection_error", msg.Type) + assert.Equal(t, `{"message":"invalid json"}`, string(msg.Payload)) + }) + + t.Run("client can terminate before init", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionTerminateMsg})) + + _, _, err := c.ReadMessage() + assert.Equal(t, websocket.CloseNormalClosure, err.(*websocket.CloseError).Code) + }) + + t.Run("client must send init first", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: startMsg})) + + msg := readOp(c) + assert.Equal(t, connectionErrorMsg, msg.Type) + assert.Equal(t, `{"message":"unexpected message start"}`, string(msg.Payload)) + }) + + t.Run("server acks init", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + }) + + t.Run("client can terminate before run", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionTerminateMsg})) + + _, _, err := c.ReadMessage() + assert.Equal(t, websocket.CloseNormalClosure, err.(*websocket.CloseError).Code) + }) + + t.Run("client gets parse errors", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + + require.NoError(t, c.WriteJSON(&operationMessage{ + Type: startMsg, + ID: "test_1", + Payload: json.RawMessage(`{"query": "!"}`), + })) + + msg := readOp(c) + assert.Equal(t, errorMsg, msg.Type) + assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, string(msg.Payload)) + }) + + t.Run("client can receive data", func(t *testing.T) { + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + + require.NoError(t, c.WriteJSON(&operationMessage{ + Type: startMsg, + ID: "test_1", + Payload: json.RawMessage(`{"query": "subscription { user { title } }"}`), + })) + + next <- struct{}{} + msg := readOp(c) + assert.Equal(t, dataMsg, msg.Type) + assert.Equal(t, "test_1", msg.ID) + assert.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) + + next <- struct{}{} + msg = readOp(c) + assert.Equal(t, dataMsg, msg.Type) + assert.Equal(t, "test_1", msg.ID) + assert.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) + + require.NoError(t, c.WriteJSON(&operationMessage{Type: stopMsg, ID: "test_1"})) + + msg = readOp(c) + assert.Equal(t, completeMsg, msg.Type) + assert.Equal(t, "test_1", msg.ID) + }) +} + +func TestWebsocketWithKeepAlive(t *testing.T) { + next := make(chan struct{}) + h := newServer(next) + h.AddTransport(transport.WebsocketTransport{ + KeepAlivePingInterval: 10 * time.Millisecond, + }) + + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + + require.NoError(t, c.WriteJSON(&operationMessage{ + Type: startMsg, + ID: "test_1", + Payload: json.RawMessage(`{"query": "subscription { user { title } }"}`), + })) + + // keepalive + msg := readOp(c) + assert.Equal(t, connectionKeepAliveMsg, msg.Type) + + // server message + next <- struct{}{} + msg = readOp(c) + assert.Equal(t, dataMsg, msg.Type) + + // keepalive + msg = readOp(c) + assert.Equal(t, connectionKeepAliveMsg, msg.Type) +} + +func TestWebsocketInitFunc(t *testing.T) { + next := make(chan struct{}) + + t.Run("accept connection if WebsocketInitFunc is NOT provided", func(t *testing.T) { + h := newServer(next) + h.AddTransport(transport.WebsocketTransport{}) + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + }) + + t.Run("accept connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { + h := newServer(next) + h.AddTransport(transport.WebsocketTransport{ + InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, error) { + return context.WithValue(ctx, "newkey", "newvalue"), nil + }, + }) + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + assert.Equal(t, connectionAckMsg, readOp(c).Type) + assert.Equal(t, connectionKeepAliveMsg, readOp(c).Type) + }) + + t.Run("reject connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { + h := newServer(next) + h.AddTransport(transport.WebsocketTransport{ + InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, error) { + return ctx, errors.New("invalid init payload") + }, + }) + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + msg := readOp(c) + assert.Equal(t, connectionErrorMsg, msg.Type) + assert.Equal(t, `{"message":"invalid init payload"}`, string(msg.Payload)) + }) + + t.Run("can return context for request from WebsocketInitFunc", func(t *testing.T) { + es := &graphql.ExecutableSchemaMock{ + QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + assert.Equal(t, "newvalue", ctx.Value("newkey")) + return &graphql.Response{Data: []byte(`{"empty":"ok"}`)} + }, + SchemaFunc: func() *ast.Schema { + return gqlparser.MustLoadSchema(&ast.Source{Input: ` + schema { query: Query } + type Query { + empty: String + } + `}) + }, + } + h := handler.New(es) + + h.AddTransport(transport.WebsocketTransport{ + InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, error) { + return context.WithValue(ctx, "newkey", "newvalue"), nil + }, + }) + + c := client.New(h) + + socket := c.Websocket("{ empty } ") + defer socket.Close() + var resp struct { + Empty string + } + err := socket.Next(&resp) + require.NoError(t, err) + assert.Equal(t, "ok", resp.Empty) + }) +} + +func newServer(next chan struct{}) *handler.Server { + es := &graphql.ExecutableSchemaMock{ + QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "queries are not supported") + }, + MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "mutations are not supported") + }, + SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { + return func() *graphql.Response { + select { + case <-ctx.Done(): + return nil + case <-next: + return &graphql.Response{ + Data: []byte(`{"name":"test"}`), + } + } + } + }, + SchemaFunc: func() *ast.Schema { + return gqlparser.MustLoadSchema(&ast.Source{Input: ` + schema { query: Query } + type Query { + me: User! + user(id: Int): User! + } + type User { name: String! } + `}) + }, + } + return handler.New(es) +} + +func wsConnect(url string) *websocket.Conn { + c, resp, err := websocket.DefaultDialer.Dial(strings.Replace(url, "http://", "ws://", -1), nil) + if err != nil { + panic(err) + } + _ = resp.Body.Close() + + return c +} + +func writeRaw(conn *websocket.Conn, msg string) { + if err := conn.WriteMessage(websocket.TextMessage, []byte(msg)); err != nil { + panic(err) + } +} + +func readOp(conn *websocket.Conn) operationMessage { + var msg operationMessage + if err := conn.ReadJSON(&msg); err != nil { + panic(err) + } + return msg +} + +// copied out from weboscket.go to keep these private + +const ( + connectionInitMsg = "connection_init" // Client -> Server + connectionTerminateMsg = "connection_terminate" // Client -> Server + startMsg = "start" // Client -> Server + stopMsg = "stop" // Client -> Server + connectionAckMsg = "connection_ack" // Server -> Client + connectionErrorMsg = "connection_error" // Server -> Client + dataMsg = "data" // Server -> Client + errorMsg = "error" // Server -> Client + completeMsg = "complete" // Server -> Client + connectionKeepAliveMsg = "ka" // Server -> Client +) + +type operationMessage struct { + Payload json.RawMessage `json:"payload,omitempty"` + ID string `json:"id,omitempty"` + Type string `json:"type"` +} diff --git a/handler/websocket_test.go b/handler/websocket_test.go deleted file mode 100644 index 44aa65e4f7a..00000000000 --- a/handler/websocket_test.go +++ /dev/null @@ -1,272 +0,0 @@ -package handler - -import ( - "context" - "encoding/json" - "errors" - "net/http/httptest" - "strings" - "testing" - "time" - - "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/graphql" - "github.com/gorilla/websocket" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser/ast" -) - -func TestWebsocket(t *testing.T) { - next := make(chan struct{}) - h := GraphQL(&executableSchemaStub{next}) - - srv := httptest.NewServer(h) - defer srv.Close() - - t.Run("client must send valid json", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - writeRaw(c, "hello") - - msg := readOp(c) - require.Equal(t, connectionErrorMsg, msg.Type) - require.Equal(t, `{"message":"invalid json"}`, string(msg.Payload)) - }) - - t.Run("client can terminate before init", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionTerminateMsg})) - - _, _, err := c.ReadMessage() - require.Equal(t, websocket.CloseNormalClosure, err.(*websocket.CloseError).Code) - }) - - t.Run("client must send init first", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: startMsg})) - - msg := readOp(c) - require.Equal(t, connectionErrorMsg, msg.Type) - require.Equal(t, `{"message":"unexpected message start"}`, string(msg.Payload)) - }) - - t.Run("server acks init", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - }) - - t.Run("client can terminate before run", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionTerminateMsg})) - - _, _, err := c.ReadMessage() - require.Equal(t, websocket.CloseNormalClosure, err.(*websocket.CloseError).Code) - }) - - t.Run("client gets parse errors", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - - require.NoError(t, c.WriteJSON(&operationMessage{ - Type: startMsg, - ID: "test_1", - Payload: json.RawMessage(`{"query": "!"}`), - })) - - msg := readOp(c) - require.Equal(t, errorMsg, msg.Type) - require.Equal(t, `[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}]`, string(msg.Payload)) - }) - - t.Run("client can receive data", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - - require.NoError(t, c.WriteJSON(&operationMessage{ - Type: startMsg, - ID: "test_1", - Payload: json.RawMessage(`{"query": "subscription { user { title } }"}`), - })) - - next <- struct{}{} - msg := readOp(c) - require.Equal(t, dataMsg, msg.Type) - require.Equal(t, "test_1", msg.ID) - require.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) - - next <- struct{}{} - msg = readOp(c) - require.Equal(t, dataMsg, msg.Type) - require.Equal(t, "test_1", msg.ID) - require.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) - - require.NoError(t, c.WriteJSON(&operationMessage{Type: stopMsg, ID: "test_1"})) - - msg = readOp(c) - require.Equal(t, completeMsg, msg.Type) - require.Equal(t, "test_1", msg.ID) - }) -} - -func TestWebsocketWithKeepAlive(t *testing.T) { - next := make(chan struct{}) - h := GraphQL(&executableSchemaStub{next}, WebsocketKeepAliveDuration(10*time.Millisecond)) - - srv := httptest.NewServer(h) - defer srv.Close() - - t.Run("client must receive keepalive", func(t *testing.T) { - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - - require.NoError(t, c.WriteJSON(&operationMessage{ - Type: startMsg, - ID: "test_1", - Payload: json.RawMessage(`{"query": "subscription { user { title } }"}`), - })) - - // keepalive - msg := readOp(c) - require.Equal(t, connectionKeepAliveMsg, msg.Type) - - // server message - next <- struct{}{} - msg = readOp(c) - require.Equal(t, dataMsg, msg.Type) - - // keepalive - msg = readOp(c) - require.Equal(t, connectionKeepAliveMsg, msg.Type) - }) -} - -func TestWebsocketInitFunc(t *testing.T) { - next := make(chan struct{}) - - t.Run("accept connection if WebsocketInitFunc is NOT provided", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}) - srv := httptest.NewServer(h) - defer srv.Close() - - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - }) - - t.Run("can return context for request from WebsocketInitFunc", func(t *testing.T) { - es := &executableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - assert.Equal(t, "newvalue", ctx.Value("newkey")) - return &graphql.Response{Data: []byte(`{"empty":"ok"}`)} - }, - } - - h := GraphQL(es, - WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) (context.Context, error) { - return context.WithValue(ctx, "newkey", "newvalue"), nil - })) - - c := client.New(h) - - socket := c.Websocket("{ empty } ") - defer socket.Close() - var resp struct { - Empty string - } - err := socket.Next(&resp) - require.NoError(t, err) - require.Equal(t, "ok", resp.Empty) - }) - - t.Run("accept connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}, - WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) (context.Context, error) { - return context.WithValue(ctx, "newkey", "newvalue"), nil - }), - ) - srv := httptest.NewServer(h) - defer srv.Close() - - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - - require.Equal(t, connectionAckMsg, readOp(c).Type) - require.Equal(t, connectionKeepAliveMsg, readOp(c).Type) - }) - - t.Run("reject connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) (context.Context, error) { - return ctx, errors.New("invalid init payload") - })) - srv := httptest.NewServer(h) - defer srv.Close() - - c := wsConnect(srv.URL) - defer c.Close() - - require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) - - msg := readOp(c) - require.Equal(t, connectionErrorMsg, msg.Type) - require.Equal(t, `{"message":"invalid init payload"}`, string(msg.Payload)) - }) -} - -func wsConnect(url string) *websocket.Conn { - c, resp, err := websocket.DefaultDialer.Dial(strings.Replace(url, "http://", "ws://", -1), nil) - if err != nil { - panic(err) - } - _ = resp.Body.Close() - - return c -} - -func writeRaw(conn *websocket.Conn, msg string) { - if err := conn.WriteMessage(websocket.TextMessage, []byte(msg)); err != nil { - panic(err) - } -} - -func readOp(conn *websocket.Conn) operationMessage { - var msg operationMessage - if err := conn.ReadJSON(&msg); err != nil { - panic(err) - } - return msg -} From 2e0c9cab65d4c6a0cd8237a1b15f55a075afb44f Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 14:43:54 +1100 Subject: [PATCH 09/53] mark validation and parse errors separately to execution errors --- graphql/handler.go | 14 +++++++++++--- graphql/handler/middleware/utils_test.go | 2 +- graphql/handler/server.go | 22 +++++++++++++++------- graphql/handler/transport/http_get.go | 8 +++++++- graphql/handler/transport/jsonpost.go | 9 ++++++++- graphql/handler/transport/jsonpost_test.go | 6 +++--- graphql/handler/transport/websocket.go | 15 +++++++++++---- 7 files changed, 56 insertions(+), 20 deletions(-) diff --git a/graphql/handler.go b/graphql/handler.go index 6a9cd705ef0..dbe6a3e1220 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -12,7 +12,8 @@ type ( Handler func(ctx context.Context, writer Writer) Middleware func(next Handler) Handler ResponseStream func() *Response - Writer func(*Response) + Writer func(Status, *Response) + Status int Transport interface { Supports(r *http.Request) bool @@ -20,14 +21,21 @@ type ( } ) +const ( + StatusOk Status = iota + StatusParseError + StatusValidationError + StatusResolverError +) + func (w Writer) Errorf(format string, args ...interface{}) { - w(&Response{ + w(StatusResolverError, &Response{ Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}, }) } func (w Writer) Error(msg string) { - w(&Response{ + w(StatusResolverError, &Response{ Errors: gqlerror.List{{Message: msg}}, }) } diff --git a/graphql/handler/middleware/utils_test.go b/graphql/handler/middleware/utils_test.go index e2ac94f99ed..af194c479e5 100644 --- a/graphql/handler/middleware/utils_test.go +++ b/graphql/handler/middleware/utils_test.go @@ -22,7 +22,7 @@ func testMiddleware(m graphql.Middleware, initialContexts ...graphql.RequestCont m(func(ctx context.Context, writer graphql.Writer) { c.ResultContext = *graphql.GetRequestContext(ctx) c.InvokedNext = true - })(graphql.WithRequestContext(context.Background(), initial), func(response *graphql.Response) { + })(graphql.WithRequestContext(context.Background(), initial), func(status graphql.Status, response *graphql.Response) { c.Response = *response }) diff --git a/graphql/handler/server.go b/graphql/handler/server.go index b45352db857..853a2cdb5c3 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -73,14 +73,14 @@ func (s *Server) executableSchemaHandler(ctx context.Context, write graphql.Writ if rc.Doc == nil { rc.Doc, gerr = s.parseOperation(ctx, rc) if gerr != nil { - write(&graphql.Response{Errors: []*gqlerror.Error{gerr}}) + write(graphql.StatusParseError, &graphql.Response{Errors: []*gqlerror.Error{gerr}}) return } } ctx, op, listErr := s.validateOperation(ctx, rc) if len(listErr) != 0 { - write(&graphql.Response{ + write(graphql.StatusValidationError, &graphql.Response{ Errors: listErr, }) return @@ -88,7 +88,7 @@ func (s *Server) executableSchemaHandler(ctx context.Context, write graphql.Writ vars, err := validator.VariableValues(s.es.Schema(), op, rc.Variables) if err != nil { - write(&graphql.Response{ + write(graphql.StatusValidationError, &graphql.Response{ Errors: gqlerror.List{err}, }) return @@ -99,19 +99,27 @@ func (s *Server) executableSchemaHandler(ctx context.Context, write graphql.Writ switch op.Operation { case ast.Query: resp := s.es.Query(ctx, op) - write(resp) + + write(getStatus(resp), resp) case ast.Mutation: resp := s.es.Mutation(ctx, op) - write(resp) + write(getStatus(resp), resp) case ast.Subscription: resp := s.es.Subscription(ctx, op) for w := resp(); w != nil; w = resp() { - write(w) + write(getStatus(w), w) } default: - write(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + write(graphql.StatusValidationError, graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +func getStatus(resp *graphql.Response) graphql.Status { + if len(resp.Errors) > 0 { + return graphql.StatusResolverError } + return graphql.StatusOk } func (s *Server) parseOperation(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, *gqlerror.Error) { diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index b9cc22205cf..26e8a5cd92f 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -26,7 +26,13 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, handler graphql.Hand rc.RawQuery = r.URL.Query().Get("query") rc.OperationName = r.URL.Query().Get("operationName") - writer := graphql.Writer(func(response *graphql.Response) { + writer := graphql.Writer(func(status graphql.Status, response *graphql.Response) { + switch status { + case graphql.StatusOk, graphql.StatusResolverError: + w.WriteHeader(http.StatusOK) + case graphql.StatusParseError, graphql.StatusValidationError: + w.WriteHeader(http.StatusUnprocessableEntity) + } b, err := json.Marshal(response) if err != nil { panic(err) diff --git a/graphql/handler/transport/jsonpost.go b/graphql/handler/transport/jsonpost.go index 8094f744849..d2764050e9c 100644 --- a/graphql/handler/transport/jsonpost.go +++ b/graphql/handler/transport/jsonpost.go @@ -28,7 +28,14 @@ func (H JsonPostTransport) Supports(r *http.Request) bool { func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { w.Header().Set("Content-Type", "application/json") - write := graphql.Writer(func(response *graphql.Response) { + write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { + switch status { + case graphql.StatusOk, graphql.StatusResolverError: + w.WriteHeader(http.StatusOK) + case graphql.StatusParseError, graphql.StatusValidationError: + w.WriteHeader(http.StatusUnprocessableEntity) + } + b, err := json.Marshal(response) if err != nil { panic(err) diff --git a/graphql/handler/transport/jsonpost_test.go b/graphql/handler/transport/jsonpost_test.go index 3c6d83d7678..64d682a19f4 100644 --- a/graphql/handler/transport/jsonpost_test.go +++ b/graphql/handler/transport/jsonpost_test.go @@ -78,21 +78,21 @@ func TestJsonPost(t *testing.T) { t.Run("parse failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "!"}`) - assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, resp.Body.String()) }) t.Run("validation failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "{ me { title }}"}`) - assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"Cannot query field \"title\" on type \"User\".","locations":[{"line":1,"column":8}]}],"data":null}`, resp.Body.String()) }) t.Run("invalid variable", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "query($id:Int!){user(id:$id){name}}","variables":{"id":false}}`) - assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) }) diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 1d89a8705e2..153fe38f92b 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -10,10 +10,9 @@ import ( "sync" "time" - "github.com/vektah/gqlparser/gqlerror" - "github.com/99designs/gqlgen/graphql" "github.com/gorilla/websocket" + "github.com/vektah/gqlparser/gqlerror" ) const ( @@ -221,7 +220,15 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.sendError(message.ID, &gqlerror.Error{Message: userErr.Error()}) } }() - c.handler(ctx, func(response *graphql.Response) { + c.handler(ctx, func(status graphql.Status, response *graphql.Response) { + msgType := dataMsg + switch status { + case graphql.StatusOk, graphql.StatusResolverError: + msgType = dataMsg + case graphql.StatusParseError, graphql.StatusValidationError: + msgType = errorMsg + } + b, err := json.Marshal(response) if err != nil { panic(err) @@ -229,7 +236,7 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.write(&operationMessage{ Payload: b, ID: message.ID, - Type: dataMsg, + Type: msgType, }) }) c.write(&operationMessage{ID: message.ID, Type: completeMsg}) From a7c5e6600729012283270ad2c653de57772eba6b Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 15:50:51 +1100 Subject: [PATCH 10/53] build middleware graph once at startup --- graphql/handler/server.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 853a2cdb5c3..cd617e73624 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -18,6 +18,8 @@ type ( es graphql.ExecutableSchema transports []graphql.Transport middlewares []graphql.Middleware + + handler graphql.Handler } Option func(Server) @@ -29,12 +31,26 @@ func (s *Server) AddTransport(transport graphql.Transport) { func (s *Server) Use(middleware graphql.Middleware) { s.middlewares = append(s.middlewares, middleware) + s.buildHandler() +} + +// This is fairly expensive, so we dont want to do it in every request. May be called multiple times while creating +// the server. +func (s *Server) buildHandler() { + handler := s.executableSchemaHandler + for i := len(s.middlewares) - 1; i >= 0; i-- { + handler = s.middlewares[i](handler) + } + + s.handler = handler } func New(es graphql.ExecutableSchema) *Server { - return &Server{ + s := &Server{ es: es, } + s.handler = s.executableSchemaHandler + return s } func (s *Server) getTransport(r *http.Request) graphql.Transport { @@ -53,13 +69,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - // todo: Should be done statically at server init rather than per request. - handler := s.executableSchemaHandler - for i := len(s.middlewares) - 1; i >= 0; i-- { - handler = s.middlewares[i](handler) - } - - transport.Do(w, r, handler) + transport.Do(w, r, s.handler) } // executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware From f00e5fa0791be8e8909923711f7ebde8d2e74c15 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 29 Oct 2019 13:55:36 +1100 Subject: [PATCH 11/53] use plugins instead of middleware so multiple hooks can be configured --- graphql/context.go | 27 +--- graphql/error.go | 7 + graphql/handler.go | 36 ++++- graphql/handler/executor.go | 152 ++++++++++++++++++ graphql/handler/middleware/apq.go | 69 ++++---- graphql/handler/middleware/apq_test.go | 90 ++++++----- graphql/handler/middleware/complexity.go | 27 +--- graphql/handler/middleware/complexity_test.go | 19 +-- graphql/handler/middleware/errors.go | 30 ---- graphql/handler/middleware/errors_test.go | 32 ---- graphql/handler/middleware/introspection.go | 17 +- .../handler/middleware/introspection_test.go | 12 +- graphql/handler/middleware/tracer.go | 39 ++--- graphql/handler/middleware/tracer_test.go | 17 -- graphql/handler/middleware/utils_test.go | 30 ---- graphql/handler/server.go | 129 +++------------ graphql/handler/server_test.go | 26 +-- graphql/handler/transport/http_get.go | 31 ++-- graphql/handler/transport/jsonpost.go | 18 +-- graphql/handler/transport/raw.go | 8 - graphql/handler/transport/requestcontext.go | 15 -- graphql/handler/transport/websocket.go | 20 +-- graphql/recovery.go | 9 ++ handler/graphql.go | 1 - 24 files changed, 403 insertions(+), 458 deletions(-) create mode 100644 graphql/handler/executor.go delete mode 100644 graphql/handler/middleware/errors.go delete mode 100644 graphql/handler/middleware/errors_test.go delete mode 100644 graphql/handler/middleware/tracer_test.go delete mode 100644 graphql/handler/middleware/utils_test.go delete mode 100644 graphql/handler/transport/raw.go delete mode 100644 graphql/handler/transport/requestcontext.go diff --git a/graphql/context.go b/graphql/context.go index cee727e5eaf..91778a5dd87 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -12,7 +12,6 @@ import ( type Resolver func(ctx context.Context) (res interface{}, err error) type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) -type RequestMiddleware func(ctx context.Context, next func(ctx context.Context) []byte) []byte type ComplexityLimitFunc func(ctx context.Context) int type RequestContext struct { @@ -56,9 +55,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { if rc.DirectiveMiddleware == nil { rc.DirectiveMiddleware = DefaultDirectiveMiddleware } - if rc.RequestMiddleware == nil { - rc.RequestMiddleware = DefaultRequestMiddleware - } if rc.Recover == nil { rc.Recover = DefaultRecover } @@ -75,22 +71,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { return nil } -// AddRequestMiddleware allows you to define a function that will be called around the root request, -// after the query has been parsed. This is useful for logging -func (cfg *RequestContext) AddRequestMiddleware(middleware RequestMiddleware) { - if cfg.RequestMiddleware == nil { - cfg.RequestMiddleware = middleware - return - } - - lastResolve := cfg.RequestMiddleware - cfg.RequestMiddleware = func(ctx context.Context, next func(ctx context.Context) []byte) []byte { - return lastResolve(ctx, func(ctx context.Context) []byte { - return middleware(ctx, next) - }) - } -} - func (cfg *RequestContext) AddTracer(tracer Tracer) { if cfg.Tracer == nil { cfg.Tracer = tracer @@ -338,3 +318,10 @@ func ChainFieldMiddleware(handleFunc ...FieldMiddleware) FieldMiddleware { return next(ctx) } } + +var _ RequestContextMutator = ComplexityLimitFunc(nil) + +func (c ComplexityLimitFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { + rc.ComplexityLimit = c(ctx) + return nil +} diff --git a/graphql/error.go b/graphql/error.go index af8b4ce4088..7d00ade2a5b 100644 --- a/graphql/error.go +++ b/graphql/error.go @@ -31,3 +31,10 @@ func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { Extensions: extensions, } } + +var _ RequestContextMutator = ErrorPresenterFunc(nil) + +func (f ErrorPresenterFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { + rc.ErrorPresenter = f + return nil +} diff --git a/graphql/handler.go b/graphql/handler.go index dbe6a3e1220..1f1c052a16e 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -10,14 +10,40 @@ import ( type ( Handler func(ctx context.Context, writer Writer) - Middleware func(next Handler) Handler ResponseStream func() *Response Writer func(Status, *Response) Status int + RawParams struct { + Query string `json:"query"` + OperationName string `json:"operationName"` + Variables map[string]interface{} `json:"variables"` + Extensions map[string]interface{} `json:"extensions"` + } + + GraphExecutor interface { + CreateRequestContext(ctx context.Context, params *RawParams) (*RequestContext, gqlerror.List) + DispatchRequest(ctx context.Context, writer Writer) + } + + // HandlerPlugin interface is entirely optional, see the list of possible hook points below + HandlerPlugin interface{} + + RequestMutator interface { + MutateRequest(ctx context.Context, request *RawParams) *gqlerror.Error + } + + RequestContextMutator interface { + MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error + } + + RequestMiddleware interface { + InterceptRequest(next Handler) Handler + } + Transport interface { Supports(r *http.Request) bool - Do(w http.ResponseWriter, r *http.Request, handler Handler) + Do(w http.ResponseWriter, r *http.Request, exec GraphExecutor) } ) @@ -39,3 +65,9 @@ func (w Writer) Error(msg string) { Errors: gqlerror.List{{Message: msg}}, }) } + +func (w Writer) GraphqlErr(err ...*gqlerror.Error) { + w(StatusResolverError, &Response{ + Errors: err, + }) +} diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go new file mode 100644 index 00000000000..273bffe2d56 --- /dev/null +++ b/graphql/handler/executor.go @@ -0,0 +1,152 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/ast" + "github.com/vektah/gqlparser/gqlerror" + "github.com/vektah/gqlparser/parser" + "github.com/vektah/gqlparser/validator" +) + +type executor struct { + handler graphql.Handler + es graphql.ExecutableSchema + requestMutators []graphql.RequestMutator + requestContextMutators []graphql.RequestContextMutator +} + +var _ graphql.GraphExecutor = executor{} + +func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) executor { + e := executor{ + es: es, + } + handler := e.executableSchemaHandler + // this loop goes backwards so the first plugin is the outer most middleware and runs first. + for i := len(plugins) - 1; i >= 0; i-- { + p := plugins[i] + if p, ok := p.(graphql.RequestMiddleware); ok { + handler = p.InterceptRequest(handler) + } + } + + for _, p := range plugins { + + if p, ok := p.(graphql.RequestMutator); ok { + e.requestMutators = append(e.requestMutators, p) + } + + if p, ok := p.(graphql.RequestContextMutator); ok { + e.requestContextMutators = append(e.requestContextMutators, p) + } + } + + e.handler = handler + + return e +} + +func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { + e.handler(ctx, writer) +} + +func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { + for _, p := range e.requestMutators { + if err := p.MutateRequest(ctx, params); err != nil { + return nil, gqlerror.List{err} + } + } + + var gerr *gqlerror.Error + + rc := &graphql.RequestContext{ + DisableIntrospection: true, + Recover: graphql.DefaultRecover, + ErrorPresenter: graphql.DefaultErrorPresenter, + ResolverMiddleware: nil, + RequestMiddleware: nil, + Tracer: graphql.NopTracer{}, + ComplexityLimit: 0, + RawQuery: params.Query, + OperationName: params.OperationName, + Variables: params.Variables, + Extensions: params.Extensions, + } + + rc.Doc, gerr = e.parseOperation(ctx, rc) + if gerr != nil { + return nil, []*gqlerror.Error{gerr} + } + + ctx, op, listErr := e.validateOperation(ctx, rc) + if len(listErr) != 0 { + return nil, listErr + } + + vars, err := validator.VariableValues(e.es.Schema(), op, rc.Variables) + if err != nil { + return nil, gqlerror.List{err} + } + + rc.Variables = vars + + for _, p := range e.requestContextMutators { + if err := p.MutateRequestContext(ctx, rc); err != nil { + return nil, gqlerror.List{err} + } + } + + return rc, nil +} + +// executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware +// and sends responses to the transport so it can be returned to the client +func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Writer) { + rc := graphql.GetRequestContext(ctx) + + op := rc.Doc.Operations.ForName(rc.OperationName) + + switch op.Operation { + case ast.Query: + resp := e.es.Query(ctx, op) + + write(getStatus(resp), resp) + case ast.Mutation: + resp := e.es.Mutation(ctx, op) + write(getStatus(resp), resp) + case ast.Subscription: + resp := e.es.Subscription(ctx, op) + + for w := resp(); w != nil; w = resp() { + write(getStatus(w), w) + } + default: + write(graphql.StatusValidationError, graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +func (e executor) parseOperation(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, *gqlerror.Error) { + ctx = rc.Tracer.StartOperationValidation(ctx) + defer func() { rc.Tracer.EndOperationValidation(ctx) }() + + return parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) +} + +func (e executor) validateOperation(ctx context.Context, rc *graphql.RequestContext) (context.Context, *ast.OperationDefinition, gqlerror.List) { + ctx = rc.Tracer.StartOperationValidation(ctx) + defer func() { rc.Tracer.EndOperationValidation(ctx) }() + + listErr := validator.Validate(e.es.Schema(), rc.Doc) + if len(listErr) != 0 { + return ctx, nil, listErr + } + + op := rc.Doc.Operations.ForName(rc.OperationName) + if op == nil { + return ctx, nil, gqlerror.List{gqlerror.Errorf("operation %s not found", rc.OperationName)} + } + + return ctx, op, nil +} diff --git a/graphql/handler/middleware/apq.go b/graphql/handler/middleware/apq.go index 62315c9b49c..3658b2915e9 100644 --- a/graphql/handler/middleware/apq.go +++ b/graphql/handler/middleware/apq.go @@ -4,6 +4,7 @@ import ( "context" "crypto/sha256" "encoding/hex" + "errors" "github.com/99designs/gqlgen/graphql" "github.com/mitchellh/mapstructure" @@ -18,50 +19,44 @@ const ( // does not yet know what the query is for the hash it will respond telling the client to send the query along with the // hash in the next request. // see https://github.com/apollographql/apollo-link-persisted-queries -func AutomaticPersistedQuery(cache graphql.Cache) graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - rc := graphql.GetRequestContext(ctx) +type AutomaticPersistedQuery struct { + Cache graphql.Cache +} - if rc.Extensions["persistedQuery"] == nil { - next(ctx, writer) - return - } +func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *graphql.RawParams) error { + if rawParams.Extensions["persistedQuery"] == nil { + return nil + } - var extension struct { - Sha256 string `json:"sha256Hash"` - Version int64 `json:"version"` - } + var extension struct { + Sha256 string `json:"sha256Hash"` + Version int64 `json:"version"` + } - if err := mapstructure.Decode(rc.Extensions["persistedQuery"], &extension); err != nil { - writer.Error("Invalid APQ extension data") - return - } + if err := mapstructure.Decode(rawParams.Extensions["persistedQuery"], &extension); err != nil { + return errors.New("Invalid APQ extension data") + } - if extension.Version != 1 { - writer.Error("Unsupported APQ version") - return - } + if extension.Version != 1 { + return errors.New("Unsupported APQ version") + } - if rc.RawQuery == "" { - // client sent optimistic query hash without query string, get it from the cache - query, ok := cache.Get(extension.Sha256) - if !ok { - writer.Error(errPersistedQueryNotFound) - return - } - rc.RawQuery = query.(string) - } else { - // client sent optimistic query hash with query string, verify and store it - if computeQueryHash(rc.RawQuery) != extension.Sha256 { - writer.Error("Provided APQ hash does not match query") - return - } - cache.Add(extension.Sha256, rc.RawQuery) - } - next(ctx, writer) + if rawParams.Query == "" { + // client sent optimistic query hash without query string, get it from the cache + query, ok := a.Cache.Get(extension.Sha256) + if !ok { + return errors.New(errPersistedQueryNotFound) + } + rawParams.Query = query.(string) + } else { + // client sent optimistic query hash with query string, verify and store it + if computeQueryHash(rawParams.Query) != extension.Sha256 { + return errors.New("Provided APQ hash does not match query") } + a.Cache.Add(extension.Sha256, rawParams.Query) } + + return nil } func computeQueryHash(query string) string { diff --git a/graphql/handler/middleware/apq_test.go b/graphql/handler/middleware/apq_test.go index d1a872cf04b..e3c7fc09d32 100644 --- a/graphql/handler/middleware/apq_test.go +++ b/graphql/handler/middleware/apq_test.go @@ -1,6 +1,7 @@ package middleware import ( + "context" "testing" "github.com/99designs/gqlgen/graphql" @@ -12,117 +13,118 @@ func TestAPQ(t *testing.T) { const hash = "b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88" t.Run("with query and no hash", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ - RawQuery: "original query", - }) + params := &graphql.RawParams{ + Query: "original query", + } + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) + require.NoError(t, err) - require.True(t, rc.InvokedNext) - require.Equal(t, "original query", rc.ResultContext.RawQuery) + require.Equal(t, "original query", params.Query) }) t.Run("with hash miss and no query", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ - RawQuery: "", + params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "sha256": hash, "version": 1, }, }, - }) + } - require.False(t, rc.InvokedNext) - require.Equal(t, "PersistedQueryNotFound", rc.Response.Errors[0].Message) + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) + require.EqualError(t, err, "PersistedQueryNotFound") }) t.Run("with hash miss and query", func(t *testing.T) { - cache := graphql.MapCache{} - rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ - RawQuery: query, + params := &graphql.RawParams{ + Query: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "sha256": hash, "version": 1, }, }, - }) + } + cache := graphql.MapCache{} + err := AutomaticPersistedQuery{cache}.MutateRequest(context.Background(), params) + require.NoError(t, err) - require.True(t, rc.InvokedNext, rc.Response.Errors) - require.Equal(t, "{ me { name } }", rc.ResultContext.RawQuery) + require.Equal(t, "{ me { name } }", params.Query) require.Equal(t, "{ me { name } }", cache[hash]) }) t.Run("with hash miss and query", func(t *testing.T) { - cache := graphql.MapCache{} - rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ - RawQuery: query, + params := &graphql.RawParams{ + Query: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "sha256": hash, "version": 1, }, }, - }) + } + cache := graphql.MapCache{} + err := AutomaticPersistedQuery{cache}.MutateRequest(context.Background(), params) + require.NoError(t, err) - require.True(t, rc.InvokedNext, rc.Response.Errors) - require.Equal(t, "{ me { name } }", rc.ResultContext.RawQuery) + require.Equal(t, "{ me { name } }", params.Query) require.Equal(t, "{ me { name } }", cache[hash]) }) t.Run("with hash hit and no query", func(t *testing.T) { - cache := graphql.MapCache{ - hash: query, - } - rc := testMiddleware(AutomaticPersistedQuery(cache), graphql.RequestContext{ - RawQuery: "", + params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "sha256": hash, "version": 1, }, }, - }) + } + cache := graphql.MapCache{ + hash: query, + } + err := AutomaticPersistedQuery{cache}.MutateRequest(context.Background(), params) + require.NoError(t, err) - require.True(t, rc.InvokedNext, rc.Response.Errors) - require.Equal(t, "{ me { name } }", rc.ResultContext.RawQuery) + require.Equal(t, "{ me { name } }", params.Query) }) t.Run("with malformed extension payload", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ + params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": "asdf", }, - }) + } - require.False(t, rc.InvokedNext) - require.Equal(t, "Invalid APQ extension data", rc.Response.Errors[0].Message) + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) + require.EqualError(t, err, "Invalid APQ extension data") }) t.Run("with invalid extension version", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ + params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "version": 2, }, }, - }) - - require.False(t, rc.InvokedNext) - require.Equal(t, "Unsupported APQ version", rc.Response.Errors[0].Message) + } + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) + require.EqualError(t, err, "Unsupported APQ version") }) t.Run("with hash mismatch", func(t *testing.T) { - rc := testMiddleware(AutomaticPersistedQuery(graphql.MapCache{}), graphql.RequestContext{ - RawQuery: query, + params := &graphql.RawParams{ + Query: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ "sha256": "badhash", "version": 1, }, }, - }) + } - require.False(t, rc.InvokedNext) - require.Equal(t, "Provided APQ hash does not match query", rc.Response.Errors[0].Message) + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) + require.EqualError(t, err, "Provided APQ hash does not match query") }) } diff --git a/graphql/handler/middleware/complexity.go b/graphql/handler/middleware/complexity.go index fc65e3bebcd..846227d9437 100644 --- a/graphql/handler/middleware/complexity.go +++ b/graphql/handler/middleware/complexity.go @@ -4,30 +4,17 @@ import ( "context" "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/gqlerror" ) // ComplexityLimit sets a maximum query complexity that is allowed to be executed. // // If a query is submitted that exceeds the limit, a 422 status code will be returned. -func ComplexityLimit(limit int) graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - graphql.GetRequestContext(ctx).ComplexityLimit = limit - next(ctx, writer) - } - } -} +type ComplexityLimit int -// ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed -// to be executed. This is mostly just a wrapper to preserve the old interface, consider writing your own middleware -// instead. -// -// If a query is submitted that exceeds the limit, a 422 status code will be returned. -func ComplexityLimitFunc(f graphql.ComplexityLimitFunc) graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - graphql.GetRequestContext(ctx).ComplexityLimit = f(ctx) - next(ctx, writer) - } - } +var _ graphql.RequestContextMutator = ComplexityLimit(0) + +func (c ComplexityLimit) MutateRequestContext(ctx context.Context, rc *graphql.RequestContext) *gqlerror.Error { + rc.ComplexityLimit = int(c) + return nil } diff --git a/graphql/handler/middleware/complexity_test.go b/graphql/handler/middleware/complexity_test.go index 0e141826a3a..016cfae0d0a 100644 --- a/graphql/handler/middleware/complexity_test.go +++ b/graphql/handler/middleware/complexity_test.go @@ -4,23 +4,12 @@ import ( "context" "testing" + "github.com/99designs/gqlgen/graphql" "github.com/stretchr/testify/require" ) func TestComplexityLimit(t *testing.T) { - rc := testMiddleware(ComplexityLimitFunc(func(ctx context.Context) int { - return 10 - })) - - require.True(t, rc.InvokedNext) - require.Equal(t, 10, rc.ResultContext.ComplexityLimit) -} - -func TestComplexityLimitFunc(t *testing.T) { - rc := testMiddleware(ComplexityLimitFunc(func(ctx context.Context) int { - return 22 - })) - - require.True(t, rc.InvokedNext) - require.Equal(t, 22, rc.ResultContext.ComplexityLimit) + rc := &graphql.RequestContext{} + ComplexityLimit(10).MutateRequestContext(context.Background(), rc) + require.Equal(t, 10, rc.ComplexityLimit) } diff --git a/graphql/handler/middleware/errors.go b/graphql/handler/middleware/errors.go deleted file mode 100644 index 584f6524b57..00000000000 --- a/graphql/handler/middleware/errors.go +++ /dev/null @@ -1,30 +0,0 @@ -package middleware - -import ( - "context" - - "github.com/99designs/gqlgen/graphql" -) - -// ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides -// a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default -// implementation in graphql.DefaultErrorPresenter for an example. -func ErrorPresenter(ep graphql.ErrorPresenterFunc) graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - graphql.GetRequestContext(ctx).ErrorPresenter = ep - next(ctx, writer) - } - } -} - -// RecoverFunc is called to recover from panics inside goroutines. It can be used to send errors to error trackers -// and hide internal error types from clients. -func RecoverFunc(recover graphql.RecoverFunc) graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - graphql.GetRequestContext(ctx).Recover = recover - next(ctx, writer) - } - } -} diff --git a/graphql/handler/middleware/errors_test.go b/graphql/handler/middleware/errors_test.go deleted file mode 100644 index 9471b6ae3bc..00000000000 --- a/graphql/handler/middleware/errors_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package middleware - -import ( - "context" - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/stretchr/testify/assert" - "github.com/vektah/gqlparser/gqlerror" -) - -func TestErrorPresenter(t *testing.T) { - rc := testMiddleware(ErrorPresenter(func(i context.Context, e error) *gqlerror.Error { - return &gqlerror.Error{Message: "boom"} - })) - - require.True(t, rc.InvokedNext) - // cant test for function equality in go, so testing the return type instead - require.Equal(t, "boom", rc.ResultContext.ErrorPresenter(nil, nil).Message) -} - -func TestRecoverFunc(t *testing.T) { - rc := testMiddleware(RecoverFunc(func(ctx context.Context, err interface{}) (userMessage error) { - return fmt.Errorf("boom") - })) - - require.True(t, rc.InvokedNext) - // cant test for function equality in go, so testing the return type instead - assert.Equal(t, "boom", rc.ResultContext.Recover(nil, nil).Error()) -} diff --git a/graphql/handler/middleware/introspection.go b/graphql/handler/middleware/introspection.go index 681df097012..d53b7745662 100644 --- a/graphql/handler/middleware/introspection.go +++ b/graphql/handler/middleware/introspection.go @@ -4,14 +4,15 @@ import ( "context" "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/gqlerror" ) -// Introspection enables clients to reflect all of the types available on the graph. -func Introspection() graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - graphql.GetRequestContext(ctx).DisableIntrospection = false - next(ctx, writer) - } - } +// EnableIntrospection enables clients to reflect all of the types available on the graph. +type Introspection struct{} + +var _ graphql.RequestContextMutator = Introspection{} + +func (c Introspection) MutateRequestContext(ctx context.Context, rc *graphql.RequestContext) *gqlerror.Error { + rc.DisableIntrospection = false + return nil } diff --git a/graphql/handler/middleware/introspection_test.go b/graphql/handler/middleware/introspection_test.go index 475c908a2d7..0bda353f843 100644 --- a/graphql/handler/middleware/introspection_test.go +++ b/graphql/handler/middleware/introspection_test.go @@ -1,19 +1,17 @@ package middleware import ( + "context" "testing" "github.com/99designs/gqlgen/graphql" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIntrospection(t *testing.T) { - rc := testMiddleware(Introspection(), graphql.RequestContext{ + rc := &graphql.RequestContext{ DisableIntrospection: true, - }) - - require.True(t, rc.InvokedNext) - // cant test for function equality in go, so testing the return type instead - assert.False(t, rc.ResultContext.DisableIntrospection) + } + Introspection{}.MutateRequestContext(context.Background(), rc) + require.Equal(t, false, rc.DisableIntrospection) } diff --git a/graphql/handler/middleware/tracer.go b/graphql/handler/middleware/tracer.go index 983f03ea02e..4c14b99d9aa 100644 --- a/graphql/handler/middleware/tracer.go +++ b/graphql/handler/middleware/tracer.go @@ -1,26 +1,21 @@ package middleware -import ( - "context" - - "github.com/99designs/gqlgen/graphql" -) - +// todo fixme // Tracer allows you to add a request/resolver tracer that will be called around the root request, // calling resolver. This is useful for tracing -func Tracer(tracer graphql.Tracer) graphql.Middleware { - return func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - rc := graphql.GetRequestContext(ctx) - rc.AddTracer(tracer) - rc.AddRequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { - ctx = tracer.StartOperationExecution(ctx) - resp := next(ctx) - tracer.EndOperationExecution(ctx) - - return resp - }) - next(ctx, writer) - } - } -} +//func Tracer(tracer graphql.Tracer) graphql.Middleware { +// return func(next graphql.Handler) graphql.Handler { +// return func(ctx context.Context, writer graphql.Writer) { +// rc := graphql.GetRequestContext(ctx) +// rc.AddTracer(tracer) +// rc.AddRequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { +// ctx = tracer.StartOperationExecution(ctx) +// resp := next(ctx) +// tracer.EndOperationExecution(ctx) +// +// return resp +// }) +// next(ctx, writer) +// } +// } +//} diff --git a/graphql/handler/middleware/tracer_test.go b/graphql/handler/middleware/tracer_test.go deleted file mode 100644 index bdaf821511d..00000000000 --- a/graphql/handler/middleware/tracer_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package middleware - -import ( - "testing" - - "github.com/99designs/gqlgen/graphql" - "github.com/stretchr/testify/require" -) - -func TestTracer(t *testing.T) { - tracer := &graphql.NopTracer{} - rc := testMiddleware(Tracer(tracer)) - - require.True(t, rc.InvokedNext) - require.Equal(t, tracer, rc.ResultContext.Tracer) - require.NotNil(t, tracer, rc.ResultContext.RequestMiddleware) -} diff --git a/graphql/handler/middleware/utils_test.go b/graphql/handler/middleware/utils_test.go deleted file mode 100644 index af194c479e5..00000000000 --- a/graphql/handler/middleware/utils_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package middleware - -import ( - "context" - - "github.com/99designs/gqlgen/graphql" -) - -type middlewareContext struct { - InvokedNext bool - ResultContext graphql.RequestContext - Response graphql.Response -} - -func testMiddleware(m graphql.Middleware, initialContexts ...graphql.RequestContext) middlewareContext { - var c middlewareContext - initial := &graphql.RequestContext{} - if len(initialContexts) > 0 { - initial = &initialContexts[0] - } - - m(func(ctx context.Context, writer graphql.Writer) { - c.ResultContext = *graphql.GetRequestContext(ctx) - c.InvokedNext = true - })(graphql.WithRequestContext(context.Background(), initial), func(status graphql.Status, response *graphql.Response) { - c.Response = *response - }) - - return c -} diff --git a/graphql/handler/server.go b/graphql/handler/server.go index cd617e73624..dfe98bb57c0 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -1,56 +1,44 @@ package handler import ( - "context" "encoding/json" "fmt" "net/http" "github.com/99designs/gqlgen/graphql" - "github.com/vektah/gqlparser/ast" "github.com/vektah/gqlparser/gqlerror" - "github.com/vektah/gqlparser/parser" - "github.com/vektah/gqlparser/validator" ) type ( Server struct { - es graphql.ExecutableSchema - transports []graphql.Transport - middlewares []graphql.Middleware - - handler graphql.Handler + es graphql.ExecutableSchema + transports []graphql.Transport + plugins []graphql.HandlerPlugin + exec executor } - - Option func(Server) ) -func (s *Server) AddTransport(transport graphql.Transport) { - s.transports = append(s.transports, transport) +func New(es graphql.ExecutableSchema) *Server { + s := &Server{ + es: es, + } + s.exec = newExecutor(s.es, s.plugins) + return s } -func (s *Server) Use(middleware graphql.Middleware) { - s.middlewares = append(s.middlewares, middleware) - s.buildHandler() +func (s *Server) AddTransport(transport graphql.Transport) { + s.transports = append(s.transports, transport) } -// This is fairly expensive, so we dont want to do it in every request. May be called multiple times while creating -// the server. -func (s *Server) buildHandler() { - handler := s.executableSchemaHandler - for i := len(s.middlewares) - 1; i >= 0; i-- { - handler = s.middlewares[i](handler) - } +func (s *Server) Use(plugin graphql.HandlerPlugin) { + switch plugin.(type) { + case graphql.RequestMutator, graphql.RequestContextMutator, graphql.RequestMiddleware: + s.plugins = append(s.plugins, plugin) + s.exec = newExecutor(s.es, s.plugins) - s.handler = handler -} - -func New(es graphql.ExecutableSchema) *Server { - s := &Server{ - es: es, + default: + panic(fmt.Errorf("cannot Use %T as a gqlgen handler plugin because it does not implement any plugin hooks", plugin)) } - s.handler = s.executableSchemaHandler - return s } func (s *Server) getTransport(r *http.Request) graphql.Transport { @@ -69,60 +57,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - transport.Do(w, r, s.handler) -} - -// executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware -// and sends responses to the transport so it can be returned to the client -func (s *Server) executableSchemaHandler(ctx context.Context, write graphql.Writer) { - rc := graphql.GetRequestContext(ctx) - - var gerr *gqlerror.Error - - // todo: hmm... how should this work? - if rc.Doc == nil { - rc.Doc, gerr = s.parseOperation(ctx, rc) - if gerr != nil { - write(graphql.StatusParseError, &graphql.Response{Errors: []*gqlerror.Error{gerr}}) - return - } - } - - ctx, op, listErr := s.validateOperation(ctx, rc) - if len(listErr) != 0 { - write(graphql.StatusValidationError, &graphql.Response{ - Errors: listErr, - }) - return - } - - vars, err := validator.VariableValues(s.es.Schema(), op, rc.Variables) - if err != nil { - write(graphql.StatusValidationError, &graphql.Response{ - Errors: gqlerror.List{err}, - }) - return - } - - rc.Variables = vars - - switch op.Operation { - case ast.Query: - resp := s.es.Query(ctx, op) - - write(getStatus(resp), resp) - case ast.Mutation: - resp := s.es.Mutation(ctx, op) - write(getStatus(resp), resp) - case ast.Subscription: - resp := s.es.Subscription(ctx, op) - - for w := resp(); w != nil; w = resp() { - write(getStatus(w), w) - } - default: - write(graphql.StatusValidationError, graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } + transport.Do(w, r, s.exec) } func getStatus(resp *graphql.Response) graphql.Status { @@ -132,30 +67,6 @@ func getStatus(resp *graphql.Response) graphql.Status { return graphql.StatusOk } -func (s *Server) parseOperation(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, *gqlerror.Error) { - ctx = rc.Tracer.StartOperationValidation(ctx) - defer func() { rc.Tracer.EndOperationValidation(ctx) }() - - return parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) -} - -func (gh *Server) validateOperation(ctx context.Context, rc *graphql.RequestContext) (context.Context, *ast.OperationDefinition, gqlerror.List) { - ctx = rc.Tracer.StartOperationValidation(ctx) - defer func() { rc.Tracer.EndOperationValidation(ctx) }() - - listErr := validator.Validate(gh.es.Schema(), rc.Doc) - if len(listErr) != 0 { - return ctx, nil, listErr - } - - op := rc.Doc.Operations.ForName(rc.OperationName) - if op == nil { - return ctx, nil, gqlerror.List{gqlerror.Errorf("operation %s not found", rc.OperationName)} - } - - return ctx, op, nil -} - func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { w.WriteHeader(code) b, err := json.Marshal(&graphql.Response{Errors: errors}) diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index feee8c9d6fc..27ebb048559 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -38,11 +38,11 @@ func TestServer(t *testing.T) { } srv := New(es) srv.AddTransport(&transport.HTTPGet{}) - srv.Use(func(next graphql.Handler) graphql.Handler { + srv.Use(middlewareFunc(func(next graphql.Handler) graphql.Handler { return func(ctx context.Context, writer graphql.Writer) { next(ctx, writer) } - }) + })) t.Run("returns an error if no transport matches", func(t *testing.T) { resp := post(srv, "/foo", "application/json") @@ -56,32 +56,32 @@ func TestServer(t *testing.T) { assert.Equal(t, `{"data":"query resp"}`, resp.Body.String()) }) - t.Run("calls mutation on executable schema", func(t *testing.T) { + t.Run("mutations are forbidden", func(t *testing.T) { resp := get(srv, "/foo?query=mutation{a}") assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":"mutation resp"}`, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) }) - t.Run("calls subscription repeatedly on executable schema", func(t *testing.T) { + t.Run("subscriptions are forbidden", func(t *testing.T) { resp := get(srv, "/foo?query=subscription{a}") assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":"subscription resp"}{"data":"subscription resp"}`, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) }) t.Run("invokes middleware in order", func(t *testing.T) { var calls []string - srv.Use(func(next graphql.Handler) graphql.Handler { + srv.Use(middlewareFunc(func(next graphql.Handler) graphql.Handler { return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "first") next(ctx, writer) } - }) - srv.Use(func(next graphql.Handler) graphql.Handler { + })) + srv.Use(middlewareFunc(func(next graphql.Handler) graphql.Handler { return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "second") next(ctx, writer) } - }) + })) resp := get(srv, "/foo?query={a}") assert.Equal(t, http.StatusOK, resp.Code) @@ -89,6 +89,12 @@ func TestServer(t *testing.T) { }) } +type middlewareFunc func(next graphql.Handler) graphql.Handler + +func (r middlewareFunc) InterceptRequest(next graphql.Handler) graphql.Handler { + return r(next) +} + func get(handler http.Handler, target string) *httptest.ResponseRecorder { r := httptest.NewRequest("GET", target, nil) w := httptest.NewRecorder() diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 26e8a5cd92f..08004dcb380 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -6,6 +6,8 @@ import ( "net/http" "strings" + "github.com/vektah/gqlparser/ast" + "github.com/99designs/gqlgen/graphql" ) @@ -21,10 +23,11 @@ func (H HTTPGet) Supports(r *http.Request) bool { return r.Method == "GET" } -func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { - rc := newRequestContext() - rc.RawQuery = r.URL.Query().Get("query") - rc.OperationName = r.URL.Query().Get("operationName") +func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { + raw := &graphql.RawParams{ + Query: r.URL.Query().Get("query"), + OperationName: r.URL.Query().Get("operationName"), + } writer := graphql.Writer(func(status graphql.Status, response *graphql.Response) { switch status { @@ -41,26 +44,30 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, handler graphql.Hand }) if variables := r.URL.Query().Get("variables"); variables != "" { - if err := jsonDecode(strings.NewReader(variables), &rc.Variables); err != nil { + if err := jsonDecode(strings.NewReader(variables), &raw.Variables); err != nil { writer.Errorf("variables could not be decoded") return } } if extensions := r.URL.Query().Get("extensions"); extensions != "" { - if err := jsonDecode(strings.NewReader(extensions), &rc.Extensions); err != nil { + if err := jsonDecode(strings.NewReader(extensions), &raw.Extensions); err != nil { writer.Errorf("extensions could not be decoded") return } } - // TODO: FIXME - //if op.Operation != ast.Query && args.R.Method == http.MethodGet { - // return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("GET requests only allow query operations")} - //} - + rc, err := exec.CreateRequestContext(r.Context(), raw) + if err != nil { + writer.GraphqlErr(err...) + } + op := rc.Doc.Operations.ForName(rc.OperationName) + if op.Operation != ast.Query { + writer.Errorf("GET requests only allow query operations") + return + } ctx := graphql.WithRequestContext(r.Context(), rc) - handler(ctx, writer) + exec.DispatchRequest(ctx, writer) } func jsonDecode(r io.Reader, val interface{}) error { diff --git a/graphql/handler/transport/jsonpost.go b/graphql/handler/transport/jsonpost.go index d2764050e9c..bda13b0de44 100644 --- a/graphql/handler/transport/jsonpost.go +++ b/graphql/handler/transport/jsonpost.go @@ -25,7 +25,7 @@ func (H JsonPostTransport) Supports(r *http.Request) bool { return r.Method == "POST" && mediaType == "application/json" } -func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { +func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { w.Header().Set("Content-Type", "application/json") write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { @@ -43,19 +43,19 @@ func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, handler gr w.Write(b) }) - var params rawParams + var params *graphql.RawParams if err := jsonDecode(r.Body, ¶ms); err != nil { w.WriteHeader(http.StatusBadRequest) write.Errorf("json body could not be decoded: " + err.Error()) return } - rc := newRequestContext() - rc.RawQuery = params.Query - rc.OperationName = params.OperationName - rc.Variables = params.Variables - rc.Extensions = params.Extensions - + rc, err := exec.CreateRequestContext(r.Context(), params) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + write.GraphqlErr(err...) + return + } ctx := graphql.WithRequestContext(r.Context(), rc) - handler(ctx, write) + exec.DispatchRequest(ctx, write) } diff --git a/graphql/handler/transport/raw.go b/graphql/handler/transport/raw.go deleted file mode 100644 index 64b0ea8eff2..00000000000 --- a/graphql/handler/transport/raw.go +++ /dev/null @@ -1,8 +0,0 @@ -package transport - -type rawParams struct { - Query string `json:"query"` - OperationName string `json:"operationName"` - Variables map[string]interface{} `json:"variables"` - Extensions map[string]interface{} `json:"extensions"` -} diff --git a/graphql/handler/transport/requestcontext.go b/graphql/handler/transport/requestcontext.go deleted file mode 100644 index b5e443d0681..00000000000 --- a/graphql/handler/transport/requestcontext.go +++ /dev/null @@ -1,15 +0,0 @@ -package transport - -import "github.com/99designs/gqlgen/graphql" - -func newRequestContext() *graphql.RequestContext { - return &graphql.RequestContext{ - DisableIntrospection: true, - Recover: graphql.DefaultRecover, - ErrorPresenter: graphql.DefaultErrorPresenter, - ResolverMiddleware: nil, - RequestMiddleware: nil, - Tracer: graphql.NopTracer{}, - ComplexityLimit: 0, - } -} diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 153fe38f92b..0f37b3335ed 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -41,7 +41,7 @@ type ( active map[string]context.CancelFunc mu sync.Mutex keepAliveTicker *time.Ticker - handler graphql.Handler + exec graphql.GraphExecutor initPayload InitPayload } @@ -59,7 +59,7 @@ func (t WebsocketTransport) Supports(r *http.Request) bool { return r.Header.Get("Upgrade") != "" } -func (t WebsocketTransport) Do(w http.ResponseWriter, r *http.Request, handler graphql.Handler) { +func (t WebsocketTransport) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { ws, err := t.Upgrader.Upgrade(w, r, http.Header{ "Sec-Websocket-Protocol": []string{"graphql-ws"}, }) @@ -73,7 +73,7 @@ func (t WebsocketTransport) Do(w http.ResponseWriter, r *http.Request, handler g active: map[string]context.CancelFunc{}, conn: ws, ctx: r.Context(), - handler: handler, + exec: exec, WebsocketTransport: t, } @@ -191,17 +191,17 @@ func (c *wsConnection) keepAlive(ctx context.Context) { } func (c *wsConnection) subscribe(message *operationMessage) bool { - var params rawParams + var params *graphql.RawParams if err := jsonDecode(bytes.NewReader(message.Payload), ¶ms); err != nil { c.sendConnectionError("invalid json") return false } - rc := newRequestContext() - rc.RawQuery = params.Query - rc.OperationName = params.OperationName - rc.Variables = params.Variables - rc.Extensions = params.Extensions + rc, err := c.exec.CreateRequestContext(c.ctx, params) + if err != nil { + c.sendError(message.ID, err...) + return false + } ctx := graphql.WithRequestContext(c.ctx, rc) @@ -220,7 +220,7 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.sendError(message.ID, &gqlerror.Error{Message: userErr.Error()}) } }() - c.handler(ctx, func(status graphql.Status, response *graphql.Response) { + c.exec.DispatchRequest(ctx, func(status graphql.Status, response *graphql.Response) { msgType := dataMsg switch status { case graphql.StatusOk, graphql.StatusResolverError: diff --git a/graphql/recovery.go b/graphql/recovery.go index 3aa032dc5aa..130d661b373 100644 --- a/graphql/recovery.go +++ b/graphql/recovery.go @@ -6,6 +6,8 @@ import ( "fmt" "os" "runtime/debug" + + "github.com/vektah/gqlparser/gqlerror" ) type RecoverFunc func(ctx context.Context, err interface{}) (userMessage error) @@ -17,3 +19,10 @@ func DefaultRecover(ctx context.Context, err interface{}) error { return errors.New("internal system error") } + +var _ RequestContextMutator = RecoverFunc(nil) + +func (f RecoverFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { + rc.Recover = f + return nil +} diff --git a/handler/graphql.go b/handler/graphql.go index 3c3f6e7ecfd..8ab912eb573 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -48,7 +48,6 @@ type Config struct { recover graphql.RecoverFunc errorPresenter graphql.ErrorPresenterFunc resolverHook graphql.FieldMiddleware - requestHook graphql.RequestMiddleware tracer graphql.Tracer complexityLimit int complexityLimitFunc graphql.ComplexityLimitFunc From c3dbcf83eaa8bc865b7e482fd17f26fa5139485b Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 30 Oct 2019 14:30:16 +1100 Subject: [PATCH 12/53] Add apollo tracing --- graphql/context.go | 25 ++-- graphql/extensions.go | 12 ++ graphql/handler.go | 34 +++++- graphql/handler/apollotracing/tracer.go | 114 +++++++++++++++++++ graphql/handler/apollotracing/tracer_test.go | 111 ++++++++++++++++++ graphql/handler/executor.go | 57 ++++++---- graphql/handler/middleware/tracer.go | 21 ---- graphql/handler/server.go | 7 +- graphql/handler/server_test.go | 49 ++++++-- graphql/handler/transport/http_get.go | 1 + graphql/handler/transport/jsonpost.go | 2 +- graphql/handler/transport/jsonpost_test.go | 14 +-- graphql/handler/transport/websocket.go | 5 +- graphql/handler/transport/websocket_test.go | 2 +- graphql/stats.go | 41 +++++++ testdata/gqlgen.go | 4 +- 16 files changed, 412 insertions(+), 87 deletions(-) create mode 100644 graphql/extensions.go create mode 100644 graphql/handler/apollotracing/tracer.go create mode 100644 graphql/handler/apollotracing/tracer_test.go delete mode 100644 graphql/handler/middleware/tracer.go create mode 100644 graphql/stats.go diff --git a/graphql/context.go b/graphql/context.go index 91778a5dd87..875963daa84 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -30,13 +30,17 @@ type RequestContext struct { Recover RecoverFunc ResolverMiddleware FieldMiddleware DirectiveMiddleware FieldMiddleware - RequestMiddleware RequestMiddleware - Tracer Tracer + RequestMiddleware ResponseInterceptor errorsMu sync.Mutex Errors gqlerror.List extensionsMu sync.Mutex - Extensions map[string]interface{} + + // @deprecated use ResponseContext instead, in the case of subscriptions there are many responses returned + // and each can have its own set of extensions + Extensions map[string]interface{} + + Stats Stats } func (rc *RequestContext) Validate(ctx context.Context) error { @@ -61,9 +65,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { if rc.ErrorPresenter == nil { rc.ErrorPresenter = DefaultErrorPresenter } - if rc.Tracer == nil { - rc.Tracer = &NopTracer{} - } if rc.ComplexityLimit < 0 { return errors.New("field 'ComplexityLimit' value must be 0 or more") } @@ -71,18 +72,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { return nil } -func (cfg *RequestContext) AddTracer(tracer Tracer) { - if cfg.Tracer == nil { - cfg.Tracer = tracer - return - } - lastTracer := cfg.Tracer - cfg.Tracer = &tracerWrapper{ - tracer1: lastTracer, - tracer2: tracer, - } -} - func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { return next(ctx) } diff --git a/graphql/extensions.go b/graphql/extensions.go new file mode 100644 index 00000000000..28c60bb7fdd --- /dev/null +++ b/graphql/extensions.go @@ -0,0 +1,12 @@ +package graphql + +import "context" + +func GetExtensions(ctx context.Context) map[string]interface{} { + ext := GetRequestContext(ctx).Extensions + if ext == nil { + return map[string]interface{}{} + } + + return ext +} diff --git a/graphql/handler.go b/graphql/handler.go index 1f1c052a16e..83567fe63c6 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -27,18 +27,44 @@ type ( } // HandlerPlugin interface is entirely optional, see the list of possible hook points below + // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen before working with these + // +---REQUEST POST /graphql------------------------------------------------+ + // | | + // | ++OPERATION query OpName { viewer { name } }+------------------------+ | + // | | | | + // | | RESULT { "data": { "viewer": { "name": "bob" } } } | | + // | | | | + // | ++OPERATION subscription OpName2 { chat { message } }+---------------+ | + // | | | | + // | | RESULT { "data": { "chat": { "message": "hello" } } } | | + // | | | | + // | | RESULT { "data": { "chat": { "message": "byee" } } } | | + // | | | | + // | +--------------------------------------------------------------------+ | + // +------------------------------------------------------------------------+ + HandlerPlugin interface{} - RequestMutator interface { - MutateRequest(ctx context.Context, request *RawParams) *gqlerror.Error + // RequestParameterMutator is called before creating a request context. allows manipulating the raw query + // on the way in. + RequestParameterMutator interface { + MutateRequestParameters(ctx context.Context, request *RawParams) *gqlerror.Error } + // RequestContextMutator is called after creating the request context, but before executing the root resolver. RequestContextMutator interface { MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error } - RequestMiddleware interface { - InterceptRequest(next Handler) Handler + // ResponseInterceptor is called around each graphql operation. This can be called many times in the case of + // batching and subscriptions. + ResponseInterceptor interface { + InterceptResponse(next Handler) Handler + } + + // FieldInterceptor called around each field + FieldInterceptor interface { + InterceptField(ctx context.Context, next Resolver) (res interface{}, err error) } Transport interface { diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go new file mode 100644 index 00000000000..6895a70dfa1 --- /dev/null +++ b/graphql/handler/apollotracing/tracer.go @@ -0,0 +1,114 @@ +package apollotracing + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/99designs/gqlgen/graphql" +) + +type ( + ApolloTracing struct{} + + TracingExtension struct { + mu sync.Mutex `json:"-"` + Version int `json:"version"` + StartTime time.Time `json:"startTime"` + EndTime time.Time `json:"endTime"` + Duration time.Duration `json:"duration"` + Parsing Span `json:"parsing"` + Validation Span `json:"validation"` + Execution struct { + Resolvers []ResolverExecution `json:"resolvers"` + } `json:"execution"` + } + + Span struct { + StartOffset time.Duration `json:"startOffset"` + Duration time.Duration `json:"duration"` + } + + ResolverExecution struct { + Path []interface{} `json:"path"` + ParentType string `json:"parentType"` + FieldName string `json:"fieldName"` + ReturnType string `json:"returnType"` + StartOffset time.Duration `json:"startOffset"` + Duration time.Duration `json:"duration"` + } +) + +var _ graphql.ResponseInterceptor = ApolloTracing{} +var _ graphql.FieldInterceptor = ApolloTracing{} + +func New() graphql.HandlerPlugin { + return &ApolloTracing{} +} + +func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + rc := graphql.GetRequestContext(ctx) + td, ok := rc.Extensions["tracing"].(*TracingExtension) + if !ok { + panic("missing tracing extension") + } + + start := graphql.Now() + + defer func() { + td.mu.Lock() + defer td.mu.Unlock() + fc := graphql.GetResolverContext(ctx) + + end := graphql.Now() + + td.Execution.Resolvers = append(td.Execution.Resolvers, ResolverExecution{ + Path: fc.Path(), + ParentType: fc.Object, + FieldName: fc.Field.Name, + ReturnType: fc.Field.Definition.Type.String(), + StartOffset: start.Sub(rc.Stats.OperationStart), + Duration: end.Sub(start), + }) + }() + + return next(ctx) +} + +func (a ApolloTracing) InterceptResponse(next graphql.Handler) graphql.Handler { + return func(ctx context.Context, writer graphql.Writer) { + rc := graphql.GetRequestContext(ctx) + + start := rc.Stats.OperationStart + + td := &TracingExtension{ + Version: 1, + StartTime: start, + Parsing: Span{ + StartOffset: rc.Stats.Parsing.Start.Sub(start), + Duration: rc.Stats.Parsing.End.Sub(rc.Stats.Parsing.Start), + }, + + Validation: Span{ + StartOffset: rc.Stats.Validation.Start.Sub(start), + Duration: rc.Stats.Validation.End.Sub(rc.Stats.Validation.Start), + }, + + Execution: struct { + Resolvers []ResolverExecution `json:"resolvers"` + }{}, + } + + if err := rc.RegisterExtension("tracing", td); err != nil { + panic(fmt.Errorf("unable to register extension: %s", err.Error())) + } + + next(ctx, func(status graphql.Status, response *graphql.Response) { + end := graphql.Now() + td.EndTime = end + td.Duration = end.Sub(start) + writer(status, response) + }) + } +} diff --git a/graphql/handler/apollotracing/tracer_test.go b/graphql/handler/apollotracing/tracer_test.go new file mode 100644 index 00000000000..140aaaad194 --- /dev/null +++ b/graphql/handler/apollotracing/tracer_test.go @@ -0,0 +1,111 @@ +package apollotracing_test + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/apollotracing" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" +) + +// todo: extract out common code for testing handler plugins without requiring a codegenned server. +func TestApolloTracing(t *testing.T) { + now := time.Unix(0, 0) + + graphql.Now = func() time.Time { + defer func() { + now = now.Add(100 * time.Nanosecond) + }() + return now + } + + schema := gqlparser.MustLoadSchema(&ast.Source{Input: ` + schema { query: Query } + type Query { + me: User! + user(id: Int): User! + } + type User { name: String! } + `}) + + es := &graphql.ExecutableSchemaMock{ + QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + // Field execution happens inside the generated code, we want just enough to test against right now. + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: "Query", + Field: graphql.CollectedField{ + Field: &ast.Field{ + Name: "me", + Alias: "me", + Definition: schema.Types["Query"].Fields.ForName("me"), + }, + }, + }) + res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { + return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil + }) + require.NoError(t, err) + return res.(*graphql.Response) + }, + MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "mutations are not supported") + }, + SchemaFunc: func() *ast.Schema { + return schema + }, + } + h := handler.New(es) + h.AddTransport(transport.JsonPostTransport{}) + h.Use(apollotracing.New()) + + resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) + assert.Equal(t, http.StatusOK, resp.Code) + var respData struct { + Extensions struct { + Tracing apollotracing.TracingExtension `json:"tracing"` + } `json:"extensions"` + } + require.NoError(t, json.Unmarshal(resp.Body.Bytes(), &respData)) + + tracing := respData.Extensions.Tracing + + require.EqualValues(t, 1, tracing.Version) + + require.EqualValues(t, 0, tracing.StartTime.UnixNano()) + require.EqualValues(t, 700, tracing.EndTime.UnixNano()) + require.EqualValues(t, 700, tracing.Duration) + + require.EqualValues(t, 100, tracing.Parsing.StartOffset) + require.EqualValues(t, 100, tracing.Parsing.Duration) + + require.EqualValues(t, 300, tracing.Validation.StartOffset) + require.EqualValues(t, 100, tracing.Validation.Duration) + + require.EqualValues(t, 500, tracing.Execution.Resolvers[0].StartOffset) + require.EqualValues(t, 100, tracing.Execution.Resolvers[0].Duration) + require.EqualValues(t, []interface{}{"me"}, tracing.Execution.Resolvers[0].Path) + require.EqualValues(t, "Query", tracing.Execution.Resolvers[0].ParentType) + require.EqualValues(t, "me", tracing.Execution.Resolvers[0].FieldName) + require.EqualValues(t, "User!", tracing.Execution.Resolvers[0].ReturnType) + +} + +func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { + r := httptest.NewRequest(method, target, strings.NewReader(body)) + r.Header.Set("Content-Type", "application/json") + w := httptest.NewRecorder() + + handler.ServeHTTP(w, r) + return w +} diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 273bffe2d56..5fcb1bcf464 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -12,8 +12,9 @@ import ( type executor struct { handler graphql.Handler + responseMiddleware graphql.FieldMiddleware es graphql.ExecutableSchema - requestMutators []graphql.RequestMutator + requestParamMutators []graphql.RequestParameterMutator requestContextMutators []graphql.RequestContextMutator } @@ -23,27 +24,39 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e e := executor{ es: es, } - handler := e.executableSchemaHandler + e.handler = e.executableSchemaHandler + e.responseMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + return next(ctx) + } + // this loop goes backwards so the first plugin is the outer most middleware and runs first. for i := len(plugins) - 1; i >= 0; i-- { p := plugins[i] - if p, ok := p.(graphql.RequestMiddleware); ok { - handler = p.InterceptRequest(handler) + if p, ok := p.(graphql.ResponseInterceptor); ok { + previous := e.handler + e.handler = p.InterceptResponse(previous) + } + + if p, ok := p.(graphql.FieldInterceptor); ok { + previous := e.responseMiddleware + e.responseMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + return p.InterceptField(ctx, func(ctx context.Context) (res interface{}, err error) { + return previous(ctx, next) + }) + } } } for _, p := range plugins { - - if p, ok := p.(graphql.RequestMutator); ok { - e.requestMutators = append(e.requestMutators, p) + if p, ok := p.(graphql.RequestParameterMutator); ok { + e.requestParamMutators = append(e.requestParamMutators, p) } if p, ok := p.(graphql.RequestContextMutator); ok { e.requestContextMutators = append(e.requestContextMutators, p) } - } - e.handler = handler + } return e } @@ -53,8 +66,8 @@ func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { } func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { - for _, p := range e.requestMutators { - if err := p.MutateRequest(ctx, params); err != nil { + for _, p := range e.requestParamMutators { + if err := p.MutateRequestParameters(ctx, params); err != nil { return nil, gqlerror.List{err} } } @@ -65,15 +78,15 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP DisableIntrospection: true, Recover: graphql.DefaultRecover, ErrorPresenter: graphql.DefaultErrorPresenter, - ResolverMiddleware: nil, + ResolverMiddleware: e.responseMiddleware, RequestMiddleware: nil, - Tracer: graphql.NopTracer{}, ComplexityLimit: 0, RawQuery: params.Query, OperationName: params.OperationName, Variables: params.Variables, Extensions: params.Extensions, } + rc.Stats.OperationStart = graphql.GetStartTime(ctx) rc.Doc, gerr = e.parseOperation(ctx, rc) if gerr != nil { @@ -111,15 +124,18 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr switch op.Operation { case ast.Query: resp := e.es.Query(ctx, op) - + resp.Extensions = graphql.GetExtensions(ctx) write(getStatus(resp), resp) case ast.Mutation: resp := e.es.Mutation(ctx, op) + resp.Extensions = graphql.GetExtensions(ctx) write(getStatus(resp), resp) case ast.Subscription: resp := e.es.Subscription(ctx, op) for w := resp(); w != nil; w = resp() { + w.Extensions = graphql.GetExtensions(ctx) + write(getStatus(w), w) } default: @@ -128,15 +144,18 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr } func (e executor) parseOperation(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, *gqlerror.Error) { - ctx = rc.Tracer.StartOperationValidation(ctx) - defer func() { rc.Tracer.EndOperationValidation(ctx) }() - + rc.Stats.Parsing.Start = graphql.Now() + defer func() { + rc.Stats.Parsing.End = graphql.Now() + }() return parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) } func (e executor) validateOperation(ctx context.Context, rc *graphql.RequestContext) (context.Context, *ast.OperationDefinition, gqlerror.List) { - ctx = rc.Tracer.StartOperationValidation(ctx) - defer func() { rc.Tracer.EndOperationValidation(ctx) }() + rc.Stats.Validation.Start = graphql.Now() + defer func() { + rc.Stats.Validation.End = graphql.Now() + }() listErr := validator.Validate(e.es.Schema(), rc.Doc) if len(listErr) != 0 { diff --git a/graphql/handler/middleware/tracer.go b/graphql/handler/middleware/tracer.go deleted file mode 100644 index 4c14b99d9aa..00000000000 --- a/graphql/handler/middleware/tracer.go +++ /dev/null @@ -1,21 +0,0 @@ -package middleware - -// todo fixme -// Tracer allows you to add a request/resolver tracer that will be called around the root request, -// calling resolver. This is useful for tracing -//func Tracer(tracer graphql.Tracer) graphql.Middleware { -// return func(next graphql.Handler) graphql.Handler { -// return func(ctx context.Context, writer graphql.Writer) { -// rc := graphql.GetRequestContext(ctx) -// rc.AddTracer(tracer) -// rc.AddRequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { -// ctx = tracer.StartOperationExecution(ctx) -// resp := next(ctx) -// tracer.EndOperationExecution(ctx) -// -// return resp -// }) -// next(ctx, writer) -// } -// } -//} diff --git a/graphql/handler/server.go b/graphql/handler/server.go index dfe98bb57c0..1d15d1ef82c 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -32,7 +32,10 @@ func (s *Server) AddTransport(transport graphql.Transport) { func (s *Server) Use(plugin graphql.HandlerPlugin) { switch plugin.(type) { - case graphql.RequestMutator, graphql.RequestContextMutator, graphql.RequestMiddleware: + case graphql.RequestParameterMutator, + graphql.RequestContextMutator, + graphql.ResponseInterceptor, + graphql.FieldInterceptor: s.plugins = append(s.plugins, plugin) s.exec = newExecutor(s.es, s.plugins) @@ -51,6 +54,8 @@ func (s *Server) getTransport(r *http.Request) graphql.Transport { } func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + r = r.WithContext(graphql.StartOperationTrace(r.Context())) + transport := s.getTransport(r) if transport == nil { sendErrorf(w, http.StatusBadRequest, "transport not supported") diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index 27ebb048559..72ab650f947 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -10,13 +10,20 @@ import ( "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/vektah/gqlparser/ast" ) func TestServer(t *testing.T) { es := &graphql.ExecutableSchemaMock{ QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return &graphql.Response{Data: []byte(`"query resp"`)} + // Field execution happens inside the generated code, we want just enough to test against right now. + res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { + return &graphql.Response{Data: []byte(`"query resp"`)}, nil + }) + require.NoError(t, err) + + return res.(*graphql.Response) }, MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { return &graphql.Response{Data: []byte(`"mutation resp"`)} @@ -24,7 +31,6 @@ func TestServer(t *testing.T) { SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { called := 0 return func() *graphql.Response { - fmt.Println("asdf") called++ if called > 2 { return nil @@ -38,11 +44,6 @@ func TestServer(t *testing.T) { } srv := New(es) srv.AddTransport(&transport.HTTPGet{}) - srv.Use(middlewareFunc(func(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - next(ctx, writer) - } - })) t.Run("returns an error if no transport matches", func(t *testing.T) { resp := post(srv, "/foo", "application/json") @@ -68,15 +69,15 @@ func TestServer(t *testing.T) { assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) }) - t.Run("invokes middleware in order", func(t *testing.T) { + t.Run("invokes operation middleware in order", func(t *testing.T) { var calls []string - srv.Use(middlewareFunc(func(next graphql.Handler) graphql.Handler { + srv.Use(opFunc(func(next graphql.Handler) graphql.Handler { return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "first") next(ctx, writer) } })) - srv.Use(middlewareFunc(func(next graphql.Handler) graphql.Handler { + srv.Use(opFunc(func(next graphql.Handler) graphql.Handler { return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "second") next(ctx, writer) @@ -87,14 +88,38 @@ func TestServer(t *testing.T) { assert.Equal(t, http.StatusOK, resp.Code) assert.Equal(t, []string{"first", "second"}, calls) }) + + t.Run("invokes field middleware in order", func(t *testing.T) { + var calls []string + srv.Use(fieldFunc(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + fmt.Println("first") + calls = append(calls, "first") + return next(ctx) + })) + srv.Use(fieldFunc(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + fmt.Println("second") + calls = append(calls, "second") + return next(ctx) + })) + + resp := get(srv, "/foo?query={a}") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, []string{"first", "second"}, calls) + }) } -type middlewareFunc func(next graphql.Handler) graphql.Handler +type opFunc func(next graphql.Handler) graphql.Handler -func (r middlewareFunc) InterceptRequest(next graphql.Handler) graphql.Handler { +func (r opFunc) InterceptResponse(next graphql.Handler) graphql.Handler { return r(next) } +type fieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) + +func (f fieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + return f(ctx, next) +} + func get(handler http.Handler, target string) *httptest.ResponseRecorder { r := httptest.NewRequest("GET", target, nil) w := httptest.NewRecorder() diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 08004dcb380..8ba3603bbd7 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -59,6 +59,7 @@ func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphEx rc, err := exec.CreateRequestContext(r.Context(), raw) if err != nil { + w.WriteHeader(http.StatusUnprocessableEntity) writer.GraphqlErr(err...) } op := rc.Doc.Operations.ForName(rc.OperationName) diff --git a/graphql/handler/transport/jsonpost.go b/graphql/handler/transport/jsonpost.go index bda13b0de44..342a4b5ead4 100644 --- a/graphql/handler/transport/jsonpost.go +++ b/graphql/handler/transport/jsonpost.go @@ -52,7 +52,7 @@ func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, exec graph rc, err := exec.CreateRequestContext(r.Context(), params) if err != nil { - w.WriteHeader(http.StatusBadRequest) + w.WriteHeader(http.StatusUnprocessableEntity) write.GraphqlErr(err...) return } diff --git a/graphql/handler/transport/jsonpost_test.go b/graphql/handler/transport/jsonpost_test.go index 64d682a19f4..6f5313f851a 100644 --- a/graphql/handler/transport/jsonpost_test.go +++ b/graphql/handler/transport/jsonpost_test.go @@ -71,35 +71,35 @@ func TestJsonPost(t *testing.T) { t.Run("decode failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", "notjson") - assert.Equal(t, http.StatusBadRequest, resp.Code) + assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"json body could not be decoded: invalid character 'o' in literal null (expecting 'u')"}],"data":null}`, resp.Body.String()) }) t.Run("parse failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "!"}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, resp.Body.String()) }) t.Run("validation failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "{ me { title }}"}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"Cannot query field \"title\" on type \"User\".","locations":[{"line":1,"column":8}]}],"data":null}`, resp.Body.String()) }) t.Run("invalid variable", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "query($id:Int!){user(id:$id){name}}","variables":{"id":false}}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) }) t.Run("execution failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query": "mutation { me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"mutations are not supported"}],"data":null}`, resp.Body.String()) }) @@ -124,7 +124,7 @@ func TestJsonPost(t *testing.T) { for _, contentType := range validContentTypes { t.Run(fmt.Sprintf("allow for content type %s", contentType), func(t *testing.T) { resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, contentType) - assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) }) } @@ -141,7 +141,7 @@ func TestJsonPost(t *testing.T) { for _, tc := range invalidContentTypes { t.Run(fmt.Sprintf("reject for content type %s", tc), func(t *testing.T) { resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, tc) - assert.Equal(t, http.StatusBadRequest, resp.Code) + assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String()) assert.Equal(t, fmt.Sprintf(`{"errors":[{"message":"%s"}],"data":null}`, "transport not supported"), resp.Body.String()) }) } diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 0f37b3335ed..87bc4c1608c 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -191,19 +191,20 @@ func (c *wsConnection) keepAlive(ctx context.Context) { } func (c *wsConnection) subscribe(message *operationMessage) bool { + ctx := graphql.StartOperationTrace(c.ctx) var params *graphql.RawParams if err := jsonDecode(bytes.NewReader(message.Payload), ¶ms); err != nil { c.sendConnectionError("invalid json") return false } - rc, err := c.exec.CreateRequestContext(c.ctx, params) + rc, err := c.exec.CreateRequestContext(ctx, params) if err != nil { c.sendError(message.ID, err...) return false } - ctx := graphql.WithRequestContext(c.ctx, rc) + ctx = graphql.WithRequestContext(ctx, rc) if c.initPayload != nil { ctx = withInitPayload(ctx, c.initPayload) diff --git a/graphql/handler/transport/websocket_test.go b/graphql/handler/transport/websocket_test.go index b87ac6ff3bc..1592d196336 100644 --- a/graphql/handler/transport/websocket_test.go +++ b/graphql/handler/transport/websocket_test.go @@ -100,7 +100,7 @@ func TestWebsocket(t *testing.T) { msg := readOp(c) assert.Equal(t, errorMsg, msg.Type) - assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, string(msg.Payload)) + assert.Equal(t, `[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}]`, string(msg.Payload)) }) t.Run("client can receive data", func(t *testing.T) { diff --git a/graphql/stats.go b/graphql/stats.go new file mode 100644 index 00000000000..bc695a9fb92 --- /dev/null +++ b/graphql/stats.go @@ -0,0 +1,41 @@ +package graphql + +import ( + "context" + "fmt" + "time" +) + +type Stats struct { + OperationStart time.Time + Parsing TraceTiming + Validation TraceTiming +} + +type TraceTiming struct { + Start time.Time + End time.Time +} + +var ctxTraceStart key = "trace_start" + +// StartOperationTrace captures the current time and stores it in context. This will eventually be added to request +// context but we want to grab it as soon as possible. For transports that can only handle a single graphql query +// per http requests you dont need to call this at all, the server will do it for you. For transports that handle +// multiple (eg batching, subscriptions) this should be called before decoding each request. +func StartOperationTrace(ctx context.Context) context.Context { + return context.WithValue(ctx, ctxTraceStart, Now()) +} + +// GetStartTime should only be called by the handler package, it will be set into request context +// as Stats.Start +func GetStartTime(ctx context.Context) time.Time { + t, ok := ctx.Value(ctxTraceStart).(time.Time) + if !ok { + panic(fmt.Sprintf("missing start time: %T", ctx.Value(ctxTraceStart))) + } + return t +} + +// Now is time.Now, except in tests. Then it can be whatever you want it to be. +var Now = time.Now diff --git a/testdata/gqlgen.go b/testdata/gqlgen.go index f4bbe75507d..e22451c6f98 100644 --- a/testdata/gqlgen.go +++ b/testdata/gqlgen.go @@ -8,6 +8,8 @@ import ( "os" "time" + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/api" "github.com/99designs/gqlgen/codegen/config" "github.com/99designs/gqlgen/plugin/stubgen" @@ -19,7 +21,7 @@ func main() { log.SetOutput(ioutil.Discard) - start := time.Now() + start := graphql.Now() cfg, err := config.LoadConfigFromDefaultLocations() if err != nil { From ab5665add4f1b6effe21cb1ef77f7346cad1d59c Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 30 Oct 2019 16:00:19 +1100 Subject: [PATCH 13/53] Add result context --- graphql/context.go | 146 ++---------------------- graphql/extensions.go | 12 -- graphql/handler.go | 22 ++-- graphql/handler/apollotracing/tracer.go | 70 ++++++------ graphql/handler/executor.go | 77 +++++++++---- graphql/handler/server.go | 5 +- graphql/handler/server_test.go | 8 +- graphql/result_context.go | 135 ++++++++++++++++++++++ 8 files changed, 258 insertions(+), 217 deletions(-) delete mode 100644 graphql/extensions.go create mode 100644 graphql/result_context.go diff --git a/graphql/context.go b/graphql/context.go index 875963daa84..b3c7cc73e1c 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -3,14 +3,13 @@ package graphql import ( "context" "errors" - "fmt" - "sync" "github.com/vektah/gqlparser/ast" "github.com/vektah/gqlparser/gqlerror" ) type Resolver func(ctx context.Context) (res interface{}, err error) +type ResultMiddleware func(ctx context.Context, next ResultHandler) *Response type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) type ComplexityLimitFunc func(ctx context.Context) int @@ -30,15 +29,7 @@ type RequestContext struct { Recover RecoverFunc ResolverMiddleware FieldMiddleware DirectiveMiddleware FieldMiddleware - RequestMiddleware ResponseInterceptor - - errorsMu sync.Mutex - Errors gqlerror.List - extensionsMu sync.Mutex - - // @deprecated use ResponseContext instead, in the case of subscriptions there are many responses returned - // and each can have its own set of extensions - Extensions map[string]interface{} + RequestMiddleware OperationInterceptor Stats Stats } @@ -80,41 +71,22 @@ func DefaultDirectiveMiddleware(ctx context.Context, next Resolver) (res interfa return next(ctx) } -func DefaultRequestMiddleware(ctx context.Context, next func(ctx context.Context) []byte) []byte { - return next(ctx) -} - -// Deprecated: construct RequestContext directly & call Validate method. -func NewRequestContext(doc *ast.QueryDocument, query string, variables map[string]interface{}) *RequestContext { - rc := &RequestContext{ - Doc: doc, - RawQuery: query, - Variables: variables, - } - err := rc.Validate(context.Background()) - if err != nil { - panic(err) - } - - return rc -} - type key string const ( - request key = "request_context" - resolver key = "resolver_context" + requestCtx key = "request_context" + resolverCtx key = "resolver_context" ) func GetRequestContext(ctx context.Context) *RequestContext { - if val, ok := ctx.Value(request).(*RequestContext); ok { + if val, ok := ctx.Value(requestCtx).(*RequestContext); ok { return val } return nil } func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context { - return context.WithValue(ctx, request, rc) + return context.WithValue(ctx, requestCtx, rc) } type ResolverContext struct { @@ -153,7 +125,7 @@ func (r *ResolverContext) Path() []interface{} { } func GetResolverContext(ctx context.Context) *ResolverContext { - if val, ok := ctx.Value(resolver).(*ResolverContext); ok { + if val, ok := ctx.Value(resolverCtx).(*ResolverContext); ok { return val } return nil @@ -161,7 +133,7 @@ func GetResolverContext(ctx context.Context) *ResolverContext { func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context { rc.Parent = GetResolverContext(ctx) - return context.WithValue(ctx, resolver, rc) + return context.WithValue(ctx, resolverCtx, rc) } // This is just a convenient wrapper method for CollectFields @@ -189,48 +161,15 @@ Next: } // Errorf sends an error string to the client, passing it through the formatter. +// Deprecated: use graphql.AddErrorf(ctx, err) instead func (c *RequestContext) Errorf(ctx context.Context, format string, args ...interface{}) { - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - - c.Errors = append(c.Errors, c.ErrorPresenter(ctx, fmt.Errorf(format, args...))) + AddErrorf(ctx, format, args...) } // Error sends an error to the client, passing it through the formatter. +// Deprecated: use graphql.AddError(ctx, err) instead func (c *RequestContext) Error(ctx context.Context, err error) { - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - - c.Errors = append(c.Errors, c.ErrorPresenter(ctx, err)) -} - -// HasError returns true if the current field has already errored -func (c *RequestContext) HasError(rctx *ResolverContext) bool { - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - path := rctx.Path() - - for _, err := range c.Errors { - if equalPath(err.Path, path) { - return true - } - } - return false -} - -// GetErrors returns a list of errors that occurred in the current field -func (c *RequestContext) GetErrors(rctx *ResolverContext) gqlerror.List { - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - path := rctx.Path() - - var errs gqlerror.List - for _, err := range c.Errors { - if equalPath(err.Path, path) { - errs = append(errs, err) - } - } - return errs + AddError(ctx, err) } func equalPath(a []interface{}, b []interface{}) bool { @@ -247,67 +186,6 @@ func equalPath(a []interface{}, b []interface{}) bool { return true } -// AddError is a convenience method for adding an error to the current response -func AddError(ctx context.Context, err error) { - GetRequestContext(ctx).Error(ctx, err) -} - -// AddErrorf is a convenience method for adding an error to the current response -func AddErrorf(ctx context.Context, format string, args ...interface{}) { - GetRequestContext(ctx).Errorf(ctx, format, args...) -} - -// RegisterExtension registers an extension, returns error if extension has already been registered -func (c *RequestContext) RegisterExtension(key string, value interface{}) error { - c.extensionsMu.Lock() - defer c.extensionsMu.Unlock() - - if c.Extensions == nil { - c.Extensions = make(map[string]interface{}) - } - - if _, ok := c.Extensions[key]; ok { - return fmt.Errorf("extension already registered for key %s", key) - } - - c.Extensions[key] = value - return nil -} - -// ChainFieldMiddleware add chain by FieldMiddleware -func ChainFieldMiddleware(handleFunc ...FieldMiddleware) FieldMiddleware { - n := len(handleFunc) - - if n > 1 { - lastI := n - 1 - return func(ctx context.Context, next Resolver) (interface{}, error) { - var ( - chainHandler Resolver - curI int - ) - chainHandler = func(currentCtx context.Context) (interface{}, error) { - if curI == lastI { - return next(currentCtx) - } - curI++ - res, err := handleFunc[curI](currentCtx, chainHandler) - curI-- - return res, err - - } - return handleFunc[0](ctx, chainHandler) - } - } - - if n == 1 { - return handleFunc[0] - } - - return func(ctx context.Context, next Resolver) (interface{}, error) { - return next(ctx) - } -} - var _ RequestContextMutator = ComplexityLimitFunc(nil) func (c ComplexityLimitFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { diff --git a/graphql/extensions.go b/graphql/extensions.go deleted file mode 100644 index 28c60bb7fdd..00000000000 --- a/graphql/extensions.go +++ /dev/null @@ -1,12 +0,0 @@ -package graphql - -import "context" - -func GetExtensions(ctx context.Context) map[string]interface{} { - ext := GetRequestContext(ctx).Extensions - if ext == nil { - return map[string]interface{}{} - } - - return ext -} diff --git a/graphql/handler.go b/graphql/handler.go index 83567fe63c6..c7fafe9af30 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -9,10 +9,11 @@ import ( ) type ( - Handler func(ctx context.Context, writer Writer) - ResponseStream func() *Response - Writer func(Status, *Response) - Status int + OperationHandler func(ctx context.Context, writer Writer) + ResultHandler func(ctx context.Context) *Response + ResponseStream func() *Response + Writer func(Status, *Response) + Status int RawParams struct { Query string `json:"query"` @@ -56,10 +57,14 @@ type ( MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error } - // ResponseInterceptor is called around each graphql operation. This can be called many times in the case of - // batching and subscriptions. - ResponseInterceptor interface { - InterceptResponse(next Handler) Handler + OperationInterceptor interface { + InterceptOperation(next OperationHandler) OperationHandler + } + + // ResultInterceptor is called around each graphql operation result. This can be called many times for a single + // operation the case of subscriptions. + ResultInterceptor interface { + InterceptResult(ctx context.Context, next ResultHandler) *Response } // FieldInterceptor called around each field @@ -67,6 +72,7 @@ type ( InterceptField(ctx context.Context, next Resolver) (res interface{}, err error) } + // Transport provides support for different wire level encodings of graphql requests, eg Form, Get, Post, Websocket Transport interface { Supports(r *http.Request) bool Do(w http.ResponseWriter, r *http.Request, exec GraphExecutor) diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 6895a70dfa1..2dafd618a0f 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -2,7 +2,6 @@ package apollotracing import ( "context" - "fmt" "sync" "time" @@ -40,7 +39,7 @@ type ( } ) -var _ graphql.ResponseInterceptor = ApolloTracing{} +var _ graphql.ResultInterceptor = ApolloTracing{} var _ graphql.FieldInterceptor = ApolloTracing{} func New() graphql.HandlerPlugin { @@ -49,7 +48,7 @@ func New() graphql.HandlerPlugin { func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { rc := graphql.GetRequestContext(ctx) - td, ok := rc.Extensions["tracing"].(*TracingExtension) + td, ok := graphql.GetExtension(ctx, "tracing").(*TracingExtension) if !ok { panic("missing tracing extension") } @@ -76,39 +75,36 @@ func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver return next(ctx) } -func (a ApolloTracing) InterceptResponse(next graphql.Handler) graphql.Handler { - return func(ctx context.Context, writer graphql.Writer) { - rc := graphql.GetRequestContext(ctx) - - start := rc.Stats.OperationStart - - td := &TracingExtension{ - Version: 1, - StartTime: start, - Parsing: Span{ - StartOffset: rc.Stats.Parsing.Start.Sub(start), - Duration: rc.Stats.Parsing.End.Sub(rc.Stats.Parsing.Start), - }, - - Validation: Span{ - StartOffset: rc.Stats.Validation.Start.Sub(start), - Duration: rc.Stats.Validation.End.Sub(rc.Stats.Validation.Start), - }, - - Execution: struct { - Resolvers []ResolverExecution `json:"resolvers"` - }{}, - } - - if err := rc.RegisterExtension("tracing", td); err != nil { - panic(fmt.Errorf("unable to register extension: %s", err.Error())) - } - - next(ctx, func(status graphql.Status, response *graphql.Response) { - end := graphql.Now() - td.EndTime = end - td.Duration = end.Sub(start) - writer(status, response) - }) +func (a ApolloTracing) InterceptResult(ctx context.Context, next graphql.ResultHandler) *graphql.Response { + rc := graphql.GetRequestContext(ctx) + + start := rc.Stats.OperationStart + + td := &TracingExtension{ + Version: 1, + StartTime: start, + Parsing: Span{ + StartOffset: rc.Stats.Parsing.Start.Sub(start), + Duration: rc.Stats.Parsing.End.Sub(rc.Stats.Parsing.Start), + }, + + Validation: Span{ + StartOffset: rc.Stats.Validation.Start.Sub(start), + Duration: rc.Stats.Validation.End.Sub(rc.Stats.Validation.Start), + }, + + Execution: struct { + Resolvers []ResolverExecution `json:"resolvers"` + }{}, } + + graphql.RegisterExtension(ctx, "tracing", td) + + resp := next(ctx) + + end := graphql.Now() + td.EndTime = end + td.Duration = end.Sub(start) + + return resp } diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 5fcb1bcf464..a6db6d5426e 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -11,7 +11,8 @@ import ( ) type executor struct { - handler graphql.Handler + operationHandler graphql.OperationHandler + resultHandler graphql.ResultMiddleware responseMiddleware graphql.FieldMiddleware es graphql.ExecutableSchema requestParamMutators []graphql.RequestParameterMutator @@ -24,7 +25,10 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e e := executor{ es: es, } - e.handler = e.executableSchemaHandler + e.operationHandler = e.executableSchemaHandler + e.resultHandler = func(ctx context.Context, next graphql.ResultHandler) *graphql.Response { + return next(ctx) + } e.responseMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { return next(ctx) } @@ -32,9 +36,18 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e // this loop goes backwards so the first plugin is the outer most middleware and runs first. for i := len(plugins) - 1; i >= 0; i-- { p := plugins[i] - if p, ok := p.(graphql.ResponseInterceptor); ok { - previous := e.handler - e.handler = p.InterceptResponse(previous) + if p, ok := p.(graphql.OperationInterceptor); ok { + previous := e.operationHandler + e.operationHandler = p.InterceptOperation(previous) + } + + if p, ok := p.(graphql.ResultInterceptor); ok { + previous := e.resultHandler + e.resultHandler = func(ctx context.Context, next graphql.ResultHandler) *graphql.Response { + return p.InterceptResult(ctx, func(ctx context.Context) *graphql.Response { + return previous(ctx, next) + }) + } } if p, ok := p.(graphql.FieldInterceptor); ok { @@ -62,7 +75,7 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e } func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { - e.handler(ctx, writer) + e.operationHandler(ctx, writer) } func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { @@ -84,7 +97,6 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP RawQuery: params.Query, OperationName: params.OperationName, Variables: params.Variables, - Extensions: params.Extensions, } rc.Stats.OperationStart = graphql.GetStartTime(ctx) @@ -114,7 +126,16 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP return rc, nil } -// executableSchemaHandler is the inner most handler, it invokes the graph directly after all middleware +func (e *executor) write(ctx context.Context, resp *graphql.Response, writer graphql.Writer) { + resp.Extensions = graphql.GetExtensions(ctx) + + for _, err := range graphql.GetErrors(ctx) { + resp.Errors = append(resp.Errors, err) + } + writer(getStatus(resp), resp) +} + +// executableSchemaHandler is the inner most operation handler, it invokes the graph directly after all middleware // and sends responses to the transport so it can be returned to the client func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Writer) { rc := graphql.GetRequestContext(ctx) @@ -123,21 +144,37 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr switch op.Operation { case ast.Query: - resp := e.es.Query(ctx, op) - resp.Extensions = graphql.GetExtensions(ctx) - write(getStatus(resp), resp) - case ast.Mutation: - resp := e.es.Mutation(ctx, op) - resp.Extensions = graphql.GetExtensions(ctx) - write(getStatus(resp), resp) - case ast.Subscription: - resp := e.es.Subscription(ctx, op) + resCtx := graphql.WithResultContext(ctx) + resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { + return e.es.Query(ctx, op) + }) + e.write(resCtx, resp, write) - for w := resp(); w != nil; w = resp() { - w.Extensions = graphql.GetExtensions(ctx) + case ast.Mutation: + resCtx := graphql.WithResultContext(ctx) + resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { + return e.es.Mutation(ctx, op) + }) + e.write(resCtx, resp, write) - write(getStatus(w), w) + case ast.Subscription: + responses := e.es.Subscription(ctx, op) + for { + resCtx := graphql.WithResultContext(ctx) + resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { + resp := responses() + if resp == nil { + return nil + } + resp.Extensions = graphql.GetExtensions(ctx) + return resp + }) + if resp == nil { + break + } + e.write(resCtx, resp, write) } + default: write(graphql.StatusValidationError, graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 1d15d1ef82c..79d83e76365 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -34,8 +34,9 @@ func (s *Server) Use(plugin graphql.HandlerPlugin) { switch plugin.(type) { case graphql.RequestParameterMutator, graphql.RequestContextMutator, - graphql.ResponseInterceptor, - graphql.FieldInterceptor: + graphql.OperationInterceptor, + graphql.FieldInterceptor, + graphql.ResultInterceptor: s.plugins = append(s.plugins, plugin) s.exec = newExecutor(s.es, s.plugins) diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index 72ab650f947..1df1b8ca048 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -71,13 +71,13 @@ func TestServer(t *testing.T) { t.Run("invokes operation middleware in order", func(t *testing.T) { var calls []string - srv.Use(opFunc(func(next graphql.Handler) graphql.Handler { + srv.Use(opFunc(func(next graphql.OperationHandler) graphql.OperationHandler { return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "first") next(ctx, writer) } })) - srv.Use(opFunc(func(next graphql.Handler) graphql.Handler { + srv.Use(opFunc(func(next graphql.OperationHandler) graphql.OperationHandler { return func(ctx context.Context, writer graphql.Writer) { calls = append(calls, "second") next(ctx, writer) @@ -108,9 +108,9 @@ func TestServer(t *testing.T) { }) } -type opFunc func(next graphql.Handler) graphql.Handler +type opFunc func(next graphql.OperationHandler) graphql.OperationHandler -func (r opFunc) InterceptResponse(next graphql.Handler) graphql.Handler { +func (r opFunc) InterceptOperation(next graphql.OperationHandler) graphql.OperationHandler { return r(next) } diff --git a/graphql/result_context.go b/graphql/result_context.go new file mode 100644 index 00000000000..a7d56f07008 --- /dev/null +++ b/graphql/result_context.go @@ -0,0 +1,135 @@ +package graphql + +import ( + "context" + "fmt" + "sync" + + "github.com/vektah/gqlparser/gqlerror" +) + +type resultContext struct { + errors gqlerror.List + errorsMu sync.Mutex + + extensions map[string]interface{} + extensionsMu sync.Mutex +} + +var resultCtx key = "result_context" + +func getResultContext(ctx context.Context) *resultContext { + val, _ := ctx.Value(resultCtx).(*resultContext) + return val +} + +func WithResultContext(ctx context.Context) context.Context { + return context.WithValue(ctx, resultCtx, &resultContext{}) +} + +// AddErrorf writes a formatted error to the client, first passing it through the error presenter. +func AddErrorf(ctx context.Context, format string, args ...interface{}) { + c := getResultContext(ctx) + + c.errorsMu.Lock() + defer c.errorsMu.Unlock() + + c.errors = append(c.errors, GetRequestContext(ctx).ErrorPresenter(ctx, fmt.Errorf(format, args...))) +} + +// AddError sends an error to the client, first passing it through the error presenter. +func AddError(ctx context.Context, err error) { + c := getResultContext(ctx) + + c.errorsMu.Lock() + defer c.errorsMu.Unlock() + + c.errors = append(c.errors, GetRequestContext(ctx).ErrorPresenter(ctx, err)) +} + +// HasFieldError returns true if the given field has already errored +func HasFieldError(ctx context.Context, rctx *ResolverContext) bool { + c := getResultContext(ctx) + + c.errorsMu.Lock() + defer c.errorsMu.Unlock() + path := rctx.Path() + + for _, err := range c.errors { + if equalPath(err.Path, path) { + return true + } + } + return false +} + +// GetFieldErrors returns a list of errors that occurred in the given field +func GetFieldErrors(ctx context.Context, rctx *ResolverContext) gqlerror.List { + c := getResultContext(ctx) + + c.errorsMu.Lock() + defer c.errorsMu.Unlock() + path := rctx.Path() + + var errs gqlerror.List + for _, err := range c.errors { + if equalPath(err.Path, path) { + errs = append(errs, err) + } + } + return errs +} + +func GetErrors(ctx context.Context) gqlerror.List { + resCtx := getResultContext(ctx) + resCtx.errorsMu.Lock() + defer resCtx.errorsMu.Unlock() + + if len(resCtx.errors) == 0 { + return nil + } + + errs := resCtx.errors + cpy := make(gqlerror.List, len(errs)) + for i := range errs { + errCpy := *errs[i] + cpy[i] = &errCpy + } + return cpy +} + +// RegisterExtension allows you to add a new extension into the graphql response +func RegisterExtension(ctx context.Context, key string, value interface{}) { + c := getResultContext(ctx) + c.extensionsMu.Lock() + defer c.extensionsMu.Unlock() + + if c.extensions == nil { + c.extensions = make(map[string]interface{}) + } + + if _, ok := c.extensions[key]; ok { + panic(fmt.Errorf("extension already registered for key %s", key)) + } + + c.extensions[key] = value +} + +// GetExtensions returns any extensions registered in the current result context +func GetExtensions(ctx context.Context) map[string]interface{} { + ext := getResultContext(ctx).extensions + if ext == nil { + return map[string]interface{}{} + } + + return ext +} + +func GetExtension(ctx context.Context, name string) interface{} { + ext := getResultContext(ctx).extensions + if ext == nil { + return nil + } + + return ext[name] +} From 4a69bcd034ade82bacf6b71b4945f4917d2fdfc1 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 30 Oct 2019 17:11:21 +1100 Subject: [PATCH 14/53] Bring operation middleware inline with other handler interfaces --- graphql/context.go | 1 + graphql/handler.go | 27 ++++++++++++--------------- graphql/handler/executor.go | 12 +++++++----- graphql/handler/server_test.go | 22 +++++++++------------- 4 files changed, 29 insertions(+), 33 deletions(-) diff --git a/graphql/context.go b/graphql/context.go index b3c7cc73e1c..3262bb25f19 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -10,6 +10,7 @@ import ( type Resolver func(ctx context.Context) (res interface{}, err error) type ResultMiddleware func(ctx context.Context, next ResultHandler) *Response +type OperationMiddleware func(ctx context.Context, next OperationHandler, writer Writer) type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) type ComplexityLimitFunc func(ctx context.Context) int diff --git a/graphql/handler.go b/graphql/handler.go index c7fafe9af30..41613299010 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -28,22 +28,17 @@ type ( } // HandlerPlugin interface is entirely optional, see the list of possible hook points below - // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen before working with these - // +---REQUEST POST /graphql------------------------------------------------+ - // | | - // | ++OPERATION query OpName { viewer { name } }+------------------------+ | - // | | | | - // | | RESULT { "data": { "viewer": { "name": "bob" } } } | | - // | | | | - // | ++OPERATION subscription OpName2 { chat { message } }+---------------+ | - // | | | | - // | | RESULT { "data": { "chat": { "message": "hello" } } } | | - // | | | | - // | | RESULT { "data": { "chat": { "message": "byee" } } } | | - // | | | | + // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen + // before working with these + // + // +--- REQUEST POST /graphql --------------------------------------------+ + // | +- OPERATION query OpName { viewer { name } } -----------------------+ | + // | | RESULT { "data": { "viewer": { "name": "bob" } } } | | + // | +- OPERATION subscription OpName2 { chat { message } } --------------+ | + // | | RESULT { "data": { "chat": { "message": "hello" } } } | | + // | | RESULT { "data": { "chat": { "message": "byee" } } } | | // | +--------------------------------------------------------------------+ | // +------------------------------------------------------------------------+ - HandlerPlugin interface{} // RequestParameterMutator is called before creating a request context. allows manipulating the raw query @@ -57,8 +52,10 @@ type ( MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error } + // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once, + // for subscriptions it will be invoked multiple times. OperationInterceptor interface { - InterceptOperation(next OperationHandler) OperationHandler + InterceptOperation(ctx context.Context, next OperationHandler, writer Writer) } // ResultInterceptor is called around each graphql operation result. This can be called many times for a single diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index a6db6d5426e..6960728ecdf 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -11,7 +11,7 @@ import ( ) type executor struct { - operationHandler graphql.OperationHandler + operationMiddleware graphql.OperationHandler resultHandler graphql.ResultMiddleware responseMiddleware graphql.FieldMiddleware es graphql.ExecutableSchema @@ -25,7 +25,7 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e e := executor{ es: es, } - e.operationHandler = e.executableSchemaHandler + e.operationMiddleware = e.executableSchemaHandler e.resultHandler = func(ctx context.Context, next graphql.ResultHandler) *graphql.Response { return next(ctx) } @@ -37,8 +37,10 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e for i := len(plugins) - 1; i >= 0; i-- { p := plugins[i] if p, ok := p.(graphql.OperationInterceptor); ok { - previous := e.operationHandler - e.operationHandler = p.InterceptOperation(previous) + previous := e.operationMiddleware + e.operationMiddleware = func(ctx context.Context, writer graphql.Writer) { + p.InterceptOperation(ctx, previous, writer) + } } if p, ok := p.(graphql.ResultInterceptor); ok { @@ -75,7 +77,7 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e } func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { - e.operationHandler(ctx, writer) + e.operationMiddleware(ctx, writer) } func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index 1df1b8ca048..a678cd710b1 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -71,17 +71,13 @@ func TestServer(t *testing.T) { t.Run("invokes operation middleware in order", func(t *testing.T) { var calls []string - srv.Use(opFunc(func(next graphql.OperationHandler) graphql.OperationHandler { - return func(ctx context.Context, writer graphql.Writer) { - calls = append(calls, "first") - next(ctx, writer) - } + srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) { + calls = append(calls, "first") + next(ctx, writer) })) - srv.Use(opFunc(func(next graphql.OperationHandler) graphql.OperationHandler { - return func(ctx context.Context, writer graphql.Writer) { - calls = append(calls, "second") - next(ctx, writer) - } + srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) { + calls = append(calls, "second") + next(ctx, writer) })) resp := get(srv, "/foo?query={a}") @@ -108,10 +104,10 @@ func TestServer(t *testing.T) { }) } -type opFunc func(next graphql.OperationHandler) graphql.OperationHandler +type opFunc func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) -func (r opFunc) InterceptOperation(next graphql.OperationHandler) graphql.OperationHandler { - return r(next) +func (r opFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) { + r(ctx, next, writer) } type fieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) From 72c47c985f2727ab7d9dff7f6ebaf3614c44a507 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 10:21:06 +1100 Subject: [PATCH 15/53] rename result handler to response handler --- graphql/context.go | 2 +- ...{result_context.go => context_response.go} | 26 +++++++++---------- graphql/handler.go | 14 +++++----- graphql/handler/apollotracing/tracer.go | 4 +-- graphql/handler/executor.go | 14 +++++----- graphql/handler/server.go | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) rename graphql/{result_context.go => context_response.go} (82%) diff --git a/graphql/context.go b/graphql/context.go index 3262bb25f19..8528cb4b343 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -9,7 +9,7 @@ import ( ) type Resolver func(ctx context.Context) (res interface{}, err error) -type ResultMiddleware func(ctx context.Context, next ResultHandler) *Response +type ResultMiddleware func(ctx context.Context, next ResponseHandler) *Response type OperationMiddleware func(ctx context.Context, next OperationHandler, writer Writer) type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) type ComplexityLimitFunc func(ctx context.Context) int diff --git a/graphql/result_context.go b/graphql/context_response.go similarity index 82% rename from graphql/result_context.go rename to graphql/context_response.go index a7d56f07008..b838b3cd975 100644 --- a/graphql/result_context.go +++ b/graphql/context_response.go @@ -8,7 +8,7 @@ import ( "github.com/vektah/gqlparser/gqlerror" ) -type resultContext struct { +type responseContext struct { errors gqlerror.List errorsMu sync.Mutex @@ -18,18 +18,18 @@ type resultContext struct { var resultCtx key = "result_context" -func getResultContext(ctx context.Context) *resultContext { - val, _ := ctx.Value(resultCtx).(*resultContext) +func getResponseContext(ctx context.Context) *responseContext { + val, _ := ctx.Value(resultCtx).(*responseContext) return val } -func WithResultContext(ctx context.Context) context.Context { - return context.WithValue(ctx, resultCtx, &resultContext{}) +func WithResponseContext(ctx context.Context) context.Context { + return context.WithValue(ctx, resultCtx, &responseContext{}) } // AddErrorf writes a formatted error to the client, first passing it through the error presenter. func AddErrorf(ctx context.Context, format string, args ...interface{}) { - c := getResultContext(ctx) + c := getResponseContext(ctx) c.errorsMu.Lock() defer c.errorsMu.Unlock() @@ -39,7 +39,7 @@ func AddErrorf(ctx context.Context, format string, args ...interface{}) { // AddError sends an error to the client, first passing it through the error presenter. func AddError(ctx context.Context, err error) { - c := getResultContext(ctx) + c := getResponseContext(ctx) c.errorsMu.Lock() defer c.errorsMu.Unlock() @@ -49,7 +49,7 @@ func AddError(ctx context.Context, err error) { // HasFieldError returns true if the given field has already errored func HasFieldError(ctx context.Context, rctx *ResolverContext) bool { - c := getResultContext(ctx) + c := getResponseContext(ctx) c.errorsMu.Lock() defer c.errorsMu.Unlock() @@ -65,7 +65,7 @@ func HasFieldError(ctx context.Context, rctx *ResolverContext) bool { // GetFieldErrors returns a list of errors that occurred in the given field func GetFieldErrors(ctx context.Context, rctx *ResolverContext) gqlerror.List { - c := getResultContext(ctx) + c := getResponseContext(ctx) c.errorsMu.Lock() defer c.errorsMu.Unlock() @@ -81,7 +81,7 @@ func GetFieldErrors(ctx context.Context, rctx *ResolverContext) gqlerror.List { } func GetErrors(ctx context.Context) gqlerror.List { - resCtx := getResultContext(ctx) + resCtx := getResponseContext(ctx) resCtx.errorsMu.Lock() defer resCtx.errorsMu.Unlock() @@ -100,7 +100,7 @@ func GetErrors(ctx context.Context) gqlerror.List { // RegisterExtension allows you to add a new extension into the graphql response func RegisterExtension(ctx context.Context, key string, value interface{}) { - c := getResultContext(ctx) + c := getResponseContext(ctx) c.extensionsMu.Lock() defer c.extensionsMu.Unlock() @@ -117,7 +117,7 @@ func RegisterExtension(ctx context.Context, key string, value interface{}) { // GetExtensions returns any extensions registered in the current result context func GetExtensions(ctx context.Context) map[string]interface{} { - ext := getResultContext(ctx).extensions + ext := getResponseContext(ctx).extensions if ext == nil { return map[string]interface{}{} } @@ -126,7 +126,7 @@ func GetExtensions(ctx context.Context) map[string]interface{} { } func GetExtension(ctx context.Context, name string) interface{} { - ext := getResultContext(ctx).extensions + ext := getResponseContext(ctx).extensions if ext == nil { return nil } diff --git a/graphql/handler.go b/graphql/handler.go index 41613299010..36a70d5572d 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -10,7 +10,7 @@ import ( type ( OperationHandler func(ctx context.Context, writer Writer) - ResultHandler func(ctx context.Context) *Response + ResponseHandler func(ctx context.Context) *Response ResponseStream func() *Response Writer func(Status, *Response) Status int @@ -33,10 +33,10 @@ type ( // // +--- REQUEST POST /graphql --------------------------------------------+ // | +- OPERATION query OpName { viewer { name } } -----------------------+ | - // | | RESULT { "data": { "viewer": { "name": "bob" } } } | | + // | | RESPONSE { "data": { "viewer": { "name": "bob" } } } | | // | +- OPERATION subscription OpName2 { chat { message } } --------------+ | - // | | RESULT { "data": { "chat": { "message": "hello" } } } | | - // | | RESULT { "data": { "chat": { "message": "byee" } } } | | + // | | RESPONSE { "data": { "chat": { "message": "hello" } } } | | + // | | RESPONSE { "data": { "chat": { "message": "byee" } } } | | // | +--------------------------------------------------------------------+ | // +------------------------------------------------------------------------+ HandlerPlugin interface{} @@ -58,10 +58,10 @@ type ( InterceptOperation(ctx context.Context, next OperationHandler, writer Writer) } - // ResultInterceptor is called around each graphql operation result. This can be called many times for a single + // ResponseInterceptor is called around each graphql operation response. This can be called many times for a single // operation the case of subscriptions. - ResultInterceptor interface { - InterceptResult(ctx context.Context, next ResultHandler) *Response + ResponseInterceptor interface { + InterceptResponse(ctx context.Context, next ResponseHandler) *Response } // FieldInterceptor called around each field diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 2dafd618a0f..8373f017fcd 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -39,7 +39,7 @@ type ( } ) -var _ graphql.ResultInterceptor = ApolloTracing{} +var _ graphql.ResponseInterceptor = ApolloTracing{} var _ graphql.FieldInterceptor = ApolloTracing{} func New() graphql.HandlerPlugin { @@ -75,7 +75,7 @@ func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver return next(ctx) } -func (a ApolloTracing) InterceptResult(ctx context.Context, next graphql.ResultHandler) *graphql.Response { +func (a ApolloTracing) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { rc := graphql.GetRequestContext(ctx) start := rc.Stats.OperationStart diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 6960728ecdf..5105efb078d 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -26,7 +26,7 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e es: es, } e.operationMiddleware = e.executableSchemaHandler - e.resultHandler = func(ctx context.Context, next graphql.ResultHandler) *graphql.Response { + e.resultHandler = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { return next(ctx) } e.responseMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { @@ -43,10 +43,10 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e } } - if p, ok := p.(graphql.ResultInterceptor); ok { + if p, ok := p.(graphql.ResponseInterceptor); ok { previous := e.resultHandler - e.resultHandler = func(ctx context.Context, next graphql.ResultHandler) *graphql.Response { - return p.InterceptResult(ctx, func(ctx context.Context) *graphql.Response { + e.resultHandler = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + return p.InterceptResponse(ctx, func(ctx context.Context) *graphql.Response { return previous(ctx, next) }) } @@ -146,14 +146,14 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr switch op.Operation { case ast.Query: - resCtx := graphql.WithResultContext(ctx) + resCtx := graphql.WithResponseContext(ctx) resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { return e.es.Query(ctx, op) }) e.write(resCtx, resp, write) case ast.Mutation: - resCtx := graphql.WithResultContext(ctx) + resCtx := graphql.WithResponseContext(ctx) resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { return e.es.Mutation(ctx, op) }) @@ -162,7 +162,7 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr case ast.Subscription: responses := e.es.Subscription(ctx, op) for { - resCtx := graphql.WithResultContext(ctx) + resCtx := graphql.WithResponseContext(ctx) resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { resp := responses() if resp == nil { diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 79d83e76365..d99b13d6884 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -36,7 +36,7 @@ func (s *Server) Use(plugin graphql.HandlerPlugin) { graphql.RequestContextMutator, graphql.OperationInterceptor, graphql.FieldInterceptor, - graphql.ResultInterceptor: + graphql.ResponseInterceptor: s.plugins = append(s.plugins, plugin) s.exec = newExecutor(s.es, s.plugins) From 9d1d77e67df3fd2c75646af7b5de361b9cbe8482 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 11:25:17 +1100 Subject: [PATCH 16/53] split context.go into 3 files --- graphql/{context.go => context_request.go} | 91 +---------- graphql/context_request_test.go | 68 +++++++++ graphql/context_resolver.go | 78 ++++++++++ graphql/context_resolver_test.go | 33 ++++ graphql/context_response.go | 21 ++- graphql/context_response_test.go | 81 ++++++++++ graphql/context_test.go | 168 --------------------- graphql/error.go | 7 - graphql/handler.go | 16 +- graphql/handler/executor.go | 32 ++-- graphql/handler/server.go | 19 ++- handler/graphql.go | 3 - 12 files changed, 320 insertions(+), 297 deletions(-) rename graphql/{context.go => context_request.go} (54%) create mode 100644 graphql/context_request_test.go create mode 100644 graphql/context_resolver.go create mode 100644 graphql/context_resolver_test.go create mode 100644 graphql/context_response_test.go delete mode 100644 graphql/context_test.go diff --git a/graphql/context.go b/graphql/context_request.go similarity index 54% rename from graphql/context.go rename to graphql/context_request.go index 8528cb4b343..71f82394de5 100644 --- a/graphql/context.go +++ b/graphql/context_request.go @@ -8,12 +8,6 @@ import ( "github.com/vektah/gqlparser/gqlerror" ) -type Resolver func(ctx context.Context) (res interface{}, err error) -type ResultMiddleware func(ctx context.Context, next ResponseHandler) *Response -type OperationMiddleware func(ctx context.Context, next OperationHandler, writer Writer) -type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) -type ComplexityLimitFunc func(ctx context.Context) int - type RequestContext struct { RawQuery string Variables map[string]interface{} @@ -24,17 +18,15 @@ type RequestContext struct { OperationComplexity int DisableIntrospection bool - // ErrorPresenter will be used to generate the error - // message from errors given to Error(). - ErrorPresenter ErrorPresenterFunc Recover RecoverFunc ResolverMiddleware FieldMiddleware DirectiveMiddleware FieldMiddleware - RequestMiddleware OperationInterceptor Stats Stats } +const requestCtx key = "request_context" + func (rc *RequestContext) Validate(ctx context.Context) error { if rc.Doc == nil { return errors.New("field 'Doc' must be required") @@ -54,9 +46,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { if rc.Recover == nil { rc.Recover = DefaultRecover } - if rc.ErrorPresenter == nil { - rc.ErrorPresenter = DefaultErrorPresenter - } if rc.ComplexityLimit < 0 { return errors.New("field 'ComplexityLimit' value must be 0 or more") } @@ -64,21 +53,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { return nil } -func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { - return next(ctx) -} - -func DefaultDirectiveMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { - return next(ctx) -} - -type key string - -const ( - requestCtx key = "request_context" - resolverCtx key = "resolver_context" -) - func GetRequestContext(ctx context.Context) *RequestContext { if val, ok := ctx.Value(requestCtx).(*RequestContext); ok { return val @@ -90,53 +64,6 @@ func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context return context.WithValue(ctx, requestCtx, rc) } -type ResolverContext struct { - Parent *ResolverContext - // The name of the type this field belongs to - Object string - // These are the args after processing, they can be mutated in middleware to change what the resolver will get. - Args map[string]interface{} - // The raw field - Field CollectedField - // The index of array in path. - Index *int - // The result object of resolver - Result interface{} - // IsMethod indicates if the resolver is a method - IsMethod bool -} - -func (r *ResolverContext) Path() []interface{} { - var path []interface{} - for it := r; it != nil; it = it.Parent { - if it.Index != nil { - path = append(path, *it.Index) - } else if it.Field.Field != nil { - path = append(path, it.Field.Alias) - } - } - - // because we are walking up the chain, all the elements are backwards, do an inplace flip. - for i := len(path)/2 - 1; i >= 0; i-- { - opp := len(path) - 1 - i - path[i], path[opp] = path[opp], path[i] - } - - return path -} - -func GetResolverContext(ctx context.Context) *ResolverContext { - if val, ok := ctx.Value(resolverCtx).(*ResolverContext); ok { - return val - } - return nil -} - -func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context { - rc.Parent = GetResolverContext(ctx) - return context.WithValue(ctx, resolverCtx, rc) -} - // This is just a convenient wrapper method for CollectFields func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField { resctx := GetResolverContext(ctx) @@ -173,20 +100,6 @@ func (c *RequestContext) Error(ctx context.Context, err error) { AddError(ctx, err) } -func equalPath(a []interface{}, b []interface{}) bool { - if len(a) != len(b) { - return false - } - - for i := 0; i < len(a); i++ { - if a[i] != b[i] { - return false - } - } - - return true -} - var _ RequestContextMutator = ComplexityLimitFunc(nil) func (c ComplexityLimitFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { diff --git a/graphql/context_request_test.go b/graphql/context_request_test.go new file mode 100644 index 00000000000..be01cc4309f --- /dev/null +++ b/graphql/context_request_test.go @@ -0,0 +1,68 @@ +package graphql + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/ast" +) + +func TestGetRequestContext(t *testing.T) { + require.Nil(t, GetRequestContext(context.Background())) + + rc := &RequestContext{} + require.Equal(t, rc, GetRequestContext(WithRequestContext(context.Background(), rc))) +} + +func TestCollectAllFields(t *testing.T) { + t.Run("collect fields", func(t *testing.T) { + ctx := testContext(ast.SelectionSet{ + &ast.Field{ + Name: "field", + }, + }) + s := CollectAllFields(ctx) + require.Equal(t, []string{"field"}, s) + }) + + t.Run("unique field names", func(t *testing.T) { + ctx := testContext(ast.SelectionSet{ + &ast.Field{ + Name: "field", + }, + &ast.Field{ + Name: "field", + Alias: "field alias", + }, + }) + s := CollectAllFields(ctx) + require.Equal(t, []string{"field"}, s) + }) + + t.Run("collect fragments", func(t *testing.T) { + ctx := testContext(ast.SelectionSet{ + &ast.Field{ + Name: "fieldA", + }, + &ast.InlineFragment{ + TypeCondition: "ExampleTypeA", + SelectionSet: ast.SelectionSet{ + &ast.Field{ + Name: "fieldA", + }, + }, + }, + &ast.InlineFragment{ + TypeCondition: "ExampleTypeB", + SelectionSet: ast.SelectionSet{ + &ast.Field{ + Name: "fieldB", + }, + }, + }, + }) + s := CollectAllFields(ctx) + require.Equal(t, []string{"fieldA", "fieldB"}, s) + }) +} diff --git a/graphql/context_resolver.go b/graphql/context_resolver.go new file mode 100644 index 00000000000..0a505c1fb3a --- /dev/null +++ b/graphql/context_resolver.go @@ -0,0 +1,78 @@ +package graphql + +import ( + "context" +) + +func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { + return next(ctx) +} + +func DefaultDirectiveMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { + return next(ctx) +} + +type key string + +const resolverCtx key = "resolver_context" + +type ResolverContext struct { + Parent *ResolverContext + // The name of the type this field belongs to + Object string + // These are the args after processing, they can be mutated in middleware to change what the resolver will get. + Args map[string]interface{} + // The raw field + Field CollectedField + // The index of array in path. + Index *int + // The result object of resolver + Result interface{} + // IsMethod indicates if the resolver is a method + IsMethod bool +} + +func (r *ResolverContext) Path() []interface{} { + var path []interface{} + for it := r; it != nil; it = it.Parent { + if it.Index != nil { + path = append(path, *it.Index) + } else if it.Field.Field != nil { + path = append(path, it.Field.Alias) + } + } + + // because we are walking up the chain, all the elements are backwards, do an inplace flip. + for i := len(path)/2 - 1; i >= 0; i-- { + opp := len(path) - 1 - i + path[i], path[opp] = path[opp], path[i] + } + + return path +} + +func GetResolverContext(ctx context.Context) *ResolverContext { + if val, ok := ctx.Value(resolverCtx).(*ResolverContext); ok { + return val + } + return nil +} + +func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context { + rc.Parent = GetResolverContext(ctx) + return context.WithValue(ctx, resolverCtx, rc) +} + +func equalPath(a []interface{}, b []interface{}) bool { + if len(a) != len(b) { + return false + } + + for i := 0; i < len(a); i++ { + if a[i] != b[i] { + return false + } + } + + return true +} diff --git a/graphql/context_resolver_test.go b/graphql/context_resolver_test.go new file mode 100644 index 00000000000..cd83661a8c1 --- /dev/null +++ b/graphql/context_resolver_test.go @@ -0,0 +1,33 @@ +package graphql + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/ast" +) + +func TestGetResolverContext(t *testing.T) { + require.Nil(t, GetResolverContext(context.Background())) + + rc := &ResolverContext{} + require.Equal(t, rc, GetResolverContext(WithResolverContext(context.Background(), rc))) +} + +func testContext(sel ast.SelectionSet) context.Context { + + ctx := context.Background() + + rqCtx := &RequestContext{} + ctx = WithRequestContext(ctx, rqCtx) + + root := &ResolverContext{ + Field: CollectedField{ + Selections: sel, + }, + } + ctx = WithResolverContext(ctx, root) + + return ctx +} diff --git a/graphql/context_response.go b/graphql/context_response.go index b838b3cd975..ae0910c0dbc 100644 --- a/graphql/context_response.go +++ b/graphql/context_response.go @@ -9,6 +9,9 @@ import ( ) type responseContext struct { + errorPresenter ErrorPresenterFunc + recover RecoverFunc + errors gqlerror.List errorsMu sync.Mutex @@ -16,15 +19,18 @@ type responseContext struct { extensionsMu sync.Mutex } -var resultCtx key = "result_context" +const resultCtx key = "result_context" func getResponseContext(ctx context.Context) *responseContext { val, _ := ctx.Value(resultCtx).(*responseContext) return val } -func WithResponseContext(ctx context.Context) context.Context { - return context.WithValue(ctx, resultCtx, &responseContext{}) +func WithResponseContext(ctx context.Context, presenterFunc ErrorPresenterFunc, recoverFunc RecoverFunc) context.Context { + return context.WithValue(ctx, resultCtx, &responseContext{ + errorPresenter: presenterFunc, + recover: recoverFunc, + }) } // AddErrorf writes a formatted error to the client, first passing it through the error presenter. @@ -34,7 +40,7 @@ func AddErrorf(ctx context.Context, format string, args ...interface{}) { c.errorsMu.Lock() defer c.errorsMu.Unlock() - c.errors = append(c.errors, GetRequestContext(ctx).ErrorPresenter(ctx, fmt.Errorf(format, args...))) + c.errors = append(c.errors, c.errorPresenter(ctx, fmt.Errorf(format, args...))) } // AddError sends an error to the client, first passing it through the error presenter. @@ -44,7 +50,12 @@ func AddError(ctx context.Context, err error) { c.errorsMu.Lock() defer c.errorsMu.Unlock() - c.errors = append(c.errors, GetRequestContext(ctx).ErrorPresenter(ctx, err)) + c.errors = append(c.errors, c.errorPresenter(ctx, err)) +} + +func Recover(ctx context.Context, err interface{}) (userMessage error) { + c := getResponseContext(ctx) + return c.recover(ctx, err) } // HasFieldError returns true if the given field has already errored diff --git a/graphql/context_response_test.go b/graphql/context_response_test.go new file mode 100644 index 00000000000..a4e16cc86d7 --- /dev/null +++ b/graphql/context_response_test.go @@ -0,0 +1,81 @@ +package graphql + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/ast" + "github.com/vektah/gqlparser/gqlerror" +) + +func TestAddError(t *testing.T) { + ctx := WithResponseContext(context.Background(), DefaultErrorPresenter, nil) + + root := &ResolverContext{ + Field: CollectedField{ + Field: &ast.Field{ + Alias: "foo", + }, + }, + } + ctx = WithResolverContext(ctx, root) + AddError(ctx, errors.New("foo1")) + AddError(ctx, errors.New("foo2")) + + index := 1 + child := &ResolverContext{ + Parent: root, + Index: &index, + } + userProvidedPath := &ResolverContext{ + Parent: child, + Field: CollectedField{ + Field: &ast.Field{ + Alias: "works", + }, + }, + } + + ctx = WithResolverContext(ctx, child) + AddError(ctx, errors.New("bar")) + AddError(ctx, &gqlerror.Error{ + Message: "foo3", + Path: append(child.Path(), "works"), + }) + + specs := []struct { + Name string + RCtx *ResolverContext + Messages []string + }{ + { + Name: "with root ResolverContext", + RCtx: root, + Messages: []string{"foo1", "foo2"}, + }, + { + Name: "with child ResolverContext", + RCtx: child, + Messages: []string{"bar"}, + }, + { + Name: "with user provided path", + RCtx: userProvidedPath, + Messages: []string{"foo3"}, + }, + } + + for _, spec := range specs { + t.Run(spec.Name, func(t *testing.T) { + errList := GetFieldErrors(ctx, spec.RCtx) + require.Len(t, errList, len(spec.Messages)) + + for idx, err := range errList { + assert.Equal(t, spec.Messages[idx], err.Message) + } + }) + } +} diff --git a/graphql/context_test.go b/graphql/context_test.go deleted file mode 100644 index 85387e930df..00000000000 --- a/graphql/context_test.go +++ /dev/null @@ -1,168 +0,0 @@ -package graphql - -import ( - "context" - "errors" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser/ast" - "github.com/vektah/gqlparser/gqlerror" -) - -func TestRequestContext_GetErrors(t *testing.T) { - c := &RequestContext{ - ErrorPresenter: DefaultErrorPresenter, - } - - ctx := context.Background() - - root := &ResolverContext{ - Field: CollectedField{ - Field: &ast.Field{ - Alias: "foo", - }, - }, - } - ctx = WithResolverContext(ctx, root) - c.Error(ctx, errors.New("foo1")) - c.Error(ctx, errors.New("foo2")) - - index := 1 - child := &ResolverContext{ - Parent: root, - Index: &index, - } - userProvidedPath := &ResolverContext{ - Parent: child, - Field: CollectedField{ - Field: &ast.Field{ - Alias: "works", - }, - }, - } - - ctx = WithResolverContext(ctx, child) - c.Error(ctx, errors.New("bar")) - c.Error(ctx, &gqlerror.Error{ - Message: "foo3", - Path: append(child.Path(), "works"), - }) - - specs := []struct { - Name string - RCtx *ResolverContext - Messages []string - }{ - { - Name: "with root ResolverContext", - RCtx: root, - Messages: []string{"foo1", "foo2"}, - }, - { - Name: "with child ResolverContext", - RCtx: child, - Messages: []string{"bar"}, - }, - { - Name: "with user provided path", - RCtx: userProvidedPath, - Messages: []string{"foo3"}, - }, - } - - for _, spec := range specs { - t.Run(spec.Name, func(t *testing.T) { - errList := c.GetErrors(spec.RCtx) - if assert.Equal(t, len(spec.Messages), len(errList)) { - for idx, err := range errList { - assert.Equal(t, spec.Messages[idx], err.Message) - } - } - }) - } -} - -func TestGetRequestContext(t *testing.T) { - require.Nil(t, GetRequestContext(context.Background())) - - rc := &RequestContext{} - require.Equal(t, rc, GetRequestContext(WithRequestContext(context.Background(), rc))) -} - -func TestGetResolverContext(t *testing.T) { - require.Nil(t, GetResolverContext(context.Background())) - - rc := &ResolverContext{} - require.Equal(t, rc, GetResolverContext(WithResolverContext(context.Background(), rc))) -} - -func testContext(sel ast.SelectionSet) context.Context { - - ctx := context.Background() - - rqCtx := &RequestContext{} - ctx = WithRequestContext(ctx, rqCtx) - - root := &ResolverContext{ - Field: CollectedField{ - Selections: sel, - }, - } - ctx = WithResolverContext(ctx, root) - - return ctx -} - -func TestCollectAllFields(t *testing.T) { - t.Run("collect fields", func(t *testing.T) { - ctx := testContext(ast.SelectionSet{ - &ast.Field{ - Name: "field", - }, - }) - s := CollectAllFields(ctx) - require.Equal(t, []string{"field"}, s) - }) - - t.Run("unique field names", func(t *testing.T) { - ctx := testContext(ast.SelectionSet{ - &ast.Field{ - Name: "field", - }, - &ast.Field{ - Name: "field", - Alias: "field alias", - }, - }) - s := CollectAllFields(ctx) - require.Equal(t, []string{"field"}, s) - }) - - t.Run("collect fragments", func(t *testing.T) { - ctx := testContext(ast.SelectionSet{ - &ast.Field{ - Name: "fieldA", - }, - &ast.InlineFragment{ - TypeCondition: "ExampleTypeA", - SelectionSet: ast.SelectionSet{ - &ast.Field{ - Name: "fieldA", - }, - }, - }, - &ast.InlineFragment{ - TypeCondition: "ExampleTypeB", - SelectionSet: ast.SelectionSet{ - &ast.Field{ - Name: "fieldB", - }, - }, - }, - }) - s := CollectAllFields(ctx) - require.Equal(t, []string{"fieldA", "fieldB"}, s) - }) -} diff --git a/graphql/error.go b/graphql/error.go index 7d00ade2a5b..af8b4ce4088 100644 --- a/graphql/error.go +++ b/graphql/error.go @@ -31,10 +31,3 @@ func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { Extensions: extensions, } } - -var _ RequestContextMutator = ErrorPresenterFunc(nil) - -func (f ErrorPresenterFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { - rc.ErrorPresenter = f - return nil -} diff --git a/graphql/handler.go b/graphql/handler.go index 36a70d5572d..4726570da06 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -9,11 +9,15 @@ import ( ) type ( - OperationHandler func(ctx context.Context, writer Writer) - ResponseHandler func(ctx context.Context) *Response - ResponseStream func() *Response - Writer func(Status, *Response) - Status int + Resolver func(ctx context.Context) (res interface{}, err error) + Writer func(Status, *Response) + OperationMiddleware func(ctx context.Context, next OperationHandler, writer Writer) + OperationHandler func(ctx context.Context, writer Writer) + ResponseHandler func(ctx context.Context) *Response + ResponseStream func() *Response + ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response + FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) + ComplexityLimitFunc func(ctx context.Context) int RawParams struct { Query string `json:"query"` @@ -76,6 +80,8 @@ type ( } ) +type Status int + const ( StatusOk Status = iota StatusParseError diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 5105efb078d..eba9714da2a 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -12,18 +12,18 @@ import ( type executor struct { operationMiddleware graphql.OperationHandler - resultHandler graphql.ResultMiddleware + resultHandler graphql.ResponseMiddleware responseMiddleware graphql.FieldMiddleware - es graphql.ExecutableSchema requestParamMutators []graphql.RequestParameterMutator requestContextMutators []graphql.RequestContextMutator + server *Server } var _ graphql.GraphExecutor = executor{} -func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) executor { +func newExecutor(s *Server) executor { e := executor{ - es: es, + server: s, } e.operationMiddleware = e.executableSchemaHandler e.resultHandler = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { @@ -34,8 +34,8 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e } // this loop goes backwards so the first plugin is the outer most middleware and runs first. - for i := len(plugins) - 1; i >= 0; i-- { - p := plugins[i] + for i := len(s.plugins) - 1; i >= 0; i-- { + p := s.plugins[i] if p, ok := p.(graphql.OperationInterceptor); ok { previous := e.operationMiddleware e.operationMiddleware = func(ctx context.Context, writer graphql.Writer) { @@ -62,7 +62,7 @@ func newExecutor(es graphql.ExecutableSchema, plugins []graphql.HandlerPlugin) e } } - for _, p := range plugins { + for _, p := range s.plugins { if p, ok := p.(graphql.RequestParameterMutator); ok { e.requestParamMutators = append(e.requestParamMutators, p) } @@ -92,9 +92,7 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP rc := &graphql.RequestContext{ DisableIntrospection: true, Recover: graphql.DefaultRecover, - ErrorPresenter: graphql.DefaultErrorPresenter, ResolverMiddleware: e.responseMiddleware, - RequestMiddleware: nil, ComplexityLimit: 0, RawQuery: params.Query, OperationName: params.OperationName, @@ -112,7 +110,7 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP return nil, listErr } - vars, err := validator.VariableValues(e.es.Schema(), op, rc.Variables) + vars, err := validator.VariableValues(e.server.es.Schema(), op, rc.Variables) if err != nil { return nil, gqlerror.List{err} } @@ -146,23 +144,23 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr switch op.Operation { case ast.Query: - resCtx := graphql.WithResponseContext(ctx) + resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { - return e.es.Query(ctx, op) + return e.server.es.Query(ctx, op) }) e.write(resCtx, resp, write) case ast.Mutation: - resCtx := graphql.WithResponseContext(ctx) + resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { - return e.es.Mutation(ctx, op) + return e.server.es.Mutation(ctx, op) }) e.write(resCtx, resp, write) case ast.Subscription: - responses := e.es.Subscription(ctx, op) + responses := e.server.es.Subscription(ctx, op) for { - resCtx := graphql.WithResponseContext(ctx) + resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { resp := responses() if resp == nil { @@ -196,7 +194,7 @@ func (e executor) validateOperation(ctx context.Context, rc *graphql.RequestCont rc.Stats.Validation.End = graphql.Now() }() - listErr := validator.Validate(e.es.Schema(), rc.Doc) + listErr := validator.Validate(e.server.es.Schema(), rc.Doc) if len(listErr) != 0 { return ctx, nil, listErr } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index d99b13d6884..03ccae9dfbd 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -15,14 +15,19 @@ type ( transports []graphql.Transport plugins []graphql.HandlerPlugin exec executor + + errorPresenter graphql.ErrorPresenterFunc + recoverFunc graphql.RecoverFunc } ) func New(es graphql.ExecutableSchema) *Server { s := &Server{ - es: es, + es: es, + errorPresenter: graphql.DefaultErrorPresenter, + recoverFunc: graphql.DefaultRecover, } - s.exec = newExecutor(s.es, s.plugins) + s.exec = newExecutor(s) return s } @@ -30,6 +35,14 @@ func (s *Server) AddTransport(transport graphql.Transport) { s.transports = append(s.transports, transport) } +func (s *Server) SetErrorPresenter(f graphql.ErrorPresenterFunc) { + s.errorPresenter = f +} + +func (s *Server) SetRecoverFunc(f graphql.RecoverFunc) { + s.recoverFunc = f +} + func (s *Server) Use(plugin graphql.HandlerPlugin) { switch plugin.(type) { case graphql.RequestParameterMutator, @@ -38,7 +51,7 @@ func (s *Server) Use(plugin graphql.HandlerPlugin) { graphql.FieldInterceptor, graphql.ResponseInterceptor: s.plugins = append(s.plugins, plugin) - s.exec = newExecutor(s.es, s.plugins) + s.exec = newExecutor(s) default: panic(fmt.Errorf("cannot Use %T as a gqlgen handler plugin because it does not implement any plugin hooks", plugin)) diff --git a/handler/graphql.go b/handler/graphql.go index 8ab912eb573..e9e3af930fd 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -66,10 +66,7 @@ func (c *Config) newRequestContext(ctx context.Context, es graphql.ExecutableSch OperationName: operationName, DisableIntrospection: c.disableIntrospection, Recover: c.recover, - ErrorPresenter: c.errorPresenter, ResolverMiddleware: c.resolverHook, - RequestMiddleware: c.requestHook, - Tracer: c.tracer, ComplexityLimit: c.complexityLimit, } if reqCtx.ComplexityLimit > 0 || c.complexityLimitFunc != nil { From a70e93bcae24130ef3746d89afa48b23e96f4787 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 11:40:25 +1100 Subject: [PATCH 17/53] consistently name transports --- graphql/handler/apollotracing/tracer_test.go | 2 +- graphql/handler/server_test.go | 2 +- graphql/handler/transport/http_get.go | 10 +++--- .../transport/{jsonpost.go => http_post.go} | 10 +++--- .../{jsonpost_test.go => http_post_test.go} | 4 +-- handler/graphql_test.go | 34 ------------------- 6 files changed, 16 insertions(+), 46 deletions(-) rename graphql/handler/transport/{jsonpost.go => http_post.go} (79%) rename graphql/handler/transport/{jsonpost_test.go => http_post_test.go} (98%) diff --git a/graphql/handler/apollotracing/tracer_test.go b/graphql/handler/apollotracing/tracer_test.go index 140aaaad194..ab9dbdc8e18 100644 --- a/graphql/handler/apollotracing/tracer_test.go +++ b/graphql/handler/apollotracing/tracer_test.go @@ -66,7 +66,7 @@ func TestApolloTracing(t *testing.T) { }, } h := handler.New(es) - h.AddTransport(transport.JsonPostTransport{}) + h.AddTransport(transport.POST{}) h.Use(apollotracing.New()) resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index a678cd710b1..43e69fb9059 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -43,7 +43,7 @@ func TestServer(t *testing.T) { }, } srv := New(es) - srv.AddTransport(&transport.HTTPGet{}) + srv.AddTransport(&transport.GET{}) t.Run("returns an error if no transport matches", func(t *testing.T) { resp := post(srv, "/foo", "application/json") diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 8ba3603bbd7..f7d9ac48410 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -11,11 +11,13 @@ import ( "github.com/99designs/gqlgen/graphql" ) -type HTTPGet struct{} +// GET implements the GET side of the default HTTP transport +// defined in https://github.com/APIs-guru/graphql-over-http#get +type GET struct{} -var _ graphql.Transport = HTTPGet{} +var _ graphql.Transport = GET{} -func (H HTTPGet) Supports(r *http.Request) bool { +func (H GET) Supports(r *http.Request) bool { if r.Header.Get("Upgrade") != "" { return false } @@ -23,7 +25,7 @@ func (H HTTPGet) Supports(r *http.Request) bool { return r.Method == "GET" } -func (H HTTPGet) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { +func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { raw := &graphql.RawParams{ Query: r.URL.Query().Get("query"), OperationName: r.URL.Query().Get("operationName"), diff --git a/graphql/handler/transport/jsonpost.go b/graphql/handler/transport/http_post.go similarity index 79% rename from graphql/handler/transport/jsonpost.go rename to graphql/handler/transport/http_post.go index 342a4b5ead4..930b621d90a 100644 --- a/graphql/handler/transport/jsonpost.go +++ b/graphql/handler/transport/http_post.go @@ -8,11 +8,13 @@ import ( "github.com/99designs/gqlgen/graphql" ) -type JsonPostTransport struct{} +// POST implements the POST side of the default HTTP transport +// defined in https://github.com/APIs-guru/graphql-over-http#post +type POST struct{} -var _ graphql.Transport = JsonPostTransport{} +var _ graphql.Transport = POST{} -func (H JsonPostTransport) Supports(r *http.Request) bool { +func (H POST) Supports(r *http.Request) bool { if r.Header.Get("Upgrade") != "" { return false } @@ -25,7 +27,7 @@ func (H JsonPostTransport) Supports(r *http.Request) bool { return r.Method == "POST" && mediaType == "application/json" } -func (H JsonPostTransport) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { +func (H POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { w.Header().Set("Content-Type", "application/json") write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { diff --git a/graphql/handler/transport/jsonpost_test.go b/graphql/handler/transport/http_post_test.go similarity index 98% rename from graphql/handler/transport/jsonpost_test.go rename to graphql/handler/transport/http_post_test.go index 6f5313f851a..ad075e29423 100644 --- a/graphql/handler/transport/jsonpost_test.go +++ b/graphql/handler/transport/http_post_test.go @@ -16,7 +16,7 @@ import ( "github.com/vektah/gqlparser/ast" ) -func TestJsonPost(t *testing.T) { +func TestPOST(t *testing.T) { es := &graphql.ExecutableSchemaMock{ QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { return &graphql.Response{Data: []byte(`{"name":"test"}`)} @@ -36,7 +36,7 @@ func TestJsonPost(t *testing.T) { }, } h := handler.New(es) - h.AddTransport(transport.JsonPostTransport{}) + h.AddTransport(transport.POST{}) t.Run("success", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) diff --git a/handler/graphql_test.go b/handler/graphql_test.go index 96ac4924b5d..503d244450d 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -20,40 +20,6 @@ import ( "github.com/vektah/gqlparser/ast" ) -func TestHandlerGET(t *testing.T) { - h := GraphQL(&executableSchemaStub{}) - - t.Run("success", func(t *testing.T) { - resp := doRequest(h, "GET", "/graphql?query={me{name}}", ``) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - - t.Run("decode failure", func(t *testing.T) { - resp := doRequest(h, "GET", "/graphql?query=me{id}&variables=notjson", "") - assert.Equal(t, http.StatusBadRequest, resp.Code) - assert.Equal(t, `{"errors":[{"message":"variables could not be decoded"}],"data":null}`, resp.Body.String()) - }) - - t.Run("invalid variable", func(t *testing.T) { - resp := doRequest(h, "GET", `/graphql?query=query($id:Int!){user(id:$id){name}}&variables={"id":false}`, "") - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) - }) - - t.Run("parse failure", func(t *testing.T) { - resp := doRequest(h, "GET", "/graphql?query=!", "") - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, resp.Body.String()) - }) - - t.Run("no mutations", func(t *testing.T) { - resp := doRequest(h, "GET", "/graphql?query=mutation{me{name}}", "") - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) - }) -} - func TestHandlerOptions(t *testing.T) { h := GraphQL(&executableSchemaStub{}) From 64cfc9add38004e8741fbe3bdd5a247c61718d80 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 12:58:56 +1100 Subject: [PATCH 18/53] extract shared handler test server stubs --- graphql/handler/apollotracing/tracer_test.go | 64 ++----------- graphql/handler/server_test.go | 54 +++-------- graphql/handler/testserver/testserver.go | 99 ++++++++++++++++++++ graphql/handler/transport/http_get.go | 7 +- graphql/handler/transport/http_get_test.go | 45 +++++++++ graphql/handler/transport/http_post_test.go | 40 ++------ graphql/handler/transport/websocket.go | 20 ++-- graphql/handler/transport/websocket_test.go | 88 +++++------------ 8 files changed, 214 insertions(+), 203 deletions(-) create mode 100644 graphql/handler/testserver/testserver.go create mode 100644 graphql/handler/transport/http_get_test.go diff --git a/graphql/handler/apollotracing/tracer_test.go b/graphql/handler/apollotracing/tracer_test.go index ab9dbdc8e18..f0622d471a1 100644 --- a/graphql/handler/apollotracing/tracer_test.go +++ b/graphql/handler/apollotracing/tracer_test.go @@ -1,76 +1,26 @@ package apollotracing_test import ( - "context" "encoding/json" "net/http" "net/http/httptest" "strings" "testing" - "time" - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/handler/apollotracing" + "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser" - "github.com/vektah/gqlparser/ast" ) -// todo: extract out common code for testing handler plugins without requiring a codegenned server. func TestApolloTracing(t *testing.T) { - now := time.Unix(0, 0) - - graphql.Now = func() time.Time { - defer func() { - now = now.Add(100 * time.Nanosecond) - }() - return now - } - - schema := gqlparser.MustLoadSchema(&ast.Source{Input: ` - schema { query: Query } - type Query { - me: User! - user(id: Int): User! - } - type User { name: String! } - `}) - - es := &graphql.ExecutableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - // Field execution happens inside the generated code, we want just enough to test against right now. - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Object: "Query", - Field: graphql.CollectedField{ - Field: &ast.Field{ - Name: "me", - Alias: "me", - Definition: schema.Types["Query"].Fields.ForName("me"), - }, - }, - }) - res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { - return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil - }) - require.NoError(t, err) - return res.(*graphql.Response) - }, - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") - }, - SchemaFunc: func() *ast.Schema { - return schema - }, - } - h := handler.New(es) + h := testserver.New() h.AddTransport(transport.POST{}) h.Use(apollotracing.New()) - resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) var respData struct { Extensions struct { Tracing apollotracing.TracingExtension `json:"tracing"` @@ -94,10 +44,10 @@ func TestApolloTracing(t *testing.T) { require.EqualValues(t, 500, tracing.Execution.Resolvers[0].StartOffset) require.EqualValues(t, 100, tracing.Execution.Resolvers[0].Duration) - require.EqualValues(t, []interface{}{"me"}, tracing.Execution.Resolvers[0].Path) + require.EqualValues(t, []interface{}{"name"}, tracing.Execution.Resolvers[0].Path) require.EqualValues(t, "Query", tracing.Execution.Resolvers[0].ParentType) - require.EqualValues(t, "me", tracing.Execution.Resolvers[0].FieldName) - require.EqualValues(t, "User!", tracing.Execution.Resolvers[0].ReturnType) + require.EqualValues(t, "name", tracing.Execution.Resolvers[0].FieldName) + require.EqualValues(t, "String!", tracing.Execution.Resolvers[0].ReturnType) } diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index 43e69fb9059..fe8ab220871 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -1,4 +1,4 @@ -package handler +package handler_test import ( "context" @@ -8,41 +8,13 @@ import ( "testing" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser/ast" ) func TestServer(t *testing.T) { - es := &graphql.ExecutableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - // Field execution happens inside the generated code, we want just enough to test against right now. - res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { - return &graphql.Response{Data: []byte(`"query resp"`)}, nil - }) - require.NoError(t, err) - - return res.(*graphql.Response) - }, - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return &graphql.Response{Data: []byte(`"mutation resp"`)} - }, - SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - called := 0 - return func() *graphql.Response { - called++ - if called > 2 { - return nil - } - return &graphql.Response{Data: []byte(`"subscription resp"`)} - } - }, - SchemaFunc: func() *ast.Schema { - return &ast.Schema{} - }, - } - srv := New(es) + srv := testserver.New() srv.AddTransport(&transport.GET{}) t.Run("returns an error if no transport matches", func(t *testing.T) { @@ -52,20 +24,20 @@ func TestServer(t *testing.T) { }) t.Run("calls query on executable schema", func(t *testing.T) { - resp := get(srv, "/foo?query={a}") + resp := get(srv, "/foo?query={name}") assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":"query resp"}`, resp.Body.String()) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) }) t.Run("mutations are forbidden", func(t *testing.T) { - resp := get(srv, "/foo?query=mutation{a}") - assert.Equal(t, http.StatusOK, resp.Code) + resp := get(srv, "/foo?query=mutation{name}") + assert.Equal(t, http.StatusNotAcceptable, resp.Code) assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) }) t.Run("subscriptions are forbidden", func(t *testing.T) { - resp := get(srv, "/foo?query=subscription{a}") - assert.Equal(t, http.StatusOK, resp.Code) + resp := get(srv, "/foo?query=subscription{name}") + assert.Equal(t, http.StatusNotAcceptable, resp.Code) assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) }) @@ -80,8 +52,8 @@ func TestServer(t *testing.T) { next(ctx, writer) })) - resp := get(srv, "/foo?query={a}") - assert.Equal(t, http.StatusOK, resp.Code) + resp := get(srv, "/foo?query={name}") + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, []string{"first", "second"}, calls) }) @@ -98,8 +70,8 @@ func TestServer(t *testing.T) { return next(ctx) })) - resp := get(srv, "/foo?query={a}") - assert.Equal(t, http.StatusOK, resp.Code) + resp := get(srv, "/foo?query={name}") + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, []string{"first", "second"}, calls) }) } diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go new file mode 100644 index 00000000000..284b8c1f653 --- /dev/null +++ b/graphql/handler/testserver/testserver.go @@ -0,0 +1,99 @@ +package testserver + +import ( + "context" + "fmt" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" +) + +// New provides a server for use in tests that isn't relying on generated code. It isnt a perfect reproduction of +// a generated server, but it aims to be good enough to test the handler package without relying on codegen. +func New() *TestServer { + next := make(chan struct{}) + now := time.Unix(0, 0) + + graphql.Now = func() time.Time { + defer func() { + now = now.Add(100 * time.Nanosecond) + }() + return now + } + + schema := gqlparser.MustLoadSchema(&ast.Source{Input: ` + schema { query: Query } + type Query { + name: String! + find(id: Int!): String! + } + type Mutation { + name: String! + } + type Subscription { + name: String! + } + `}) + + es := &graphql.ExecutableSchemaMock{ + QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + // Field execution happens inside the generated code, lets simulate some of it. + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: "Query", + Field: graphql.CollectedField{ + Field: &ast.Field{ + Name: "name", + Alias: "name", + Definition: schema.Types["Query"].Fields.ForName("name"), + }, + }, + }) + res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { + return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil + }) + if err != nil { + panic(err) + } + return res.(*graphql.Response) + }, + MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "mutations are not supported") + }, + SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { + return func() *graphql.Response { + select { + case <-ctx.Done(): + return nil + case <-next: + return &graphql.Response{ + Data: []byte(`{"name":"test"}`), + } + } + } + }, + SchemaFunc: func() *ast.Schema { + return schema + }, + } + return &TestServer{ + Server: handler.New(es), + next: next, + } +} + +type TestServer struct { + *handler.Server + next chan struct{} +} + +func (s *TestServer) SendNextSubscriptionMessage() { + select { + case s.next <- struct{}{}: + case <-time.After(1 * time.Second): + fmt.Println("WARNING: no active subscription") + } + +} diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index f7d9ac48410..2a8efe44f07 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -6,9 +6,8 @@ import ( "net/http" "strings" - "github.com/vektah/gqlparser/ast" - "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/ast" ) // GET implements the GET side of the default HTTP transport @@ -47,6 +46,7 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if variables := r.URL.Query().Get("variables"); variables != "" { if err := jsonDecode(strings.NewReader(variables), &raw.Variables); err != nil { + w.WriteHeader(http.StatusBadRequest) writer.Errorf("variables could not be decoded") return } @@ -54,6 +54,7 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if extensions := r.URL.Query().Get("extensions"); extensions != "" { if err := jsonDecode(strings.NewReader(extensions), &raw.Extensions); err != nil { + w.WriteHeader(http.StatusBadRequest) writer.Errorf("extensions could not be decoded") return } @@ -63,9 +64,11 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) writer.GraphqlErr(err...) + return } op := rc.Doc.Operations.ForName(rc.OperationName) if op.Operation != ast.Query { + w.WriteHeader(http.StatusNotAcceptable) writer.Errorf("GET requests only allow query operations") return } diff --git a/graphql/handler/transport/http_get_test.go b/graphql/handler/transport/http_get_test.go new file mode 100644 index 00000000000..e0c09625230 --- /dev/null +++ b/graphql/handler/transport/http_get_test.go @@ -0,0 +1,45 @@ +package transport_test + +import ( + "net/http" + "testing" + + "github.com/99designs/gqlgen/graphql/handler/testserver" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/stretchr/testify/assert" +) + +func TestGET(t *testing.T) { + h := testserver.New() + h.AddTransport(transport.GET{}) + + t.Run("success", func(t *testing.T) { + resp := doRequest(h, "GET", "/graphql?query={name}", ``) + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) + + t.Run("decode failure", func(t *testing.T) { + resp := doRequest(h, "GET", "/graphql?query={name}&variables=notjson", "") + assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"variables could not be decoded"}],"data":null}`, resp.Body.String()) + }) + + t.Run("invalid variable", func(t *testing.T) { + resp := doRequest(h, "GET", `/graphql?query=query($id:Int!){find(id:$id)}&variables={"id":false}`, "") + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) + }) + + t.Run("parse failure", func(t *testing.T) { + resp := doRequest(h, "GET", "/graphql?query=!", "") + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"Unexpected !","locations":[{"line":1,"column":1}]}],"data":null}`, resp.Body.String()) + }) + + t.Run("no mutations", func(t *testing.T) { + resp := doRequest(h, "GET", "/graphql?query=mutation{name}", "") + assert.Equal(t, http.StatusNotAcceptable, resp.Code, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"GET requests only allow query operations"}],"data":null}`, resp.Body.String()) + }) +} diff --git a/graphql/handler/transport/http_post_test.go b/graphql/handler/transport/http_post_test.go index ad075e29423..86411767ca7 100644 --- a/graphql/handler/transport/http_post_test.go +++ b/graphql/handler/transport/http_post_test.go @@ -1,45 +1,23 @@ package transport_test import ( - "context" "fmt" "net/http" "net/http/httptest" "strings" "testing" - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" - "github.com/vektah/gqlparser" - "github.com/vektah/gqlparser/ast" ) func TestPOST(t *testing.T) { - es := &graphql.ExecutableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return &graphql.Response{Data: []byte(`{"name":"test"}`)} - }, - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") - }, - SchemaFunc: func() *ast.Schema { - return gqlparser.MustLoadSchema(&ast.Source{Input: ` - schema { query: Query } - type Query { - me: User! - user(id: Int): User! - } - type User { name: String! } - `}) - }, - } - h := handler.New(es) + h := testserver.New() h.AddTransport(transport.POST{}) t.Run("success", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) assert.Equal(t, http.StatusOK, resp.Code) assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) }) @@ -84,21 +62,21 @@ func TestPOST(t *testing.T) { }) t.Run("validation failure", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "{ me { title }}"}`) + resp := doRequest(h, "POST", "/graphql", `{"query": "{ title }"}`) assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") - assert.Equal(t, `{"errors":[{"message":"Cannot query field \"title\" on type \"User\".","locations":[{"line":1,"column":8}]}],"data":null}`, resp.Body.String()) + assert.Equal(t, `{"errors":[{"message":"Cannot query field \"title\" on type \"Query\".","locations":[{"line":1,"column":3}]}],"data":null}`, resp.Body.String()) }) t.Run("invalid variable", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "query($id:Int!){user(id:$id){name}}","variables":{"id":false}}`) + resp := doRequest(h, "POST", "/graphql", `{"query": "query($id:Int!){find(id:$id)}","variables":{"id":false}}`) assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"cannot use bool as Int","path":["variable","id"]}],"data":null}`, resp.Body.String()) }) t.Run("execution failure", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query": "mutation { me { name } }"}`) + resp := doRequest(h, "POST", "/graphql", `{"query": "mutation { name }"}`) assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, resp.Header().Get("Content-Type"), "application/json") assert.Equal(t, `{"errors":[{"message":"mutations are not supported"}],"data":null}`, resp.Body.String()) @@ -123,7 +101,7 @@ func TestPOST(t *testing.T) { for _, contentType := range validContentTypes { t.Run(fmt.Sprintf("allow for content type %s", contentType), func(t *testing.T) { - resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, contentType) + resp := doReq(h, "POST", "/graphql", `{"query":"{ name }"}`, contentType) assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) }) @@ -140,7 +118,7 @@ func TestPOST(t *testing.T) { for _, tc := range invalidContentTypes { t.Run(fmt.Sprintf("reject for content type %s", tc), func(t *testing.T) { - resp := doReq(h, "POST", "/graphql", `{"query":"{ me { name } }"}`, tc) + resp := doReq(h, "POST", "/graphql", `{"query":"{ name }"}`, tc) assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String()) assert.Equal(t, fmt.Sprintf(`{"errors":[{"message":"%s"}],"data":null}`, "transport not supported"), resp.Body.String()) }) diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 87bc4c1608c..1e40bbc61c5 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -29,13 +29,13 @@ const ( ) type ( - WebsocketTransport struct { + Websocket struct { Upgrader websocket.Upgrader InitFunc websocketInitFunc KeepAlivePingInterval time.Duration } wsConnection struct { - WebsocketTransport + Websocket ctx context.Context conn *websocket.Conn active map[string]context.CancelFunc @@ -53,13 +53,13 @@ type ( websocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error) ) -var _ graphql.Transport = WebsocketTransport{} +var _ graphql.Transport = Websocket{} -func (t WebsocketTransport) Supports(r *http.Request) bool { +func (t Websocket) Supports(r *http.Request) bool { return r.Header.Get("Upgrade") != "" } -func (t WebsocketTransport) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { +func (t Websocket) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { ws, err := t.Upgrader.Upgrade(w, r, http.Header{ "Sec-Websocket-Protocol": []string{"graphql-ws"}, }) @@ -70,11 +70,11 @@ func (t WebsocketTransport) Do(w http.ResponseWriter, r *http.Request, exec grap } conn := wsConnection{ - active: map[string]context.CancelFunc{}, - conn: ws, - ctx: r.Context(), - exec: exec, - WebsocketTransport: t, + active: map[string]context.CancelFunc{}, + conn: ws, + ctx: r.Context(), + exec: exec, + Websocket: t, } if !conn.init() { diff --git a/graphql/handler/transport/websocket_test.go b/graphql/handler/transport/websocket_test.go index 1592d196336..e7a5436e486 100644 --- a/graphql/handler/transport/websocket_test.go +++ b/graphql/handler/transport/websocket_test.go @@ -12,6 +12,7 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/gorilla/websocket" "github.com/stretchr/testify/assert" @@ -21,9 +22,8 @@ import ( ) func TestWebsocket(t *testing.T) { - next := make(chan struct{}) - handler := newServer(next) - handler.AddTransport(transport.WebsocketTransport{}) + handler := testserver.New() + handler.AddTransport(transport.Websocket{}) srv := httptest.NewServer(handler) defer srv.Close() @@ -114,33 +114,33 @@ func TestWebsocket(t *testing.T) { require.NoError(t, c.WriteJSON(&operationMessage{ Type: startMsg, ID: "test_1", - Payload: json.RawMessage(`{"query": "subscription { user { title } }"}`), + Payload: json.RawMessage(`{"query": "subscription { name }"}`), })) - next <- struct{}{} + handler.SendNextSubscriptionMessage() msg := readOp(c) - assert.Equal(t, dataMsg, msg.Type) - assert.Equal(t, "test_1", msg.ID) - assert.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) + require.Equal(t, dataMsg, msg.Type, string(msg.Payload)) + require.Equal(t, "test_1", msg.ID, string(msg.Payload)) + require.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) - next <- struct{}{} + handler.SendNextSubscriptionMessage() msg = readOp(c) - assert.Equal(t, dataMsg, msg.Type) - assert.Equal(t, "test_1", msg.ID) - assert.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) + require.Equal(t, dataMsg, msg.Type, string(msg.Payload)) + require.Equal(t, "test_1", msg.ID, string(msg.Payload)) + require.Equal(t, `{"data":{"name":"test"}}`, string(msg.Payload)) require.NoError(t, c.WriteJSON(&operationMessage{Type: stopMsg, ID: "test_1"})) msg = readOp(c) - assert.Equal(t, completeMsg, msg.Type) - assert.Equal(t, "test_1", msg.ID) + require.Equal(t, completeMsg, msg.Type) + require.Equal(t, "test_1", msg.ID) }) } func TestWebsocketWithKeepAlive(t *testing.T) { - next := make(chan struct{}) - h := newServer(next) - h.AddTransport(transport.WebsocketTransport{ + + h := testserver.New() + h.AddTransport(transport.Websocket{ KeepAlivePingInterval: 10 * time.Millisecond, }) @@ -157,7 +157,7 @@ func TestWebsocketWithKeepAlive(t *testing.T) { require.NoError(t, c.WriteJSON(&operationMessage{ Type: startMsg, ID: "test_1", - Payload: json.RawMessage(`{"query": "subscription { user { title } }"}`), + Payload: json.RawMessage(`{"query": "subscription { name }"}`), })) // keepalive @@ -165,7 +165,7 @@ func TestWebsocketWithKeepAlive(t *testing.T) { assert.Equal(t, connectionKeepAliveMsg, msg.Type) // server message - next <- struct{}{} + h.SendNextSubscriptionMessage() msg = readOp(c) assert.Equal(t, dataMsg, msg.Type) @@ -175,11 +175,9 @@ func TestWebsocketWithKeepAlive(t *testing.T) { } func TestWebsocketInitFunc(t *testing.T) { - next := make(chan struct{}) - t.Run("accept connection if WebsocketInitFunc is NOT provided", func(t *testing.T) { - h := newServer(next) - h.AddTransport(transport.WebsocketTransport{}) + h := testserver.New() + h.AddTransport(transport.Websocket{}) srv := httptest.NewServer(h) defer srv.Close() @@ -193,8 +191,8 @@ func TestWebsocketInitFunc(t *testing.T) { }) t.Run("accept connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { - h := newServer(next) - h.AddTransport(transport.WebsocketTransport{ + h := testserver.New() + h.AddTransport(transport.Websocket{ InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, error) { return context.WithValue(ctx, "newkey", "newvalue"), nil }, @@ -212,8 +210,8 @@ func TestWebsocketInitFunc(t *testing.T) { }) t.Run("reject connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { - h := newServer(next) - h.AddTransport(transport.WebsocketTransport{ + h := testserver.New() + h.AddTransport(transport.Websocket{ InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, error) { return ctx, errors.New("invalid init payload") }, @@ -248,7 +246,7 @@ func TestWebsocketInitFunc(t *testing.T) { } h := handler.New(es) - h.AddTransport(transport.WebsocketTransport{ + h.AddTransport(transport.Websocket{ InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, error) { return context.WithValue(ctx, "newkey", "newvalue"), nil }, @@ -267,40 +265,6 @@ func TestWebsocketInitFunc(t *testing.T) { }) } -func newServer(next chan struct{}) *handler.Server { - es := &graphql.ExecutableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "queries are not supported") - }, - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") - }, - SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return func() *graphql.Response { - select { - case <-ctx.Done(): - return nil - case <-next: - return &graphql.Response{ - Data: []byte(`{"name":"test"}`), - } - } - } - }, - SchemaFunc: func() *ast.Schema { - return gqlparser.MustLoadSchema(&ast.Source{Input: ` - schema { query: Query } - type Query { - me: User! - user(id: Int): User! - } - type User { name: String! } - `}) - }, - } - return handler.New(es) -} - func wsConnect(url string) *websocket.Conn { c, resp, err := websocket.DefaultDialer.Dial(strings.Replace(url, "http://", "ws://", -1), nil) if err != nil { From aede7d1cf15f054b1762f9801337bd3e8764b54d Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 14:08:30 +1100 Subject: [PATCH 19/53] Add multipart from transport --- graphql/handler.go | 34 ++ graphql/handler/testserver/testserver.go | 1 - graphql/handler/transport/http_form.go | 199 ++++++++ graphql/handler/transport/http_form_test.go | 287 +++++++++++ graphql/handler/transport/reader.go | 25 + graphql/handler/transport/reader_test.go | 85 ++++ graphql/handler_test.go | 89 ++++ handler/graphql.go | 184 ------- handler/graphql_test.go | 538 -------------------- 9 files changed, 719 insertions(+), 723 deletions(-) create mode 100644 graphql/handler/transport/http_form.go create mode 100644 graphql/handler/transport/http_form_test.go create mode 100644 graphql/handler/transport/reader.go create mode 100644 graphql/handler/transport/reader_test.go create mode 100644 graphql/handler_test.go diff --git a/graphql/handler.go b/graphql/handler.go index 4726570da06..6f8b008cce5 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "net/http" + "strconv" + "strings" "github.com/vektah/gqlparser/gqlerror" ) @@ -106,3 +108,35 @@ func (w Writer) GraphqlErr(err ...*gqlerror.Error) { Errors: err, }) } + +func (p *RawParams) AddUpload(upload Upload, key, path string) *gqlerror.Error { + if !strings.HasPrefix(path, "variables.") { + return gqlerror.Errorf("invalid operations paths for key %s", key) + } + + var ptr interface{} = p.Variables + parts := strings.Split(path, ".") + + // skip the first part (variables) because we started there + for i, p := range parts[1:] { + last := i == len(parts)-2 + if ptr == nil { + return gqlerror.Errorf("path is missing \"variables.\" prefix, key: %s, path: %s", key, path) + } + if index, parseNbrErr := strconv.Atoi(p); parseNbrErr == nil { + if last { + ptr.([]interface{})[index] = upload + } else { + ptr = ptr.([]interface{})[index] + } + } else { + if last { + ptr.(map[string]interface{})[p] = upload + } else { + ptr = ptr.(map[string]interface{})[p] + } + } + } + + return nil +} diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index 284b8c1f653..e5d3438773f 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -25,7 +25,6 @@ func New() *TestServer { } schema := gqlparser.MustLoadSchema(&ast.Source{Input: ` - schema { query: Query } type Query { name: String! find(id: Int!): String! diff --git a/graphql/handler/transport/http_form.go b/graphql/handler/transport/http_form.go new file mode 100644 index 00000000000..6e3298c79a1 --- /dev/null +++ b/graphql/handler/transport/http_form.go @@ -0,0 +1,199 @@ +package transport + +import ( + "encoding/json" + "io" + "io/ioutil" + "mime" + "net/http" + "os" + "strings" + + "github.com/99designs/gqlgen/graphql" +) + +// MultipartForm the Multipart request spec https://github.com/jaydenseric/graphql-multipart-request-spec +type MultipartForm struct { + // MaxUploadSize sets the maximum number of bytes used to parse a request body + // as multipart/form-data. + MaxUploadSize int64 + + // MaxMemory defines the maximum number of bytes used to parse a request body + // as multipart/form-data in memory, with the remainder stored on disk in + // temporary files. + MaxMemory int64 +} + +var _ graphql.Transport = MultipartForm{} + +func (f MultipartForm) Supports(r *http.Request) bool { + if r.Header.Get("Upgrade") != "" { + return false + } + + mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return false + } + + return r.Method == "POST" && mediaType == "multipart/form-data" +} + +func (f MultipartForm) maxUploadSize() int64 { + if f.MaxUploadSize == 0 { + return 32 << 20 + } + return f.MaxUploadSize +} + +func (f MultipartForm) maxMemory() int64 { + if f.MaxMemory == 0 { + return 32 << 20 + } + return f.MaxMemory +} + +func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { + w.Header().Set("Content-Type", "application/json") + + write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { + switch status { + case graphql.StatusOk, graphql.StatusResolverError: + w.WriteHeader(http.StatusOK) + case graphql.StatusParseError, graphql.StatusValidationError: + w.WriteHeader(http.StatusUnprocessableEntity) + } + + b, err := json.Marshal(response) + if err != nil { + panic(err) + } + w.Write(b) + }) + + var err error + if r.ContentLength > f.maxUploadSize() { + write.Errorf("failed to parse multipart form, request body too large") + return + } + r.Body = http.MaxBytesReader(w, r.Body, f.maxUploadSize()) + if err = r.ParseMultipartForm(f.maxUploadSize()); err != nil { + if strings.Contains(err.Error(), "request body too large") { + write.Errorf("failed to parse multipart form, request body too large") + return + } + write.Errorf("failed to parse multipart form") + return + } + defer r.Body.Close() + + var params graphql.RawParams + + if err = jsonDecode(strings.NewReader(r.Form.Get("operations")), ¶ms); err != nil { + write.Errorf("operations form field could not be decoded") + return + } + + var uploadsMap = map[string][]string{} + if err = json.Unmarshal([]byte(r.Form.Get("map")), &uploadsMap); err != nil { + write.Errorf("map form field could not be decoded") + return + } + + var upload graphql.Upload + for key, paths := range uploadsMap { + if len(paths) == 0 { + write.Errorf("invalid empty operations paths list for key %s", key) + return + } + file, header, err := r.FormFile(key) + if err != nil { + write.Errorf("failed to get key %s from form", key) + return + } + defer file.Close() + + if len(paths) == 1 { + upload = graphql.Upload{ + File: file, + Size: header.Size, + Filename: header.Filename, + } + + if err := params.AddUpload(upload, key, paths[0]); err != nil { + write.GraphqlErr(err) + return + } + } else { + if r.ContentLength < f.maxMemory() { + fileBytes, err := ioutil.ReadAll(file) + if err != nil { + write.Errorf("failed to read file for key %s", key) + return + } + for _, path := range paths { + upload = graphql.Upload{ + File: &bytesReader{s: &fileBytes, i: 0, prevRune: -1}, + Size: header.Size, + Filename: header.Filename, + } + + if err := params.AddUpload(upload, key, path); err != nil { + write.GraphqlErr(err) + return + } + } + } else { + tmpFile, err := ioutil.TempFile(os.TempDir(), "gqlgen-") + if err != nil { + write.Errorf("failed to create temp file for key %s", key) + return + } + tmpName := tmpFile.Name() + defer func() { + _ = os.Remove(tmpName) + }() + _, err = io.Copy(tmpFile, file) + if err != nil { + if err := tmpFile.Close(); err != nil { + write.Errorf("failed to copy to temp file and close temp file for key %s", key) + return + } + write.Errorf("failed to copy to temp file for key %s", key) + return + } + if err := tmpFile.Close(); err != nil { + write.Errorf("failed to close temp file for key %s", key) + return + } + for _, path := range paths { + pathTmpFile, err := os.Open(tmpName) + if err != nil { + write.Errorf("failed to open temp file for key %s", key) + return + } + defer pathTmpFile.Close() + upload = graphql.Upload{ + File: pathTmpFile, + Size: header.Size, + Filename: header.Filename, + } + + if err := params.AddUpload(upload, key, path); err != nil { + write.GraphqlErr(err) + return + } + } + } + } + } + + rc, gerr := exec.CreateRequestContext(r.Context(), ¶ms) + if gerr != nil { + w.WriteHeader(http.StatusUnprocessableEntity) + write.GraphqlErr(gerr...) + return + } + ctx := graphql.WithRequestContext(r.Context(), rc) + exec.DispatchRequest(ctx, write) +} diff --git a/graphql/handler/transport/http_form_test.go b/graphql/handler/transport/http_form_test.go new file mode 100644 index 00000000000..1974594e283 --- /dev/null +++ b/graphql/handler/transport/http_form_test.go @@ -0,0 +1,287 @@ +package transport_test + +import ( + "bytes" + "context" + "io/ioutil" + "mime/multipart" + "net/http" + "net/http/httptest" + "testing" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" +) + +func TestFileUpload(t *testing.T) { + es := &graphql.ExecutableSchemaMock{ + MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "not implemented") + }, + SchemaFunc: func() *ast.Schema { + return gqlparser.MustLoadSchema(&ast.Source{Input: ` + type Mutation { + singleUpload(file: Upload!): String! + singleUploadWithPayload(req: UploadFile!): String! + multipleUpload(files: [Upload!]!): String! + multipleUploadWithPayload(req: [UploadFile!]!): String! + } + scalar Upload + scalar UploadFile + `}) + }, + } + + h := handler.New(es) + multipartForm := transport.MultipartForm{} + h.AddTransport(&multipartForm) + + t.Run("valid single file upload", func(t *testing.T) { + es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + require.Equal(t, len(op.VariableDefinitions), 1) + require.Equal(t, op.VariableDefinitions[0].Variable, "file") + return &graphql.Response{Data: []byte(`{"singleUpload":"test"}`)} + } + + operations := `{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) }", "variables": { "file": null } }` + mapData := `{ "0": ["variables.file"] }` + files := []file{ + { + mapKey: "0", + name: "a.txt", + content: "test1", + }, + } + req := createUploadRequest(t, operations, mapData, files) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"singleUpload":"test"}}`, resp.Body.String()) + }) + + t.Run("valid single file upload with payload", func(t *testing.T) { + es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + require.Equal(t, len(op.VariableDefinitions), 1) + require.Equal(t, op.VariableDefinitions[0].Variable, "req") + return &graphql.Response{Data: []byte(`{"singleUploadWithPayload":"test"}`)} + } + + operations := `{ "query": "mutation ($req: UploadFile!) { singleUploadWithPayload(req: $req) }", "variables": { "req": {"file": null, "id": 1 } } }` + mapData := `{ "0": ["variables.req.file"] }` + files := []file{ + { + mapKey: "0", + name: "a.txt", + content: "test1", + }, + } + req := createUploadRequest(t, operations, mapData, files) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"singleUploadWithPayload":"test"}}`, resp.Body.String()) + }) + + t.Run("valid file list upload", func(t *testing.T) { + es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + require.Equal(t, len(op.VariableDefinitions), 1) + require.Equal(t, op.VariableDefinitions[0].Variable, "files") + return &graphql.Response{Data: []byte(`{"multipleUpload":[{"id":1},{"id":2}]}`)} + } + + operations := `{ "query": "mutation($files: [Upload!]!) { multipleUpload(files: $files) }", "variables": { "files": [null, null] } }` + mapData := `{ "0": ["variables.files.0"], "1": ["variables.files.1"] }` + files := []file{ + { + mapKey: "0", + name: "a.txt", + content: "test1", + }, + { + mapKey: "1", + name: "b.txt", + content: "test2", + }, + } + req := createUploadRequest(t, operations, mapData, files) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"multipleUpload":[{"id":1},{"id":2}]}}`, resp.Body.String()) + }) + + t.Run("valid file list upload with payload", func(t *testing.T) { + es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + require.Equal(t, len(op.VariableDefinitions), 1) + require.Equal(t, op.VariableDefinitions[0].Variable, "req") + return &graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)} + } + + operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` + mapData := `{ "0": ["variables.req.0.file"], "1": ["variables.req.1.file"] }` + files := []file{ + { + mapKey: "0", + name: "a.txt", + content: "test1", + }, + { + mapKey: "1", + name: "b.txt", + content: "test2", + }, + } + req := createUploadRequest(t, operations, mapData, files) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code) + require.Equal(t, `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}`, resp.Body.String()) + }) + + t.Run("valid file list upload with payload and file reuse", func(t *testing.T) { + test := func(uploadMaxMemory int64) { + es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + require.Equal(t, len(op.VariableDefinitions), 1) + require.Equal(t, op.VariableDefinitions[0].Variable, "req") + return &graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)} + } + multipartForm.MaxMemory = uploadMaxMemory + + operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` + mapData := `{ "0": ["variables.req.0.file", "variables.req.1.file"] }` + files := []file{ + { + mapKey: "0", + name: "a.txt", + content: "test1", + }, + } + req := createUploadRequest(t, operations, mapData, files) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}`, resp.Body.String()) + } + + t.Run("payload smaller than UploadMaxMemory, stored in memory", func(t *testing.T) { + test(5000) + }) + + t.Run("payload bigger than UploadMaxMemory, persisted to disk", func(t *testing.T) { + test(2) + }) + }) + + validOperations := `{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) }", "variables": { "file": null } }` + validMap := `{ "0": ["variables.file"] }` + validFiles := []file{ + { + mapKey: "0", + name: "a.txt", + content: "test1", + }, + } + + t.Run("failed to parse multipart", func(t *testing.T) { + req := &http.Request{ + Method: "POST", + Header: http.Header{"Content-Type": {`multipart/form-data; boundary="foo123"`}}, + Body: ioutil.NopCloser(new(bytes.Buffer)), + } + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"failed to parse multipart form"}],"data":null}`, resp.Body.String()) + }) + + t.Run("fail parse operation", func(t *testing.T) { + operations := `invalid operation` + req := createUploadRequest(t, operations, validMap, validFiles) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"operations form field could not be decoded"}],"data":null}`, resp.Body.String()) + }) + + t.Run("fail parse map", func(t *testing.T) { + mapData := `invalid map` + req := createUploadRequest(t, validOperations, mapData, validFiles) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"map form field could not be decoded"}],"data":null}`, resp.Body.String()) + }) + + t.Run("fail missing file", func(t *testing.T) { + var files []file + req := createUploadRequest(t, validOperations, validMap, files) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"failed to get key 0 from form"}],"data":null}`, resp.Body.String()) + }) + + t.Run("fail map entry with invalid operations paths prefix", func(t *testing.T) { + mapData := `{ "0": ["var.file"] }` + req := createUploadRequest(t, validOperations, mapData, validFiles) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"invalid operations paths for key 0"}],"data":null}`, resp.Body.String()) + }) + + t.Run("fail parse request big body", func(t *testing.T) { + multipartForm.MaxUploadSize = 2 + req := createUploadRequest(t, validOperations, validMap, validFiles) + + resp := httptest.NewRecorder() + h.ServeHTTP(resp, req) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"failed to parse multipart form, request body too large"}],"data":null}`, resp.Body.String()) + }) +} + +type file struct { + mapKey string + name string + content string +} + +func createUploadRequest(t *testing.T, operations, mapData string, files []file) *http.Request { + bodyBuf := &bytes.Buffer{} + bodyWriter := multipart.NewWriter(bodyBuf) + + err := bodyWriter.WriteField("operations", operations) + require.NoError(t, err) + + err = bodyWriter.WriteField("map", mapData) + require.NoError(t, err) + + for i := range files { + ff, err := bodyWriter.CreateFormFile(files[i].mapKey, files[i].name) + require.NoError(t, err) + _, err = ff.Write([]byte(files[i].content)) + require.NoError(t, err) + } + err = bodyWriter.Close() + require.NoError(t, err) + + req, err := http.NewRequest("POST", "/graphql", bodyBuf) + require.NoError(t, err) + + req.Header.Set("Content-Type", bodyWriter.FormDataContentType()) + return req +} diff --git a/graphql/handler/transport/reader.go b/graphql/handler/transport/reader.go new file mode 100644 index 00000000000..d3261e28335 --- /dev/null +++ b/graphql/handler/transport/reader.go @@ -0,0 +1,25 @@ +package transport + +import ( + "errors" + "io" +) + +type bytesReader struct { + s *[]byte + i int64 // current reading index + prevRune int // index of previous rune; or < 0 +} + +func (r *bytesReader) Read(b []byte) (n int, err error) { + if r.s == nil { + return 0, errors.New("byte slice pointer is nil") + } + if r.i >= int64(len(*r.s)) { + return 0, io.EOF + } + r.prevRune = -1 + n = copy(b, (*r.s)[r.i:]) + r.i += int64(n) + return +} diff --git a/graphql/handler/transport/reader_test.go b/graphql/handler/transport/reader_test.go new file mode 100644 index 00000000000..eaff3b2b817 --- /dev/null +++ b/graphql/handler/transport/reader_test.go @@ -0,0 +1,85 @@ +package transport + +import ( + "io" + "sync" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestBytesRead(t *testing.T) { + t.Run("test concurrency", func(t *testing.T) { + // Test for the race detector, to verify a Read that doesn't yield any bytes + // is okay to use from multiple goroutines. This was our historic behavior. + // See golang.org/issue/7856 + r := bytesReader{s: &([]byte{})} + var wg sync.WaitGroup + for i := 0; i < 5; i++ { + wg.Add(2) + go func() { + defer wg.Done() + var buf [1]byte + r.Read(buf[:]) + }() + go func() { + defer wg.Done() + r.Read(nil) + }() + } + wg.Wait() + }) + + t.Run("fail to read if pointer is nil", func(t *testing.T) { + n, err := (&bytesReader{}).Read(nil) + require.Equal(t, 0, n) + require.NotNil(t, err) + require.Equal(t, "byte slice pointer is nil", err.Error()) + }) + + t.Run("read using buffer", func(t *testing.T) { + data := []byte("0123456789") + r := bytesReader{s: &data} + + got := make([]byte, 0, 11) + buf := make([]byte, 1) + for { + n, err := r.Read(buf) + if n < 0 { + require.Fail(t, "unexpected bytes read size") + } + got = append(got, buf[:n]...) + if err != nil { + if err == io.EOF { + break + } + require.Fail(t, "unexpected error while reading", err.Error()) + } + } + require.Equal(t, "0123456789", string(got)) + }) + + t.Run("read updated pointer value", func(t *testing.T) { + data := []byte("0123456789") + pointer := &data + r := bytesReader{s: pointer} + data[2] = []byte("9")[0] + + got := make([]byte, 0, 11) + buf := make([]byte, 1) + for { + n, err := r.Read(buf) + if n < 0 { + require.Fail(t, "unexpected bytes read size") + } + got = append(got, buf[:n]...) + if err != nil { + if err == io.EOF { + break + } + require.Fail(t, "unexpected error while reading", err.Error()) + } + } + require.Equal(t, "0193456789", string(got)) + }) +} diff --git a/graphql/handler_test.go b/graphql/handler_test.go new file mode 100644 index 00000000000..1caf965b9b7 --- /dev/null +++ b/graphql/handler_test.go @@ -0,0 +1,89 @@ +package graphql + +import ( + "os" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAddUploadToOperations(t *testing.T) { + key := "0" + + t.Run("fail missing all variables", func(t *testing.T) { + file, _ := os.Open("path/to/file") + params := &RawParams{} + + upload := Upload{ + File: file, + Filename: "a.txt", + Size: int64(5), + } + path := "variables.req.0.file" + err := params.AddUpload(upload, key, path) + require.NotNil(t, err) + require.Equal(t, "input: path is missing \"variables.\" prefix, key: 0, path: variables.req.0.file", err.Error()) + }) + + t.Run("valid variable", func(t *testing.T) { + file, _ := os.Open("path/to/file") + request := &RawParams{ + Variables: map[string]interface{}{ + "file": nil, + }, + } + + upload := Upload{ + File: file, + Filename: "a.txt", + Size: int64(5), + } + + expected := &RawParams{ + Variables: map[string]interface{}{ + "file": upload, + }, + } + + path := "variables.file" + err := request.AddUpload(upload, key, path) + require.Nil(t, err) + + require.Equal(t, request, expected) + }) + + t.Run("valid nested variable", func(t *testing.T) { + file, _ := os.Open("path/to/file") + request := &RawParams{ + Variables: map[string]interface{}{ + "req": []interface{}{ + map[string]interface{}{ + "file": nil, + }, + }, + }, + } + + upload := Upload{ + File: file, + Filename: "a.txt", + Size: int64(5), + } + + expected := &RawParams{ + Variables: map[string]interface{}{ + "req": []interface{}{ + map[string]interface{}{ + "file": upload, + }, + }, + }, + } + + path := "variables.req.0.file" + err := request.AddUpload(upload, key, path) + require.Nil(t, err) + + require.Equal(t, request, expected) + }) +} diff --git a/handler/graphql.go b/handler/graphql.go index e9e3af930fd..df574a56e9e 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -3,14 +3,11 @@ package handler import ( "context" "encoding/json" - "errors" "fmt" "io" - "io/ioutil" "mime" "net/http" "os" - "strconv" "strings" "time" @@ -54,8 +51,6 @@ type Config struct { websocketInitFunc websocketInitFunc disableIntrospection bool connectionKeepAlivePingInterval time.Duration - uploadMaxMemory int64 - uploadMaxSize int64 } func (c *Config) newRequestContext(ctx context.Context, es graphql.ExecutableSchema, doc *ast.QueryDocument, op *ast.OperationDefinition, operationName, query string, variables map[string]interface{}) (*graphql.RequestContext, error) { @@ -123,23 +118,6 @@ func CacheSize(size int) Option { } // UploadMaxSize sets the maximum number of bytes used to parse a request body -// as multipart/form-data. -func UploadMaxSize(size int64) Option { - return func(cfg *Config) { - cfg.uploadMaxSize = size - } -} - -// UploadMaxMemory sets the maximum number of bytes used to parse a request body -// as multipart/form-data in memory, with the remainder stored on disk in -// temporary files. -func UploadMaxMemory(size int64) Option { - return func(cfg *Config) { - cfg.uploadMaxMemory = size - } -} - -// WebsocketKeepAliveDuration allows you to reconfigure the keepalive behavior. // By default, keepalive is enabled with a DefaultConnectionKeepAlivePingInterval // duration. Set handler.connectionKeepAlivePingInterval = 0 to disable keepalive // altogether. @@ -152,20 +130,9 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option { const DefaultCacheSize = 1000 const DefaultConnectionKeepAlivePingInterval = 25 * time.Second -// DefaultUploadMaxMemory is the maximum number of bytes used to parse a request body -// as multipart/form-data in memory, with the remainder stored on disk in -// temporary files. -const DefaultUploadMaxMemory = 32 << 20 - -// DefaultUploadMaxSize is maximum number of bytes used to parse a request body -// as multipart/form-data. -const DefaultUploadMaxSize = 32 << 20 - func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc { cfg := &Config{ cacheSize: DefaultCacheSize, - uploadMaxMemory: DefaultUploadMaxMemory, - uploadMaxSize: DefaultUploadMaxSize, connectionKeepAlivePingInterval: DefaultConnectionKeepAlivePingInterval, upgrader: websocket.Upgrader{ ReadBufferSize: 1024, @@ -436,154 +403,3 @@ func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { func sendErrorf(w http.ResponseWriter, code int, format string, args ...interface{}) { sendError(w, code, &gqlerror.Error{Message: fmt.Sprintf(format, args...)}) } - -type bytesReader struct { - s *[]byte - i int64 // current reading index - prevRune int // index of previous rune; or < 0 -} - -func (r *bytesReader) Read(b []byte) (n int, err error) { - if r.s == nil { - return 0, errors.New("byte slice pointer is nil") - } - if r.i >= int64(len(*r.s)) { - return 0, io.EOF - } - r.prevRune = -1 - n = copy(b, (*r.s)[r.i:]) - r.i += int64(n) - return -} - -func processMultipart(w http.ResponseWriter, r *http.Request, request *params, closers *[]io.Closer, tmpFiles *[]string, uploadMaxSize, uploadMaxMemory int64) error { - var err error - if r.ContentLength > uploadMaxSize { - return errors.New("failed to parse multipart form, request body too large") - } - r.Body = http.MaxBytesReader(w, r.Body, uploadMaxSize) - if err = r.ParseMultipartForm(uploadMaxMemory); err != nil { - if strings.Contains(err.Error(), "request body too large") { - return errors.New("failed to parse multipart form, request body too large") - } - return errors.New("failed to parse multipart form") - } - *closers = append(*closers, r.Body) - - if err = jsonDecode(strings.NewReader(r.Form.Get("operations")), &request); err != nil { - return errors.New("operations form field could not be decoded") - } - - var uploadsMap = map[string][]string{} - if err = json.Unmarshal([]byte(r.Form.Get("map")), &uploadsMap); err != nil { - return errors.New("map form field could not be decoded") - } - - var upload graphql.Upload - for key, paths := range uploadsMap { - if len(paths) == 0 { - return fmt.Errorf("invalid empty operations paths list for key %s", key) - } - file, header, err := r.FormFile(key) - if err != nil { - return fmt.Errorf("failed to get key %s from form", key) - } - *closers = append(*closers, file) - - if len(paths) == 1 { - upload = graphql.Upload{ - File: file, - Size: header.Size, - Filename: header.Filename, - } - err = addUploadToOperations(request, upload, key, paths[0]) - if err != nil { - return err - } - } else { - if r.ContentLength < uploadMaxMemory { - fileBytes, err := ioutil.ReadAll(file) - if err != nil { - return fmt.Errorf("failed to read file for key %s", key) - } - for _, path := range paths { - upload = graphql.Upload{ - File: &bytesReader{s: &fileBytes, i: 0, prevRune: -1}, - Size: header.Size, - Filename: header.Filename, - } - err = addUploadToOperations(request, upload, key, path) - if err != nil { - return err - } - } - } else { - tmpFile, err := ioutil.TempFile(os.TempDir(), "gqlgen-") - if err != nil { - return fmt.Errorf("failed to create temp file for key %s", key) - } - tmpName := tmpFile.Name() - *tmpFiles = append(*tmpFiles, tmpName) - _, err = io.Copy(tmpFile, file) - if err != nil { - if err := tmpFile.Close(); err != nil { - return fmt.Errorf("failed to copy to temp file and close temp file for key %s", key) - } - return fmt.Errorf("failed to copy to temp file for key %s", key) - } - if err := tmpFile.Close(); err != nil { - return fmt.Errorf("failed to close temp file for key %s", key) - } - for _, path := range paths { - pathTmpFile, err := os.Open(tmpName) - if err != nil { - return fmt.Errorf("failed to open temp file for key %s", key) - } - *closers = append(*closers, pathTmpFile) - upload = graphql.Upload{ - File: pathTmpFile, - Size: header.Size, - Filename: header.Filename, - } - err = addUploadToOperations(request, upload, key, path) - if err != nil { - return err - } - } - } - } - } - return nil -} - -func addUploadToOperations(request *params, upload graphql.Upload, key, path string) error { - if !strings.HasPrefix(path, "variables.") { - return fmt.Errorf("invalid operations paths for key %s", key) - } - - var ptr interface{} = request.Variables - parts := strings.Split(path, ".") - - // skip the first part (variables) because we started there - for i, p := range parts[1:] { - last := i == len(parts)-2 - if ptr == nil { - return fmt.Errorf("path is missing \"variables.\" prefix, key: %s, path: %s", key, path) - } - if index, parseNbrErr := strconv.Atoi(p); parseNbrErr == nil { - if last { - ptr.([]interface{})[index] = upload - } else { - ptr = ptr.([]interface{})[index] - } - } else { - if last { - ptr.(map[string]interface{})[p] = upload - } else { - ptr = ptr.(map[string]interface{})[p] - } - } - } - - return nil -} diff --git a/handler/graphql_test.go b/handler/graphql_test.go index 503d244450d..2b2b073d414 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -1,23 +1,14 @@ package handler import ( - "bytes" "context" - "fmt" - "io" - "io/ioutil" - "mime/multipart" "net/http" "net/http/httptest" - "os" "strings" - "sync" "testing" "github.com/99designs/gqlgen/graphql" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser/ast" ) func TestHandlerOptions(t *testing.T) { @@ -81,459 +72,6 @@ func TestHandlerComplexity(t *testing.T) { }) } -func TestFileUpload(t *testing.T) { - - t.Run("valid single file upload", func(t *testing.T) { - mock := &executableSchemaMock{ - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - require.Equal(t, len(op.VariableDefinitions), 1) - require.Equal(t, op.VariableDefinitions[0].Variable, "file") - return &graphql.Response{Data: []byte(`{"singleUpload":{"id":1}}`)} - }, - } - handler := GraphQL(mock) - - operations := `{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) { id } }", "variables": { "file": null } }` - mapData := `{ "0": ["variables.file"] }` - files := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - } - req := createUploadRequest(t, operations, mapData, files) - - resp := httptest.NewRecorder() - handler.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code) - require.Equal(t, `{"data":{"singleUpload":{"id":1}}}`, resp.Body.String()) - }) - - t.Run("valid single file upload with payload", func(t *testing.T) { - mock := &executableSchemaMock{ - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - require.Equal(t, len(op.VariableDefinitions), 1) - require.Equal(t, op.VariableDefinitions[0].Variable, "req") - return &graphql.Response{Data: []byte(`{"singleUploadWithPayload":{"id":1}}`)} - }, - } - handler := GraphQL(mock) - - operations := `{ "query": "mutation ($req: UploadFile!) { singleUploadWithPayload(req: $req) { id } }", "variables": { "req": {"file": null, "id": 1 } } }` - mapData := `{ "0": ["variables.req.file"] }` - files := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - } - req := createUploadRequest(t, operations, mapData, files) - - resp := httptest.NewRecorder() - handler.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code) - require.Equal(t, `{"data":{"singleUploadWithPayload":{"id":1}}}`, resp.Body.String()) - }) - - t.Run("valid file list upload", func(t *testing.T) { - mock := &executableSchemaMock{ - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - require.Equal(t, len(op.VariableDefinitions), 1) - require.Equal(t, op.VariableDefinitions[0].Variable, "files") - return &graphql.Response{Data: []byte(`{"multipleUpload":[{"id":1},{"id":2}]}`)} - }, - } - handler := GraphQL(mock) - - operations := `{ "query": "mutation($files: [Upload!]!) { multipleUpload(files: $files) { id } }", "variables": { "files": [null, null] } }` - mapData := `{ "0": ["variables.files.0"], "1": ["variables.files.1"] }` - files := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - { - mapKey: "1", - name: "b.txt", - content: "test2", - }, - } - req := createUploadRequest(t, operations, mapData, files) - - resp := httptest.NewRecorder() - handler.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code) - require.Equal(t, `{"data":{"multipleUpload":[{"id":1},{"id":2}]}}`, resp.Body.String()) - }) - - t.Run("valid file list upload with payload", func(t *testing.T) { - mock := &executableSchemaMock{ - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - require.Equal(t, len(op.VariableDefinitions), 1) - require.Equal(t, op.VariableDefinitions[0].Variable, "req") - return &graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)} - }, - } - handler := GraphQL(mock) - - operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) { id } }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` - mapData := `{ "0": ["variables.req.0.file"], "1": ["variables.req.1.file"] }` - files := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - { - mapKey: "1", - name: "b.txt", - content: "test2", - }, - } - req := createUploadRequest(t, operations, mapData, files) - - resp := httptest.NewRecorder() - handler.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code) - require.Equal(t, `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}`, resp.Body.String()) - }) - - t.Run("valid file list upload with payload and file reuse", func(t *testing.T) { - test := func(uploadMaxMemory int64) { - mock := &executableSchemaMock{ - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - require.Equal(t, len(op.VariableDefinitions), 1) - require.Equal(t, op.VariableDefinitions[0].Variable, "req") - return &graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)} - }, - } - maxMemory := UploadMaxMemory(uploadMaxMemory) - handler := GraphQL(mock, maxMemory) - - operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) { id } }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` - mapData := `{ "0": ["variables.req.0.file", "variables.req.1.file"] }` - files := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - } - req := createUploadRequest(t, operations, mapData, files) - - resp := httptest.NewRecorder() - handler.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code) - require.Equal(t, `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}`, resp.Body.String()) - } - - t.Run("payload smaller than UploadMaxMemory, stored in memory", func(t *testing.T) { - test(5000) - }) - - t.Run("payload bigger than UploadMaxMemory, persisted to disk", func(t *testing.T) { - test(2) - }) - }) -} - -func TestProcessMultipart(t *testing.T) { - validOperations := `{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) { id } }", "variables": { "file": null } }` - validMap := `{ "0": ["variables.file"] }` - validFiles := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - } - - cleanUp := func(t *testing.T, closers []io.Closer, tmpFiles []string) { - for i := len(closers) - 1; 0 <= i; i-- { - err := closers[i].Close() - require.Nil(t, err) - } - for _, tmpFiles := range tmpFiles { - err := os.Remove(tmpFiles) - require.Nil(t, err) - } - } - - t.Run("fail to parse multipart", func(t *testing.T) { - req := &http.Request{ - Method: "POST", - Header: http.Header{"Content-Type": {`multipart/form-data; boundary="foo123"`}}, - Body: ioutil.NopCloser(new(bytes.Buffer)), - } - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, DefaultUploadMaxMemory) - require.NotNil(t, err) - require.Equal(t, err.Error(), "failed to parse multipart form") - cleanUp(t, closers, tmpFiles) - }) - - t.Run("fail parse operation", func(t *testing.T) { - operations := `invalid operation` - req := createUploadRequest(t, operations, validMap, validFiles) - - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, DefaultUploadMaxMemory) - require.NotNil(t, err) - require.Equal(t, err.Error(), "operations form field could not be decoded") - cleanUp(t, closers, tmpFiles) - }) - - t.Run("fail parse map", func(t *testing.T) { - mapData := `invalid map` - req := createUploadRequest(t, validOperations, mapData, validFiles) - - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, DefaultUploadMaxMemory) - require.NotNil(t, err) - require.Equal(t, err.Error(), "map form field could not be decoded") - cleanUp(t, closers, tmpFiles) - }) - - t.Run("fail missing file", func(t *testing.T) { - var files []file - req := createUploadRequest(t, validOperations, validMap, files) - - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, DefaultUploadMaxMemory) - require.NotNil(t, err) - require.Equal(t, err.Error(), "failed to get key 0 from form") - cleanUp(t, closers, tmpFiles) - }) - - t.Run("fail map entry with invalid operations paths prefix", func(t *testing.T) { - mapData := `{ "0": ["var.file"] }` - req := createUploadRequest(t, validOperations, mapData, validFiles) - - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, DefaultUploadMaxMemory) - require.NotNil(t, err) - require.Equal(t, err.Error(), "invalid operations paths for key 0") - cleanUp(t, closers, tmpFiles) - }) - - t.Run("fail parse request big body", func(t *testing.T) { - req := createUploadRequest(t, validOperations, validMap, validFiles) - - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - var smallMaxSize int64 = 2 - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, smallMaxSize, DefaultUploadMaxMemory) - require.NotNil(t, err) - require.Equal(t, err.Error(), "failed to parse multipart form, request body too large") - cleanUp(t, closers, tmpFiles) - }) - - t.Run("valid request", func(t *testing.T) { - req := createUploadRequest(t, validOperations, validMap, validFiles) - - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, DefaultUploadMaxMemory) - require.Nil(t, err) - require.Equal(t, "mutation ($file: Upload!) { singleUpload(file: $file) { id } }", reqParams.Query) - require.Equal(t, "", reqParams.OperationName) - require.Equal(t, 1, len(reqParams.Variables)) - require.NotNil(t, reqParams.Variables["file"]) - reqParamsFile, ok := reqParams.Variables["file"].(graphql.Upload) - require.True(t, ok) - require.Equal(t, "a.txt", reqParamsFile.Filename) - require.Equal(t, int64(len("test1")), reqParamsFile.Size) - content, err := ioutil.ReadAll(reqParamsFile.File) - require.Nil(t, err) - require.Equal(t, "test1", string(content)) - cleanUp(t, closers, tmpFiles) - }) - - t.Run("valid file list upload with payload and file reuse", func(t *testing.T) { - operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) { id } }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` - mapData := `{ "0": ["variables.req.0.file", "variables.req.1.file"] }` - files := []file{ - { - mapKey: "0", - name: "a.txt", - content: "test1", - }, - } - req := createUploadRequest(t, operations, mapData, files) - - test := func(uploadMaxMemory int64) { - var reqParams params - var closers []io.Closer - var tmpFiles []string - w := httptest.NewRecorder() - err := processMultipart(w, req, &reqParams, &closers, &tmpFiles, DefaultUploadMaxSize, uploadMaxMemory) - require.Nil(t, err) - require.Equal(t, "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) { id } }", reqParams.Query) - require.Equal(t, "", reqParams.OperationName) - require.Equal(t, 1, len(reqParams.Variables)) - require.NotNil(t, reqParams.Variables["req"]) - reqParamsFile, ok := reqParams.Variables["req"].([]interface{}) - require.True(t, ok) - require.Equal(t, 2, len(reqParamsFile)) - for i, item := range reqParamsFile { - itemMap := item.(map[string]interface{}) - require.Equal(t, fmt.Sprint(itemMap["id"]), fmt.Sprint(i+1)) - file := itemMap["file"].(graphql.Upload) - require.Equal(t, "a.txt", file.Filename) - require.Equal(t, int64(len("test1")), file.Size) - require.Nil(t, err) - content, err := ioutil.ReadAll(file.File) - require.Nil(t, err) - require.Equal(t, "test1", string(content)) - } - cleanUp(t, closers, tmpFiles) - } - - t.Run("payload smaller than UploadMaxMemory, stored in memory", func(t *testing.T) { - test(5000) - }) - - t.Run("payload bigger than UploadMaxMemory, persisted to disk", func(t *testing.T) { - test(2) - }) - }) -} - -func TestAddUploadToOperations(t *testing.T) { - key := "0" - - t.Run("fail missing all variables", func(t *testing.T) { - file, _ := os.Open("path/to/file") - request := ¶ms{} - - upload := graphql.Upload{ - File: file, - Filename: "a.txt", - Size: int64(5), - } - path := "variables.req.0.file" - err := addUploadToOperations(request, upload, key, path) - require.NotNil(t, err) - require.Equal(t, "path is missing \"variables.\" prefix, key: 0, path: variables.req.0.file", err.Error()) - }) - - t.Run("valid variable", func(t *testing.T) { - file, _ := os.Open("path/to/file") - request := ¶ms{ - Variables: map[string]interface{}{ - "file": nil, - }, - } - - upload := graphql.Upload{ - File: file, - Filename: "a.txt", - Size: int64(5), - } - - expected := ¶ms{ - Variables: map[string]interface{}{ - "file": upload, - }, - } - - path := "variables.file" - err := addUploadToOperations(request, upload, key, path) - require.Nil(t, err) - - require.Equal(t, request, expected) - }) - - t.Run("valid nested variable", func(t *testing.T) { - file, _ := os.Open("path/to/file") - request := ¶ms{ - Variables: map[string]interface{}{ - "req": []interface{}{ - map[string]interface{}{ - "file": nil, - }, - }, - }, - } - - upload := graphql.Upload{ - File: file, - Filename: "a.txt", - Size: int64(5), - } - - expected := ¶ms{ - Variables: map[string]interface{}{ - "req": []interface{}{ - map[string]interface{}{ - "file": upload, - }, - }, - }, - } - - path := "variables.req.0.file" - err := addUploadToOperations(request, upload, key, path) - require.Nil(t, err) - - require.Equal(t, request, expected) - }) -} - -type file struct { - mapKey string - name string - content string -} - -func createUploadRequest(t *testing.T, operations, mapData string, files []file) *http.Request { - bodyBuf := &bytes.Buffer{} - bodyWriter := multipart.NewWriter(bodyBuf) - - err := bodyWriter.WriteField("operations", operations) - require.NoError(t, err) - - err = bodyWriter.WriteField("map", mapData) - require.NoError(t, err) - - for i := range files { - ff, err := bodyWriter.CreateFormFile(files[i].mapKey, files[i].name) - require.NoError(t, err) - _, err = ff.Write([]byte(files[i].content)) - require.NoError(t, err) - } - err = bodyWriter.Close() - require.NoError(t, err) - - req, err := http.NewRequest("POST", "/graphql", bodyBuf) - require.NoError(t, err) - - req.Header.Set("Content-Type", bodyWriter.FormDataContentType()) - return req -} - func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { r := httptest.NewRequest(method, target, strings.NewReader(body)) r.Header.Set("Content-Type", "application/json") @@ -542,79 +80,3 @@ func doRequest(handler http.Handler, method string, target string, body string) handler.ServeHTTP(w, r) return w } - -func TestBytesRead(t *testing.T) { - t.Run("test concurrency", func(t *testing.T) { - // Test for the race detector, to verify a Read that doesn't yield any bytes - // is okay to use from multiple goroutines. This was our historic behavior. - // See golang.org/issue/7856 - r := bytesReader{s: &([]byte{})} - var wg sync.WaitGroup - for i := 0; i < 5; i++ { - wg.Add(2) - go func() { - defer wg.Done() - var buf [1]byte - r.Read(buf[:]) - }() - go func() { - defer wg.Done() - r.Read(nil) - }() - } - wg.Wait() - }) - - t.Run("fail to read if pointer is nil", func(t *testing.T) { - n, err := (&bytesReader{}).Read(nil) - require.Equal(t, 0, n) - require.NotNil(t, err) - require.Equal(t, "byte slice pointer is nil", err.Error()) - }) - - t.Run("read using buffer", func(t *testing.T) { - data := []byte("0123456789") - r := bytesReader{s: &data} - - got := make([]byte, 0, 11) - buf := make([]byte, 1) - for { - n, err := r.Read(buf) - if n < 0 { - require.Fail(t, "unexpected bytes read size") - } - got = append(got, buf[:n]...) - if err != nil { - if err == io.EOF { - break - } - require.Fail(t, "unexpected error while reading", err.Error()) - } - } - require.Equal(t, "0123456789", string(got)) - }) - - t.Run("read updated pointer value", func(t *testing.T) { - data := []byte("0123456789") - pointer := &data - r := bytesReader{s: pointer} - data[2] = []byte("9")[0] - - got := make([]byte, 0, 11) - buf := make([]byte, 1) - for { - n, err := r.Read(buf) - if n < 0 { - require.Fail(t, "unexpected bytes read size") - } - got = append(got, buf[:n]...) - if err != nil { - if err == io.EOF { - break - } - require.Fail(t, "unexpected error while reading", err.Error()) - } - } - require.Equal(t, "0193456789", string(got)) - }) -} From 0965420a4246492bbac6922da742b157ea968c29 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 14:44:54 +1100 Subject: [PATCH 20/53] Add query document caching --- graphql/cache.go | 11 ++-- graphql/handler/executor.go | 58 +++++++++++---------- graphql/handler/server.go | 6 +++ graphql/handler/server_test.go | 40 ++++++++++++-- graphql/handler/transport/http_post_test.go | 25 --------- 5 files changed, 81 insertions(+), 59 deletions(-) diff --git a/graphql/cache.go b/graphql/cache.go index bd55f0b8e14..24294f72d7f 100644 --- a/graphql/cache.go +++ b/graphql/cache.go @@ -6,7 +6,7 @@ type Cache interface { Get(key string) (value interface{}, ok bool) // Add adds a value to the cache. - Add(key, value string) + Add(key string, value interface{}) } // MapCache is the simplest implementation of a cache, because it can not evict it should only be used in tests @@ -19,6 +19,9 @@ func (m MapCache) Get(key string) (value interface{}, ok bool) { } // Add adds a value to the cache. -func (m MapCache) Add(key, value string) { - m[key] = value -} +func (m MapCache) Add(key string, value interface{}) { m[key] = value } + +type NoCache struct{} + +func (n NoCache) Get(key string) (value interface{}, ok bool) { return nil, false } +func (n NoCache) Add(key string, value interface{}) {} diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index eba9714da2a..6e7fd18c116 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -87,8 +87,6 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP } } - var gerr *gqlerror.Error - rc := &graphql.RequestContext{ DisableIntrospection: true, Recover: graphql.DefaultRecover, @@ -100,21 +98,22 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP } rc.Stats.OperationStart = graphql.GetStartTime(ctx) - rc.Doc, gerr = e.parseOperation(ctx, rc) - if gerr != nil { - return nil, []*gqlerror.Error{gerr} - } - - ctx, op, listErr := e.validateOperation(ctx, rc) + var listErr gqlerror.List + rc.Doc, listErr = e.parseQuery(ctx, rc) if len(listErr) != 0 { return nil, listErr } + op := rc.Doc.Operations.ForName(rc.OperationName) + if op == nil { + return nil, gqlerror.List{gqlerror.Errorf("operation %s not found", rc.OperationName)} + } + vars, err := validator.VariableValues(e.server.es.Schema(), op, rc.Variables) if err != nil { return nil, gqlerror.List{err} } - + rc.Stats.Validation.End = graphql.Now() rc.Variables = vars for _, p := range e.requestContextMutators { @@ -180,29 +179,34 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr } } -func (e executor) parseOperation(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, *gqlerror.Error) { +// parseQuery decodes the incoming query and validates it, pulling from cache if present. +// +// NOTE: This should NOT look at variables, they will change per request. It should only parse and validate +// the raw query string. +func (e executor) parseQuery(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, gqlerror.List) { rc.Stats.Parsing.Start = graphql.Now() - defer func() { - rc.Stats.Parsing.End = graphql.Now() - }() - return parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) -} -func (e executor) validateOperation(ctx context.Context, rc *graphql.RequestContext) (context.Context, *ast.OperationDefinition, gqlerror.List) { - rc.Stats.Validation.Start = graphql.Now() - defer func() { - rc.Stats.Validation.End = graphql.Now() - }() + if doc, ok := e.server.queryCache.Get(rc.RawQuery); ok { + now := graphql.Now() - listErr := validator.Validate(e.server.es.Schema(), rc.Doc) - if len(listErr) != 0 { - return ctx, nil, listErr + rc.Stats.Parsing.End = now + rc.Stats.Validation.Start = now + return doc.(*ast.QueryDocument), nil } - op := rc.Doc.Operations.ForName(rc.OperationName) - if op == nil { - return ctx, nil, gqlerror.List{gqlerror.Errorf("operation %s not found", rc.OperationName)} + doc, err := parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) + if err != nil { + return nil, gqlerror.List{err} + } + rc.Stats.Parsing.End = graphql.Now() + + rc.Stats.Validation.Start = graphql.Now() + listErr := validator.Validate(e.server.es.Schema(), doc) + if len(listErr) != 0 { + return nil, listErr } - return ctx, op, nil + e.server.queryCache.Add(rc.RawQuery, doc) + + return doc, nil } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 03ccae9dfbd..50b9379033d 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -18,6 +18,7 @@ type ( errorPresenter graphql.ErrorPresenterFunc recoverFunc graphql.RecoverFunc + queryCache graphql.Cache } ) @@ -26,6 +27,7 @@ func New(es graphql.ExecutableSchema) *Server { es: es, errorPresenter: graphql.DefaultErrorPresenter, recoverFunc: graphql.DefaultRecover, + queryCache: graphql.NoCache{}, } s.exec = newExecutor(s) return s @@ -43,6 +45,10 @@ func (s *Server) SetRecoverFunc(f graphql.RecoverFunc) { s.recoverFunc = f } +func (s *Server) SetQueryCache(cache graphql.Cache) { + s.queryCache = cache +} + func (s *Server) Use(plugin graphql.HandlerPlugin) { switch plugin.(type) { case graphql.RequestParameterMutator, diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index fe8ab220871..a966cd8eb20 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -2,11 +2,16 @@ package handler_test import ( "context" - "fmt" "net/http" "net/http/httptest" + "net/url" "testing" + "github.com/vektah/gqlparser/parser" + + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/ast" + "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" @@ -60,12 +65,10 @@ func TestServer(t *testing.T) { t.Run("invokes field middleware in order", func(t *testing.T) { var calls []string srv.Use(fieldFunc(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - fmt.Println("first") calls = append(calls, "first") return next(ctx) })) srv.Use(fieldFunc(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - fmt.Println("second") calls = append(calls, "second") return next(ctx) })) @@ -74,6 +77,37 @@ func TestServer(t *testing.T) { assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) assert.Equal(t, []string{"first", "second"}, calls) }) + + t.Run("query caching", func(t *testing.T) { + cache := &graphql.MapCache{} + srv.SetQueryCache(cache) + qry := `query Foo {name}` + + t.Run("cache miss populates cache", func(t *testing.T) { + resp := get(srv, "/foo?query="+url.QueryEscape(qry)) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + cacheDoc, ok := cache.Get(qry) + require.True(t, ok) + require.Equal(t, "Foo", cacheDoc.(*ast.QueryDocument).Operations[0].Name) + }) + + t.Run("cache hits use document from cache", func(t *testing.T) { + doc, err := parser.ParseQuery(&ast.Source{Input: `query Bar {name}`}) + require.Nil(t, err) + cache.Add(qry, doc) + + resp := get(srv, "/foo?query="+url.QueryEscape(qry)) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + cacheDoc, ok := cache.Get(qry) + require.True(t, ok) + require.Equal(t, "Bar", cacheDoc.(*ast.QueryDocument).Operations[0].Name) + }) + }) + } type opFunc func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) diff --git a/graphql/handler/transport/http_post_test.go b/graphql/handler/transport/http_post_test.go index 86411767ca7..8e389b023be 100644 --- a/graphql/handler/transport/http_post_test.go +++ b/graphql/handler/transport/http_post_test.go @@ -22,31 +22,6 @@ func TestPOST(t *testing.T) { assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) }) - // Todo: Extract - //t.Run("query caching", func(t *testing.T) { - // // Run enough unique queries to evict a bunch of them - // for i := 0; i < 2000; i++ { - // query := `{"query":"` + strings.Repeat(" ", i) + "{ me { name } }" + `"}` - // resp := doRequest(h, "POST", "/graphql", query) - // assert.Equal(t, http.StatusOK, resp.Code) - // assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - // } - // - // t.Run("evicted queries run", func(t *testing.T) { - // query := `{"query":"` + strings.Repeat(" ", 0) + "{ me { name } }" + `"}` - // resp := doRequest(h, "POST", "/graphql", query) - // assert.Equal(t, http.StatusOK, resp.Code) - // assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - // }) - // - // t.Run("non-evicted queries run", func(t *testing.T) { - // query := `{"query":"` + strings.Repeat(" ", 1999) + "{ me { name } }" + `"}` - // resp := doRequest(h, "POST", "/graphql", query) - // assert.Equal(t, http.StatusOK, resp.Code) - // assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - // }) - //}) - t.Run("decode failure", func(t *testing.T) { resp := doRequest(h, "POST", "/graphql", "notjson") assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String()) From 8c5340c1ab61c43dc5d1e3fd6feb30d24d95cdb9 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 15:50:13 +1100 Subject: [PATCH 21/53] Add complexity limit plugin --- graphql/contest_server.go | 13 +++++ graphql/context_request.go | 20 ++------ graphql/handler.go | 1 - graphql/handler/executor.go | 3 +- graphql/handler/middleware/complexity.go | 18 +++++-- graphql/handler/middleware/complexity_test.go | 48 +++++++++++++++++-- graphql/handler/server_test.go | 1 - graphql/handler/testserver/testserver.go | 23 ++++++--- handler/graphql.go | 3 +- handler/graphql_test.go | 48 ------------------- 10 files changed, 93 insertions(+), 85 deletions(-) create mode 100644 graphql/contest_server.go diff --git a/graphql/contest_server.go b/graphql/contest_server.go new file mode 100644 index 00000000000..d87c35bc9c1 --- /dev/null +++ b/graphql/contest_server.go @@ -0,0 +1,13 @@ +package graphql + +import "context" + +const serverCtx key = "serverCtx" + +func GetServerContext(ctx context.Context) ExecutableSchema { + return ctx.Value(serverCtx).(ExecutableSchema) +} + +func WithServerContext(ctx context.Context, es ExecutableSchema) context.Context { + return context.WithValue(ctx, serverCtx, es) +} diff --git a/graphql/context_request.go b/graphql/context_request.go index 71f82394de5..bd37ab0374e 100644 --- a/graphql/context_request.go +++ b/graphql/context_request.go @@ -5,7 +5,6 @@ import ( "errors" "github.com/vektah/gqlparser/ast" - "github.com/vektah/gqlparser/gqlerror" ) type RequestContext struct { @@ -14,13 +13,10 @@ type RequestContext struct { OperationName string Doc *ast.QueryDocument - ComplexityLimit int - OperationComplexity int DisableIntrospection bool - - Recover RecoverFunc - ResolverMiddleware FieldMiddleware - DirectiveMiddleware FieldMiddleware + Recover RecoverFunc + ResolverMiddleware FieldMiddleware + DirectiveMiddleware FieldMiddleware Stats Stats } @@ -46,9 +42,6 @@ func (rc *RequestContext) Validate(ctx context.Context) error { if rc.Recover == nil { rc.Recover = DefaultRecover } - if rc.ComplexityLimit < 0 { - return errors.New("field 'ComplexityLimit' value must be 0 or more") - } return nil } @@ -99,10 +92,3 @@ func (c *RequestContext) Errorf(ctx context.Context, format string, args ...inte func (c *RequestContext) Error(ctx context.Context, err error) { AddError(ctx, err) } - -var _ RequestContextMutator = ComplexityLimitFunc(nil) - -func (c ComplexityLimitFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { - rc.ComplexityLimit = c(ctx) - return nil -} diff --git a/graphql/handler.go b/graphql/handler.go index 6f8b008cce5..8b4b27ae98a 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -19,7 +19,6 @@ type ( ResponseStream func() *Response ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) - ComplexityLimitFunc func(ctx context.Context) int RawParams struct { Query string `json:"query"` diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 6e7fd18c116..7a2f7f06218 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -81,6 +81,8 @@ func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { } func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { + ctx = graphql.WithServerContext(ctx, e.server.es) + for _, p := range e.requestParamMutators { if err := p.MutateRequestParameters(ctx, params); err != nil { return nil, gqlerror.List{err} @@ -91,7 +93,6 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP DisableIntrospection: true, Recover: graphql.DefaultRecover, ResolverMiddleware: e.responseMiddleware, - ComplexityLimit: 0, RawQuery: params.Query, OperationName: params.OperationName, Variables: params.Variables, diff --git a/graphql/handler/middleware/complexity.go b/graphql/handler/middleware/complexity.go index 846227d9437..b0fbbc5f298 100644 --- a/graphql/handler/middleware/complexity.go +++ b/graphql/handler/middleware/complexity.go @@ -3,18 +3,28 @@ package middleware import ( "context" + "github.com/99designs/gqlgen/complexity" "github.com/99designs/gqlgen/graphql" "github.com/vektah/gqlparser/gqlerror" ) -// ComplexityLimit sets a maximum query complexity that is allowed to be executed. +// ComplexityLimit allows you to define a limit on query complexity // // If a query is submitted that exceeds the limit, a 422 status code will be returned. -type ComplexityLimit int +type ComplexityLimit func(ctx context.Context, rc *graphql.RequestContext) int -var _ graphql.RequestContextMutator = ComplexityLimit(0) +var _ graphql.RequestContextMutator = ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { return 0 }) func (c ComplexityLimit) MutateRequestContext(ctx context.Context, rc *graphql.RequestContext) *gqlerror.Error { - rc.ComplexityLimit = int(c) + es := graphql.GetServerContext(ctx) + op := rc.Doc.Operations.ForName(rc.OperationName) + complexity := complexity.Calculate(es, op, rc.Variables) + + limit := c(ctx, rc) + + if complexity > limit { + return gqlerror.Errorf("operation has complexity %d, which exceeds the limit of %d", complexity, limit) + } + return nil } diff --git a/graphql/handler/middleware/complexity_test.go b/graphql/handler/middleware/complexity_test.go index 016cfae0d0a..3e53be6fc8a 100644 --- a/graphql/handler/middleware/complexity_test.go +++ b/graphql/handler/middleware/complexity_test.go @@ -2,14 +2,54 @@ package middleware import ( "context" + "net/http" + "net/http/httptest" + "strings" "testing" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/testserver" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" ) -func TestComplexityLimit(t *testing.T) { - rc := &graphql.RequestContext{} - ComplexityLimit(10).MutateRequestContext(context.Background(), rc) - require.Equal(t, 10, rc.ComplexityLimit) +func TestHandlerComplexity(t *testing.T) { + h := testserver.New() + h.Use(ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { + if rc.RawQuery == "{ ok: name }" { + return 4 + } + return 2 + })) + h.AddTransport(&transport.POST{}) + + t.Run("below complexity limit", func(t *testing.T) { + h.SetCalculatedComplexity(2) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) + + t.Run("above complexity limit", func(t *testing.T) { + h.SetCalculatedComplexity(4) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"operation has complexity 4, which exceeds the limit of 2"}],"data":null}`, resp.Body.String()) + }) + + t.Run("within dynamic complexity limit", func(t *testing.T) { + h.SetCalculatedComplexity(4) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ ok: name }"}`) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) +} + +func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { + r := httptest.NewRequest(method, target, strings.NewReader(body)) + r.Header.Set("Content-Type", "application/json") + w := httptest.NewRecorder() + + handler.ServeHTTP(w, r) + return w } diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index a966cd8eb20..e9e57e864eb 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -107,7 +107,6 @@ func TestServer(t *testing.T) { require.Equal(t, "Bar", cacheDoc.(*ast.QueryDocument).Operations[0].Name) }) }) - } type opFunc func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index e5d3438773f..afd77a3c166 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -37,7 +37,11 @@ func New() *TestServer { } `}) - es := &graphql.ExecutableSchemaMock{ + srv := &TestServer{ + next: next, + } + + srv.Server = handler.New(&graphql.ExecutableSchemaMock{ QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { // Field execution happens inside the generated code, lets simulate some of it. ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ @@ -76,16 +80,17 @@ func New() *TestServer { SchemaFunc: func() *ast.Schema { return schema }, - } - return &TestServer{ - Server: handler.New(es), - next: next, - } + ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (i int, b bool) { + return srv.complexity, true + }, + }) + return srv } type TestServer struct { *handler.Server - next chan struct{} + next chan struct{} + complexity int } func (s *TestServer) SendNextSubscriptionMessage() { @@ -96,3 +101,7 @@ func (s *TestServer) SendNextSubscriptionMessage() { } } + +func (s *TestServer) SetCalculatedComplexity(complexity int) { + s.complexity = complexity +} diff --git a/handler/graphql.go b/handler/graphql.go index df574a56e9e..a38aea47254 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -67,8 +67,7 @@ func (c *Config) newRequestContext(ctx context.Context, es graphql.ExecutableSch if reqCtx.ComplexityLimit > 0 || c.complexityLimitFunc != nil { reqCtx.OperationComplexity = complexity.Calculate(es, op, variables) } - err := reqCtx.Validate(ctx) - if err != nil { + if err := reqCtx.Validate(ctx); err != nil { return nil, err } diff --git a/handler/graphql_test.go b/handler/graphql_test.go index 2b2b073d414..7b426842e07 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -1,13 +1,11 @@ package handler import ( - "context" "net/http" "net/http/httptest" "strings" "testing" - "github.com/99designs/gqlgen/graphql" "github.com/stretchr/testify/assert" ) @@ -26,52 +24,6 @@ func TestHandlerHead(t *testing.T) { assert.Equal(t, http.StatusMethodNotAllowed, resp.Code) } -func TestHandlerComplexity(t *testing.T) { - t.Run("static complexity", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{}, ComplexityLimit(2)) - - t.Run("below complexity limit", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - - t.Run("above complexity limit", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ a: me { name } b: me { name } }"}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, `{"errors":[{"message":"operation has complexity 4, which exceeds the limit of 2"}],"data":null}`, resp.Body.String()) - }) - }) - - t.Run("dynamic complexity", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{}, ComplexityLimitFunc(func(ctx context.Context) int { - reqCtx := graphql.GetRequestContext(ctx) - if strings.Contains(reqCtx.RawQuery, "dummy") { - return 4 - } - return 2 - })) - - t.Run("below complexity limit", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - - t.Run("above complexity limit", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ a: me { name } b: me { name } }"}`) - assert.Equal(t, http.StatusUnprocessableEntity, resp.Code) - assert.Equal(t, `{"errors":[{"message":"operation has complexity 4, which exceeds the limit of 2"}],"data":null}`, resp.Body.String()) - }) - - t.Run("within dynamic complexity limit", func(t *testing.T) { - resp := doRequest(h, "POST", "/graphql", `{"query":"{ a: me { name } dummy: me { name } }"}`) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) - }) - }) -} - func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { r := httptest.NewRequest(method, target, strings.NewReader(body)) r.Header.Set("Content-Type", "application/json") From e7e913d901fa72237cb1ee3dc22b7530238c8532 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Oct 2019 16:03:48 +1100 Subject: [PATCH 22/53] Remove remains of old handler package --- example/chat/server/server.go | 4 +- example/config/server/server.go | 4 +- example/dataloader/server/server.go | 4 +- example/fileupload/server/server.go | 4 +- example/scalars/server/server.go | 4 +- example/selection/server/server.go | 4 +- example/starwars/server/server.go | 4 +- example/todo/server/server.go | 4 +- .../type-system-extension/server/server.go | 4 +- .../{contest_server.go => context_server.go} | 0 graphql/handler.go | 4 +- graphql/handler/apollotracing/tracer.go | 2 +- graphql/handler/executor.go | 8 +- .../handler/{middleware => extension}/apq.go | 2 +- .../{middleware => extension}/apq_test.go | 2 +- .../{middleware => extension}/complexity.go | 2 +- .../complexity_test.go | 2 +- .../introspection.go | 2 +- .../introspection_test.go | 2 +- graphql/handler/server.go | 10 +- graphql/handler/server_test.go | 9 +- graphql/handler/transport/options.go | 26 ++ graphql/handler/transport/options_test.go | 26 ++ {handler => graphql/playground}/playground.go | 4 +- handler/graphql.go | 404 ------------------ handler/graphql_test.go | 34 -- handler/mock.go | 61 --- handler/stub.go | 51 --- integration/server/server.go | 4 +- 29 files changed, 106 insertions(+), 585 deletions(-) rename graphql/{contest_server.go => context_server.go} (100%) rename graphql/handler/{middleware => extension}/apq.go (98%) rename graphql/handler/{middleware => extension}/apq_test.go (99%) rename graphql/handler/{middleware => extension}/complexity.go (98%) rename graphql/handler/{middleware => extension}/complexity_test.go (98%) rename graphql/handler/{middleware => extension}/introspection.go (95%) rename graphql/handler/{middleware => extension}/introspection_test.go (94%) create mode 100644 graphql/handler/transport/options.go create mode 100644 graphql/handler/transport/options_test.go rename {handler => graphql/playground}/playground.go (96%) delete mode 100644 handler/graphql.go delete mode 100644 handler/graphql_test.go delete mode 100644 handler/mock.go delete mode 100644 handler/stub.go diff --git a/example/chat/server/server.go b/example/chat/server/server.go index 0bcee178723..3bc41acd96f 100644 --- a/example/chat/server/server.go +++ b/example/chat/server/server.go @@ -6,6 +6,8 @@ import ( "net/url" "time" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/chat" "github.com/99designs/gqlgen/handler" "github.com/gorilla/websocket" @@ -24,7 +26,7 @@ func main() { AllowCredentials: true, }) - http.Handle("/", handler.Playground("Todo", "/query")) + http.Handle("/", playground.Handler("Todo", "/query")) http.Handle("/query", c.Handler(handler.GraphQL(chat.NewExecutableSchema(chat.New()), handler.WebsocketUpgrader(websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { diff --git a/example/config/server/server.go b/example/config/server/server.go index 7ff1b8c8044..24c0e98bb41 100644 --- a/example/config/server/server.go +++ b/example/config/server/server.go @@ -4,12 +4,14 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/playground" + todo "github.com/99designs/gqlgen/example/config" "github.com/99designs/gqlgen/handler" ) func main() { - http.Handle("/", handler.Playground("Todo", "/query")) + http.Handle("/", playground.Handler("Todo", "/query")) http.Handle("/query", handler.GraphQL( todo.NewExecutableSchema(todo.New()), )) diff --git a/example/dataloader/server/server.go b/example/dataloader/server/server.go index 25af22c454c..fd52d248cdf 100644 --- a/example/dataloader/server/server.go +++ b/example/dataloader/server/server.go @@ -4,6 +4,8 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/dataloader" "github.com/99designs/gqlgen/handler" "github.com/go-chi/chi" @@ -13,7 +15,7 @@ func main() { router := chi.NewRouter() router.Use(dataloader.LoaderMiddleware) - router.Handle("/", handler.Playground("Dataloader", "/query")) + router.Handle("/", playground.Handler("Dataloader", "/query")) router.Handle("/query", handler.GraphQL( dataloader.NewExecutableSchema(dataloader.Config{Resolvers: &dataloader.Resolver{}}), )) diff --git a/example/fileupload/server/server.go b/example/fileupload/server/server.go index 8ad9c41b237..40c7cc5cf02 100644 --- a/example/fileupload/server/server.go +++ b/example/fileupload/server/server.go @@ -7,6 +7,8 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/fileupload" "github.com/99designs/gqlgen/example/fileupload/model" "github.com/99designs/gqlgen/graphql" @@ -14,7 +16,7 @@ import ( ) func main() { - http.Handle("/", handler.Playground("File Upload Demo", "/query")) + http.Handle("/", playground.Handler("File Upload Demo", "/query")) resolver := getResolver() exec := fileupload.NewExecutableSchema(fileupload.Config{Resolvers: resolver}) diff --git a/example/scalars/server/server.go b/example/scalars/server/server.go index 32af870a48f..7a70f2e59fc 100644 --- a/example/scalars/server/server.go +++ b/example/scalars/server/server.go @@ -4,12 +4,14 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/scalars" "github.com/99designs/gqlgen/handler" ) func main() { - http.Handle("/", handler.Playground("Starwars", "/query")) + http.Handle("/", playground.Handler("Starwars", "/query")) http.Handle("/query", handler.GraphQL(scalars.NewExecutableSchema(scalars.Config{Resolvers: &scalars.Resolver{}}))) log.Fatal(http.ListenAndServe(":8084", nil)) diff --git a/example/selection/server/server.go b/example/selection/server/server.go index 98baf6fce18..4278e7c7eea 100644 --- a/example/selection/server/server.go +++ b/example/selection/server/server.go @@ -4,12 +4,14 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/selection" "github.com/99designs/gqlgen/handler" ) func main() { - http.Handle("/", handler.Playground("Selection Demo", "/query")) + http.Handle("/", playground.Handler("Selection Demo", "/query")) http.Handle("/query", handler.GraphQL(selection.NewExecutableSchema(selection.Config{Resolvers: &selection.Resolver{}}))) log.Fatal(http.ListenAndServe(":8086", nil)) } diff --git a/example/starwars/server/server.go b/example/starwars/server/server.go index d082d3d92e9..13734ceff74 100644 --- a/example/starwars/server/server.go +++ b/example/starwars/server/server.go @@ -6,6 +6,8 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/starwars" "github.com/99designs/gqlgen/example/starwars/generated" "github.com/99designs/gqlgen/graphql" @@ -13,7 +15,7 @@ import ( ) func main() { - http.Handle("/", handler.Playground("Starwars", "/query")) + http.Handle("/", playground.Handler("Starwars", "/query")) http.Handle("/query", handler.GraphQL(generated.NewExecutableSchema(starwars.NewResolver()), handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { rc := graphql.GetResolverContext(ctx) diff --git a/example/todo/server/server.go b/example/todo/server/server.go index 6e594d79ab1..3cbe0a83d77 100644 --- a/example/todo/server/server.go +++ b/example/todo/server/server.go @@ -7,12 +7,14 @@ import ( "net/http" "runtime/debug" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/example/todo" "github.com/99designs/gqlgen/handler" ) func main() { - http.Handle("/", handler.Playground("Todo", "/query")) + http.Handle("/", playground.Handler("Todo", "/query")) http.Handle("/query", handler.GraphQL( todo.NewExecutableSchema(todo.New()), handler.RecoverFunc(func(ctx context.Context, err interface{}) error { diff --git a/example/type-system-extension/server/server.go b/example/type-system-extension/server/server.go index d214efdfeb9..2d29bdc623c 100644 --- a/example/type-system-extension/server/server.go +++ b/example/type-system-extension/server/server.go @@ -5,6 +5,8 @@ import ( "net/http" "os" + "github.com/99designs/gqlgen/graphql/playground" + extension "github.com/99designs/gqlgen/example/type-system-extension" "github.com/99designs/gqlgen/handler" ) @@ -17,7 +19,7 @@ func main() { port = defaultPort } - http.Handle("/", handler.Playground("GraphQL playground", "/query")) + http.Handle("/", playground.Handler("GraphQL playground", "/query")) http.Handle("/query", handler.GraphQL( extension.NewExecutableSchema( extension.Config{ diff --git a/graphql/contest_server.go b/graphql/context_server.go similarity index 100% rename from graphql/contest_server.go rename to graphql/context_server.go diff --git a/graphql/handler.go b/graphql/handler.go index 8b4b27ae98a..5c1d91def7f 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -32,7 +32,7 @@ type ( DispatchRequest(ctx context.Context, writer Writer) } - // HandlerPlugin interface is entirely optional, see the list of possible hook points below + // HandlerExtension interface is entirely optional, see the list of possible hook points below // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen // before working with these // @@ -44,7 +44,7 @@ type ( // | | RESPONSE { "data": { "chat": { "message": "byee" } } } | | // | +--------------------------------------------------------------------+ | // +------------------------------------------------------------------------+ - HandlerPlugin interface{} + HandlerExtension interface{} // RequestParameterMutator is called before creating a request context. allows manipulating the raw query // on the way in. diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 8373f017fcd..3aa12b76035 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -42,7 +42,7 @@ type ( var _ graphql.ResponseInterceptor = ApolloTracing{} var _ graphql.FieldInterceptor = ApolloTracing{} -func New() graphql.HandlerPlugin { +func New() graphql.HandlerExtension { return &ApolloTracing{} } diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 7a2f7f06218..8cd2937ef8f 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -33,9 +33,9 @@ func newExecutor(s *Server) executor { return next(ctx) } - // this loop goes backwards so the first plugin is the outer most middleware and runs first. - for i := len(s.plugins) - 1; i >= 0; i-- { - p := s.plugins[i] + // this loop goes backwards so the first extension is the outer most middleware and runs first. + for i := len(s.extensions) - 1; i >= 0; i-- { + p := s.extensions[i] if p, ok := p.(graphql.OperationInterceptor); ok { previous := e.operationMiddleware e.operationMiddleware = func(ctx context.Context, writer graphql.Writer) { @@ -62,7 +62,7 @@ func newExecutor(s *Server) executor { } } - for _, p := range s.plugins { + for _, p := range s.extensions { if p, ok := p.(graphql.RequestParameterMutator); ok { e.requestParamMutators = append(e.requestParamMutators, p) } diff --git a/graphql/handler/middleware/apq.go b/graphql/handler/extension/apq.go similarity index 98% rename from graphql/handler/middleware/apq.go rename to graphql/handler/extension/apq.go index 3658b2915e9..749a5e34159 100644 --- a/graphql/handler/middleware/apq.go +++ b/graphql/handler/extension/apq.go @@ -1,4 +1,4 @@ -package middleware +package extension import ( "context" diff --git a/graphql/handler/middleware/apq_test.go b/graphql/handler/extension/apq_test.go similarity index 99% rename from graphql/handler/middleware/apq_test.go rename to graphql/handler/extension/apq_test.go index e3c7fc09d32..c3e4f32aaea 100644 --- a/graphql/handler/middleware/apq_test.go +++ b/graphql/handler/extension/apq_test.go @@ -1,4 +1,4 @@ -package middleware +package extension import ( "context" diff --git a/graphql/handler/middleware/complexity.go b/graphql/handler/extension/complexity.go similarity index 98% rename from graphql/handler/middleware/complexity.go rename to graphql/handler/extension/complexity.go index b0fbbc5f298..23a975eb889 100644 --- a/graphql/handler/middleware/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -1,4 +1,4 @@ -package middleware +package extension import ( "context" diff --git a/graphql/handler/middleware/complexity_test.go b/graphql/handler/extension/complexity_test.go similarity index 98% rename from graphql/handler/middleware/complexity_test.go rename to graphql/handler/extension/complexity_test.go index 3e53be6fc8a..afadf71f5e2 100644 --- a/graphql/handler/middleware/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -1,4 +1,4 @@ -package middleware +package extension import ( "context" diff --git a/graphql/handler/middleware/introspection.go b/graphql/handler/extension/introspection.go similarity index 95% rename from graphql/handler/middleware/introspection.go rename to graphql/handler/extension/introspection.go index d53b7745662..c8376bce1d7 100644 --- a/graphql/handler/middleware/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -1,4 +1,4 @@ -package middleware +package extension import ( "context" diff --git a/graphql/handler/middleware/introspection_test.go b/graphql/handler/extension/introspection_test.go similarity index 94% rename from graphql/handler/middleware/introspection_test.go rename to graphql/handler/extension/introspection_test.go index 0bda353f843..2c9f71b76be 100644 --- a/graphql/handler/middleware/introspection_test.go +++ b/graphql/handler/extension/introspection_test.go @@ -1,4 +1,4 @@ -package middleware +package extension import ( "context" diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 50b9379033d..a73556ae779 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -13,7 +13,7 @@ type ( Server struct { es graphql.ExecutableSchema transports []graphql.Transport - plugins []graphql.HandlerPlugin + extensions []graphql.HandlerExtension exec executor errorPresenter graphql.ErrorPresenterFunc @@ -49,18 +49,18 @@ func (s *Server) SetQueryCache(cache graphql.Cache) { s.queryCache = cache } -func (s *Server) Use(plugin graphql.HandlerPlugin) { - switch plugin.(type) { +func (s *Server) Use(extension graphql.HandlerExtension) { + switch extension.(type) { case graphql.RequestParameterMutator, graphql.RequestContextMutator, graphql.OperationInterceptor, graphql.FieldInterceptor, graphql.ResponseInterceptor: - s.plugins = append(s.plugins, plugin) + s.extensions = append(s.extensions, extension) s.exec = newExecutor(s) default: - panic(fmt.Errorf("cannot Use %T as a gqlgen handler plugin because it does not implement any plugin hooks", plugin)) + panic(fmt.Errorf("cannot Use %T as a gqlgen handler extension because it does not implement any extension hooks", extension)) } } diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index e9e57e864eb..91b75eb1452 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -7,15 +7,13 @@ import ( "net/url" "testing" - "github.com/vektah/gqlparser/parser" - - "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser/ast" - "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/ast" + "github.com/vektah/gqlparser/parser" ) func TestServer(t *testing.T) { @@ -107,6 +105,7 @@ func TestServer(t *testing.T) { require.Equal(t, "Bar", cacheDoc.(*ast.QueryDocument).Operations[0].Name) }) }) + } type opFunc func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) diff --git a/graphql/handler/transport/options.go b/graphql/handler/transport/options.go new file mode 100644 index 00000000000..674a00c7f09 --- /dev/null +++ b/graphql/handler/transport/options.go @@ -0,0 +1,26 @@ +package transport + +import ( + "net/http" + + "github.com/99designs/gqlgen/graphql" +) + +// Options responds to http OPTIONS and HEAD requests +type Options struct{} + +var _ graphql.Transport = Options{} + +func (o Options) Supports(r *http.Request) bool { + return r.Method == "HEAD" || r.Method == "OPTIONS" +} + +func (o Options) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { + switch r.Method { + case http.MethodOptions: + w.WriteHeader(http.StatusOK) + w.Header().Set("Allow", "OPTIONS, GET, POST") + case http.MethodHead: + w.WriteHeader(http.StatusMethodNotAllowed) + } +} diff --git a/graphql/handler/transport/options_test.go b/graphql/handler/transport/options_test.go new file mode 100644 index 00000000000..516595f33dd --- /dev/null +++ b/graphql/handler/transport/options_test.go @@ -0,0 +1,26 @@ +package transport_test + +import ( + "net/http" + "testing" + + "github.com/99designs/gqlgen/graphql/handler/testserver" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/stretchr/testify/assert" +) + +func TestOptions(t *testing.T) { + h := testserver.New() + h.AddTransport(transport.Options{}) + + t.Run("responds to options requests", func(t *testing.T) { + resp := doRequest(h, "OPTIONS", "/graphql?query={me{name}}", ``) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, "OPTIONS, GET, POST", resp.Header().Get("Allow")) + }) + + t.Run("responds to head requests", func(t *testing.T) { + resp := doRequest(h, "HEAD", "/graphql?query={me{name}}", ``) + assert.Equal(t, http.StatusMethodNotAllowed, resp.Code) + }) +} diff --git a/handler/playground.go b/graphql/playground/playground.go similarity index 96% rename from handler/playground.go rename to graphql/playground/playground.go index 2d5f3bcbef0..45bbbd4f143 100644 --- a/handler/playground.go +++ b/graphql/playground/playground.go @@ -1,4 +1,4 @@ -package handler +package playground import ( "html/template" @@ -44,7 +44,7 @@ var page = template.Must(template.New("graphiql").Parse(` `)) -func Playground(title string, endpoint string) http.HandlerFunc { +func Handler(title string, endpoint string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "text/html") err := page.Execute(w, map[string]string{ diff --git a/handler/graphql.go b/handler/graphql.go deleted file mode 100644 index a38aea47254..00000000000 --- a/handler/graphql.go +++ /dev/null @@ -1,404 +0,0 @@ -package handler - -import ( - "context" - "encoding/json" - "fmt" - "io" - "mime" - "net/http" - "os" - "strings" - "time" - - "github.com/99designs/gqlgen/complexity" - "github.com/99designs/gqlgen/graphql" - "github.com/gorilla/websocket" - lru "github.com/hashicorp/golang-lru" - "github.com/vektah/gqlparser/ast" - "github.com/vektah/gqlparser/gqlerror" - "github.com/vektah/gqlparser/parser" - "github.com/vektah/gqlparser/validator" -) - -type params struct { - Query string `json:"query"` - OperationName string `json:"operationName"` - Variables map[string]interface{} `json:"variables"` - Extensions *extensions `json:"extensions"` -} - -type extensions struct { - PersistedQuery *persistedQuery `json:"persistedQuery"` -} - -type persistedQuery struct { - Sha256 string `json:"sha256Hash"` - Version int64 `json:"version"` -} - -type websocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error) - -type Config struct { - cacheSize int - upgrader websocket.Upgrader - recover graphql.RecoverFunc - errorPresenter graphql.ErrorPresenterFunc - resolverHook graphql.FieldMiddleware - tracer graphql.Tracer - complexityLimit int - complexityLimitFunc graphql.ComplexityLimitFunc - websocketInitFunc websocketInitFunc - disableIntrospection bool - connectionKeepAlivePingInterval time.Duration -} - -func (c *Config) newRequestContext(ctx context.Context, es graphql.ExecutableSchema, doc *ast.QueryDocument, op *ast.OperationDefinition, operationName, query string, variables map[string]interface{}) (*graphql.RequestContext, error) { - reqCtx := &graphql.RequestContext{ - Doc: doc, - RawQuery: query, - Variables: variables, - OperationName: operationName, - DisableIntrospection: c.disableIntrospection, - Recover: c.recover, - ResolverMiddleware: c.resolverHook, - ComplexityLimit: c.complexityLimit, - } - if reqCtx.ComplexityLimit > 0 || c.complexityLimitFunc != nil { - reqCtx.OperationComplexity = complexity.Calculate(es, op, variables) - } - if err := reqCtx.Validate(ctx); err != nil { - return nil, err - } - - return reqCtx, nil -} - -type Option func(cfg *Config) - -func WebsocketUpgrader(upgrader websocket.Upgrader) Option { - return func(cfg *Config) { - cfg.upgrader = upgrader - } -} - -// ResolverMiddleware allows you to define a function that will be called around every resolver, -// useful for logging. -func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { - return func(cfg *Config) { - if cfg.resolverHook == nil { - cfg.resolverHook = middleware - return - } - - lastResolve := cfg.resolverHook - cfg.resolverHook = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - return lastResolve(ctx, func(ctx context.Context) (res interface{}, err error) { - return middleware(ctx, next) - }) - } - } -} - -// WebsocketInitFunc is called when the server receives connection init message from the client. -// This can be used to check initial payload to see whether to accept the websocket connection. -func WebsocketInitFunc(websocketInitFunc websocketInitFunc) Option { - return func(cfg *Config) { - cfg.websocketInitFunc = websocketInitFunc - } -} - -// CacheSize sets the maximum size of the query cache. -// If size is less than or equal to 0, the cache is disabled. -func CacheSize(size int) Option { - return func(cfg *Config) { - cfg.cacheSize = size - } -} - -// UploadMaxSize sets the maximum number of bytes used to parse a request body -// By default, keepalive is enabled with a DefaultConnectionKeepAlivePingInterval -// duration. Set handler.connectionKeepAlivePingInterval = 0 to disable keepalive -// altogether. -func WebsocketKeepAliveDuration(duration time.Duration) Option { - return func(cfg *Config) { - cfg.connectionKeepAlivePingInterval = duration - } -} - -const DefaultCacheSize = 1000 -const DefaultConnectionKeepAlivePingInterval = 25 * time.Second - -func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc { - cfg := &Config{ - cacheSize: DefaultCacheSize, - connectionKeepAlivePingInterval: DefaultConnectionKeepAlivePingInterval, - upgrader: websocket.Upgrader{ - ReadBufferSize: 1024, - WriteBufferSize: 1024, - }, - } - - for _, option := range options { - option(cfg) - } - - var cache *lru.Cache - if cfg.cacheSize > 0 { - var err error - cache, err = lru.New(cfg.cacheSize) - if err != nil { - // An error is only returned for non-positive cache size - // and we already checked for that. - panic("unexpected error creating cache: " + err.Error()) - } - } - if cfg.tracer == nil { - cfg.tracer = &graphql.NopTracer{} - } - - handler := &graphqlHandler{ - cfg: cfg, - cache: cache, - exec: exec, - } - - return handler.ServeHTTP -} - -var _ http.Handler = (*graphqlHandler)(nil) - -type graphqlHandler struct { - cfg *Config - cache *lru.Cache - exec graphql.ExecutableSchema -} - -func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if r.Method == http.MethodOptions { - w.Header().Set("Allow", "OPTIONS, GET, POST") - w.WriteHeader(http.StatusOK) - return - } - - if strings.Contains(r.Header.Get("Upgrade"), "websocket") { - connectWs(gh.exec, w, r, gh.cfg, gh.cache) - return - } - - w.Header().Set("Content-Type", "application/json") - var reqParams params - switch r.Method { - case http.MethodGet: - reqParams.Query = r.URL.Query().Get("query") - reqParams.OperationName = r.URL.Query().Get("operationName") - - if variables := r.URL.Query().Get("variables"); variables != "" { - if err := jsonDecode(strings.NewReader(variables), &reqParams.Variables); err != nil { - sendErrorf(w, http.StatusBadRequest, "variables could not be decoded") - return - } - } - - if extensions := r.URL.Query().Get("extensions"); extensions != "" { - if err := jsonDecode(strings.NewReader(extensions), &reqParams.Extensions); err != nil { - sendErrorf(w, http.StatusBadRequest, "extensions could not be decoded") - return - } - } - case http.MethodPost: - mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) - if err != nil { - sendErrorf(w, http.StatusBadRequest, "error parsing request Content-Type") - return - } - - switch mediaType { - case "application/json": - if err := jsonDecode(r.Body, &reqParams); err != nil { - sendErrorf(w, http.StatusBadRequest, "json body could not be decoded: "+err.Error()) - return - } - - case "multipart/form-data": - var closers []io.Closer - var tmpFiles []string - defer func() { - for i := len(closers) - 1; 0 <= i; i-- { - _ = closers[i].Close() - } - for _, tmpFile := range tmpFiles { - _ = os.Remove(tmpFile) - } - }() - if err := processMultipart(w, r, &reqParams, &closers, &tmpFiles, gh.cfg.uploadMaxSize, gh.cfg.uploadMaxMemory); err != nil { - sendErrorf(w, http.StatusBadRequest, "multipart body could not be decoded: "+err.Error()) - return - } - default: - sendErrorf(w, http.StatusBadRequest, "unsupported Content-Type: "+mediaType) - return - } - default: - w.WriteHeader(http.StatusMethodNotAllowed) - return - } - - ctx := r.Context() - - if reqParams.Query == "" { - sendErrorf(w, http.StatusUnprocessableEntity, "Must provide query string") - return - } - - var doc *ast.QueryDocument - var cacheHit bool - if gh.cache != nil { - val, ok := gh.cache.Get(reqParams.Query) - if ok { - doc = val.(*ast.QueryDocument) - cacheHit = true - } - } - - ctx, doc, gqlErr := gh.parseOperation(ctx, &parseOperationArgs{ - Query: reqParams.Query, - CachedDoc: doc, - }) - if gqlErr != nil { - sendError(w, http.StatusUnprocessableEntity, gqlErr) - return - } - - ctx, op, vars, listErr := gh.validateOperation(ctx, &validateOperationArgs{ - Doc: doc, - OperationName: reqParams.OperationName, - CacheHit: cacheHit, - R: r, - Variables: reqParams.Variables, - }) - if len(listErr) != 0 { - sendError(w, http.StatusUnprocessableEntity, listErr...) - return - } - - if gh.cache != nil && !cacheHit { - gh.cache.Add(reqParams.Query, doc) - } - - reqCtx, err := gh.cfg.newRequestContext(ctx, gh.exec, doc, op, reqParams.OperationName, reqParams.Query, vars) - if err != nil { - sendErrorf(w, http.StatusBadRequest, "invalid RequestContext was generated: %s", err.Error()) - return - } - ctx = graphql.WithRequestContext(ctx, reqCtx) - - defer func() { - if err := recover(); err != nil { - userErr := reqCtx.Recover(ctx, err) - sendErrorf(w, http.StatusUnprocessableEntity, userErr.Error()) - } - }() - - if gh.cfg.complexityLimitFunc != nil { - reqCtx.ComplexityLimit = gh.cfg.complexityLimitFunc(ctx) - } - - if reqCtx.ComplexityLimit > 0 && reqCtx.OperationComplexity > reqCtx.ComplexityLimit { - sendErrorf(w, http.StatusUnprocessableEntity, "operation has complexity %d, which exceeds the limit of %d", reqCtx.OperationComplexity, reqCtx.ComplexityLimit) - return - } - - switch op.Operation { - case ast.Query: - b, err := json.Marshal(gh.exec.Query(ctx, op)) - if err != nil { - panic(err) - } - w.Write(b) - case ast.Mutation: - b, err := json.Marshal(gh.exec.Mutation(ctx, op)) - if err != nil { - panic(err) - } - w.Write(b) - default: - sendErrorf(w, http.StatusBadRequest, "unsupported operation type") - } -} - -type parseOperationArgs struct { - Query string - CachedDoc *ast.QueryDocument -} - -func (gh *graphqlHandler) parseOperation(ctx context.Context, args *parseOperationArgs) (context.Context, *ast.QueryDocument, *gqlerror.Error) { - ctx = gh.cfg.tracer.StartOperationParsing(ctx) - defer func() { gh.cfg.tracer.EndOperationParsing(ctx) }() - - if args.CachedDoc != nil { - return ctx, args.CachedDoc, nil - } - - doc, gqlErr := parser.ParseQuery(&ast.Source{Input: args.Query}) - if gqlErr != nil { - return ctx, nil, gqlErr - } - - return ctx, doc, nil -} - -type validateOperationArgs struct { - Doc *ast.QueryDocument - OperationName string - CacheHit bool - R *http.Request - Variables map[string]interface{} -} - -func (gh *graphqlHandler) validateOperation(ctx context.Context, args *validateOperationArgs) (context.Context, *ast.OperationDefinition, map[string]interface{}, gqlerror.List) { - ctx = gh.cfg.tracer.StartOperationValidation(ctx) - defer func() { gh.cfg.tracer.EndOperationValidation(ctx) }() - - if !args.CacheHit { - listErr := validator.Validate(gh.exec.Schema(), args.Doc) - if len(listErr) != 0 { - return ctx, nil, nil, listErr - } - } - - op := args.Doc.Operations.ForName(args.OperationName) - if op == nil { - return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("operation %s not found", args.OperationName)} - } - - if op.Operation != ast.Query && args.R.Method == http.MethodGet { - return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("GET requests only allow query operations")} - } - - vars, err := validator.VariableValues(gh.exec.Schema(), op, args.Variables) - if err != nil { - return ctx, nil, nil, gqlerror.List{err} - } - - return ctx, op, vars, nil -} - -func jsonDecode(r io.Reader, val interface{}) error { - dec := json.NewDecoder(r) - dec.UseNumber() - return dec.Decode(val) -} - -func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { - w.WriteHeader(code) - b, err := json.Marshal(&graphql.Response{Errors: errors}) - if err != nil { - panic(err) - } - w.Write(b) -} - -func sendErrorf(w http.ResponseWriter, code int, format string, args ...interface{}) { - sendError(w, code, &gqlerror.Error{Message: fmt.Sprintf(format, args...)}) -} diff --git a/handler/graphql_test.go b/handler/graphql_test.go deleted file mode 100644 index 7b426842e07..00000000000 --- a/handler/graphql_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package handler - -import ( - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHandlerOptions(t *testing.T) { - h := GraphQL(&executableSchemaStub{}) - - resp := doRequest(h, "OPTIONS", "/graphql?query={me{name}}", ``) - assert.Equal(t, http.StatusOK, resp.Code) - assert.Equal(t, "OPTIONS, GET, POST", resp.Header().Get("Allow")) -} - -func TestHandlerHead(t *testing.T) { - h := GraphQL(&executableSchemaStub{}) - - resp := doRequest(h, "HEAD", "/graphql?query={me{name}}", ``) - assert.Equal(t, http.StatusMethodNotAllowed, resp.Code) -} - -func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { - r := httptest.NewRequest(method, target, strings.NewReader(body)) - r.Header.Set("Content-Type", "application/json") - w := httptest.NewRecorder() - - handler.ServeHTTP(w, r) - return w -} diff --git a/handler/mock.go b/handler/mock.go deleted file mode 100644 index a3d73bd1902..00000000000 --- a/handler/mock.go +++ /dev/null @@ -1,61 +0,0 @@ -package handler - -import ( - "context" - - "github.com/99designs/gqlgen/graphql" - "github.com/vektah/gqlparser" - "github.com/vektah/gqlparser/ast" -) - -type executableSchemaMock struct { - QueryFunc func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response - MutationFunc func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response -} - -var _ graphql.ExecutableSchema = &executableSchemaMock{} - -func (e *executableSchemaMock) Schema() *ast.Schema { - return gqlparser.MustLoadSchema(&ast.Source{Input: ` - schema { query: Query, mutation: Mutation } - type Query { - empty: String! - } - scalar Upload - type File { - id: Int! - } - input UploadFile { - id: Int! - file: Upload! - } - type Mutation { - singleUpload(file: Upload!): File! - singleUploadWithPayload(req: UploadFile!): File! - multipleUpload(files: [Upload!]!): [File!]! - multipleUploadWithPayload(req: [UploadFile!]!): [File!]! - } - `}) -} - -func (e *executableSchemaMock) Complexity(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) { - return 0, false -} - -func (e *executableSchemaMock) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - if e.QueryFunc == nil { - return graphql.ErrorResponse(ctx, "queries are not supported") - } - return e.QueryFunc(ctx, op) -} - -func (e *executableSchemaMock) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return e.MutationFunc(ctx, op) -} - -func (e *executableSchemaMock) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return func() *graphql.Response { - <-ctx.Done() - return nil - } -} diff --git a/handler/stub.go b/handler/stub.go deleted file mode 100644 index d237e188921..00000000000 --- a/handler/stub.go +++ /dev/null @@ -1,51 +0,0 @@ -package handler - -import ( - "context" - - "github.com/99designs/gqlgen/graphql" - "github.com/vektah/gqlparser" - "github.com/vektah/gqlparser/ast" -) - -type executableSchemaStub struct { - NextResp chan struct{} -} - -var _ graphql.ExecutableSchema = &executableSchemaStub{} - -func (e *executableSchemaStub) Schema() *ast.Schema { - return gqlparser.MustLoadSchema(&ast.Source{Input: ` - schema { query: Query } - type Query { - me: User! - user(id: Int): User! - } - type User { name: String! } - `}) -} - -func (e *executableSchemaStub) Complexity(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) { - return 0, false -} - -func (e *executableSchemaStub) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return &graphql.Response{Data: []byte(`{"name":"test"}`)} -} - -func (e *executableSchemaStub) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") -} - -func (e *executableSchemaStub) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return func() *graphql.Response { - select { - case <-ctx.Done(): - return nil - case <-e.NextResp: - return &graphql.Response{ - Data: []byte(`{"name":"test"}`), - } - } - } -} diff --git a/integration/server/server.go b/integration/server/server.go index 63e31b96e45..64a91bf48a6 100644 --- a/integration/server/server.go +++ b/integration/server/server.go @@ -6,6 +6,8 @@ import ( "net/http" "os" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/handler" "github.com/99designs/gqlgen/integration" @@ -27,7 +29,7 @@ func main() { // function is executed. return value } - http.Handle("/", handler.Playground("GraphQL playground", "/query")) + http.Handle("/", playground.Handler("GraphQL playground", "/query")) http.Handle("/query", handler.GraphQL( integration.NewExecutableSchema(cfg), handler.ErrorPresenter(func(ctx context.Context, e error) *gqlerror.Error { From c7bb03a8fd9b43c47f52b1beafb872d7aee65280 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 1 Nov 2019 15:52:52 +1100 Subject: [PATCH 23/53] merge executable schema entrypoints --- graphql/context_request.go | 1 + graphql/context_response.go | 5 +- graphql/esmock.go | 279 -------------------- graphql/{exec.go => executable_schema.go} | 6 +- graphql/executable_schema_mock.go | 175 ++++++++++++ graphql/handler/apollotracing/tracer.go | 4 + graphql/handler/executor.go | 118 ++++----- graphql/handler/testserver/testserver.go | 73 ++--- graphql/handler/transport/http_form_test.go | 29 +- graphql/handler/transport/websocket_test.go | 4 +- graphql/oneshot.go | 6 +- 11 files changed, 300 insertions(+), 400 deletions(-) delete mode 100644 graphql/esmock.go rename graphql/{exec.go => executable_schema.go} (92%) create mode 100644 graphql/executable_schema_mock.go diff --git a/graphql/context_request.go b/graphql/context_request.go index bd37ab0374e..7a1eb1a7022 100644 --- a/graphql/context_request.go +++ b/graphql/context_request.go @@ -13,6 +13,7 @@ type RequestContext struct { OperationName string Doc *ast.QueryDocument + Operation *ast.OperationDefinition DisableIntrospection bool Recover RecoverFunc ResolverMiddleware FieldMiddleware diff --git a/graphql/context_response.go b/graphql/context_response.go index ae0910c0dbc..e88e2b6c1b2 100644 --- a/graphql/context_response.go +++ b/graphql/context_response.go @@ -22,7 +22,10 @@ type responseContext struct { const resultCtx key = "result_context" func getResponseContext(ctx context.Context) *responseContext { - val, _ := ctx.Value(resultCtx).(*responseContext) + val, ok := ctx.Value(resultCtx).(*responseContext) + if !ok { + panic("missing response context") + } return val } diff --git a/graphql/esmock.go b/graphql/esmock.go deleted file mode 100644 index 4064c8ba05f..00000000000 --- a/graphql/esmock.go +++ /dev/null @@ -1,279 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package graphql - -import ( - "context" - "github.com/vektah/gqlparser/ast" - "sync" -) - -var ( - lockExecutableSchemaMockComplexity sync.RWMutex - lockExecutableSchemaMockMutation sync.RWMutex - lockExecutableSchemaMockQuery sync.RWMutex - lockExecutableSchemaMockSchema sync.RWMutex - lockExecutableSchemaMockSubscription sync.RWMutex -) - -// Ensure, that ExecutableSchemaMock does implement ExecutableSchema. -// If this is not the case, regenerate this file with moq. -var _ ExecutableSchema = &ExecutableSchemaMock{} - -// ExecutableSchemaMock is a mock implementation of ExecutableSchema. -// -// func TestSomethingThatUsesExecutableSchema(t *testing.T) { -// -// // make and configure a mocked ExecutableSchema -// mockedExecutableSchema := &ExecutableSchemaMock{ -// ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { -// panic("mock out the Complexity method") -// }, -// MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *Response { -// panic("mock out the Mutation method") -// }, -// QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *Response { -// panic("mock out the Query method") -// }, -// SchemaFunc: func() *ast.Schema { -// panic("mock out the Schema method") -// }, -// SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *Response { -// panic("mock out the Subscription method") -// }, -// } -// -// // use mockedExecutableSchema in code that requires ExecutableSchema -// // and then make assertions. -// -// } -type ExecutableSchemaMock struct { - // ComplexityFunc mocks the Complexity method. - ComplexityFunc func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) - - // MutationFunc mocks the Mutation method. - MutationFunc func(ctx context.Context, op *ast.OperationDefinition) *Response - - // QueryFunc mocks the Query method. - QueryFunc func(ctx context.Context, op *ast.OperationDefinition) *Response - - // SchemaFunc mocks the Schema method. - SchemaFunc func() *ast.Schema - - // SubscriptionFunc mocks the Subscription method. - SubscriptionFunc func(ctx context.Context, op *ast.OperationDefinition) func() *Response - - // calls tracks calls to the methods. - calls struct { - // Complexity holds details about calls to the Complexity method. - Complexity []struct { - // TypeName is the typeName argument value. - TypeName string - // FieldName is the fieldName argument value. - FieldName string - // ChildComplexity is the childComplexity argument value. - ChildComplexity int - // Args is the args argument value. - Args map[string]interface{} - } - // Mutation holds details about calls to the Mutation method. - Mutation []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Op is the op argument value. - Op *ast.OperationDefinition - } - // Query holds details about calls to the Query method. - Query []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Op is the op argument value. - Op *ast.OperationDefinition - } - // Schema holds details about calls to the Schema method. - Schema []struct { - } - // Subscription holds details about calls to the Subscription method. - Subscription []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Op is the op argument value. - Op *ast.OperationDefinition - } - } -} - -// Complexity calls ComplexityFunc. -func (mock *ExecutableSchemaMock) Complexity(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { - if mock.ComplexityFunc == nil { - panic("ExecutableSchemaMock.ComplexityFunc: method is nil but ExecutableSchema.Complexity was just called") - } - callInfo := struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} - }{ - TypeName: typeName, - FieldName: fieldName, - ChildComplexity: childComplexity, - Args: args, - } - lockExecutableSchemaMockComplexity.Lock() - mock.calls.Complexity = append(mock.calls.Complexity, callInfo) - lockExecutableSchemaMockComplexity.Unlock() - return mock.ComplexityFunc(typeName, fieldName, childComplexity, args) -} - -// ComplexityCalls gets all the calls that were made to Complexity. -// Check the length with: -// len(mockedExecutableSchema.ComplexityCalls()) -func (mock *ExecutableSchemaMock) ComplexityCalls() []struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} -} { - var calls []struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} - } - lockExecutableSchemaMockComplexity.RLock() - calls = mock.calls.Complexity - lockExecutableSchemaMockComplexity.RUnlock() - return calls -} - -// Mutation calls MutationFunc. -func (mock *ExecutableSchemaMock) Mutation(ctx context.Context, op *ast.OperationDefinition) *Response { - if mock.MutationFunc == nil { - panic("ExecutableSchemaMock.MutationFunc: method is nil but ExecutableSchema.Mutation was just called") - } - callInfo := struct { - Ctx context.Context - Op *ast.OperationDefinition - }{ - Ctx: ctx, - Op: op, - } - lockExecutableSchemaMockMutation.Lock() - mock.calls.Mutation = append(mock.calls.Mutation, callInfo) - lockExecutableSchemaMockMutation.Unlock() - return mock.MutationFunc(ctx, op) -} - -// MutationCalls gets all the calls that were made to Mutation. -// Check the length with: -// len(mockedExecutableSchema.MutationCalls()) -func (mock *ExecutableSchemaMock) MutationCalls() []struct { - Ctx context.Context - Op *ast.OperationDefinition -} { - var calls []struct { - Ctx context.Context - Op *ast.OperationDefinition - } - lockExecutableSchemaMockMutation.RLock() - calls = mock.calls.Mutation - lockExecutableSchemaMockMutation.RUnlock() - return calls -} - -// Query calls QueryFunc. -func (mock *ExecutableSchemaMock) Query(ctx context.Context, op *ast.OperationDefinition) *Response { - if mock.QueryFunc == nil { - panic("ExecutableSchemaMock.QueryFunc: method is nil but ExecutableSchema.Query was just called") - } - callInfo := struct { - Ctx context.Context - Op *ast.OperationDefinition - }{ - Ctx: ctx, - Op: op, - } - lockExecutableSchemaMockQuery.Lock() - mock.calls.Query = append(mock.calls.Query, callInfo) - lockExecutableSchemaMockQuery.Unlock() - return mock.QueryFunc(ctx, op) -} - -// QueryCalls gets all the calls that were made to Query. -// Check the length with: -// len(mockedExecutableSchema.QueryCalls()) -func (mock *ExecutableSchemaMock) QueryCalls() []struct { - Ctx context.Context - Op *ast.OperationDefinition -} { - var calls []struct { - Ctx context.Context - Op *ast.OperationDefinition - } - lockExecutableSchemaMockQuery.RLock() - calls = mock.calls.Query - lockExecutableSchemaMockQuery.RUnlock() - return calls -} - -// Schema calls SchemaFunc. -func (mock *ExecutableSchemaMock) Schema() *ast.Schema { - if mock.SchemaFunc == nil { - panic("ExecutableSchemaMock.SchemaFunc: method is nil but ExecutableSchema.Schema was just called") - } - callInfo := struct { - }{} - lockExecutableSchemaMockSchema.Lock() - mock.calls.Schema = append(mock.calls.Schema, callInfo) - lockExecutableSchemaMockSchema.Unlock() - return mock.SchemaFunc() -} - -// SchemaCalls gets all the calls that were made to Schema. -// Check the length with: -// len(mockedExecutableSchema.SchemaCalls()) -func (mock *ExecutableSchemaMock) SchemaCalls() []struct { -} { - var calls []struct { - } - lockExecutableSchemaMockSchema.RLock() - calls = mock.calls.Schema - lockExecutableSchemaMockSchema.RUnlock() - return calls -} - -// Subscription calls SubscriptionFunc. -func (mock *ExecutableSchemaMock) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *Response { - if mock.SubscriptionFunc == nil { - panic("ExecutableSchemaMock.SubscriptionFunc: method is nil but ExecutableSchema.Subscription was just called") - } - callInfo := struct { - Ctx context.Context - Op *ast.OperationDefinition - }{ - Ctx: ctx, - Op: op, - } - lockExecutableSchemaMockSubscription.Lock() - mock.calls.Subscription = append(mock.calls.Subscription, callInfo) - lockExecutableSchemaMockSubscription.Unlock() - return mock.SubscriptionFunc(ctx, op) -} - -// SubscriptionCalls gets all the calls that were made to Subscription. -// Check the length with: -// len(mockedExecutableSchema.SubscriptionCalls()) -func (mock *ExecutableSchemaMock) SubscriptionCalls() []struct { - Ctx context.Context - Op *ast.OperationDefinition -} { - var calls []struct { - Ctx context.Context - Op *ast.OperationDefinition - } - lockExecutableSchemaMockSubscription.RLock() - calls = mock.calls.Subscription - lockExecutableSchemaMockSubscription.RUnlock() - return calls -} diff --git a/graphql/exec.go b/graphql/executable_schema.go similarity index 92% rename from graphql/exec.go rename to graphql/executable_schema.go index 6ebc5b1a626..c647f575044 100644 --- a/graphql/exec.go +++ b/graphql/executable_schema.go @@ -1,4 +1,4 @@ -//go:generate go run github.com/matryer/moq -out esmock.go . ExecutableSchema +//go:generate go run github.com/matryer/moq -out executable_schema_mock.go . ExecutableSchema package graphql @@ -13,9 +13,7 @@ type ExecutableSchema interface { Schema() *ast.Schema Complexity(typeName, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) - Query(ctx context.Context, op *ast.OperationDefinition) *Response - Mutation(ctx context.Context, op *ast.OperationDefinition) *Response - Subscription(ctx context.Context, op *ast.OperationDefinition) func() *Response + Exec(ctx context.Context) ResponseHandler } // CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types diff --git a/graphql/executable_schema_mock.go b/graphql/executable_schema_mock.go new file mode 100644 index 00000000000..c099de793e9 --- /dev/null +++ b/graphql/executable_schema_mock.go @@ -0,0 +1,175 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package graphql + +import ( + "context" + "github.com/vektah/gqlparser/ast" + "sync" +) + +var ( + lockExecutableSchemaMockComplexity sync.RWMutex + lockExecutableSchemaMockExec sync.RWMutex + lockExecutableSchemaMockSchema sync.RWMutex +) + +// Ensure, that ExecutableSchemaMock does implement ExecutableSchema. +// If this is not the case, regenerate this file with moq. +var _ ExecutableSchema = &ExecutableSchemaMock{} + +// ExecutableSchemaMock is a mock implementation of ExecutableSchema. +// +// func TestSomethingThatUsesExecutableSchema(t *testing.T) { +// +// // make and configure a mocked ExecutableSchema +// mockedExecutableSchema := &ExecutableSchemaMock{ +// ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { +// panic("mock out the Complexity method") +// }, +// ExecFunc: func(ctx context.Context) ResponseHandler { +// panic("mock out the Exec method") +// }, +// SchemaFunc: func() *ast.Schema { +// panic("mock out the Schema method") +// }, +// } +// +// // use mockedExecutableSchema in code that requires ExecutableSchema +// // and then make assertions. +// +// } +type ExecutableSchemaMock struct { + // ComplexityFunc mocks the Complexity method. + ComplexityFunc func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) + + // ExecFunc mocks the Exec method. + ExecFunc func(ctx context.Context) ResponseHandler + + // SchemaFunc mocks the Schema method. + SchemaFunc func() *ast.Schema + + // calls tracks calls to the methods. + calls struct { + // Complexity holds details about calls to the Complexity method. + Complexity []struct { + // TypeName is the typeName argument value. + TypeName string + // FieldName is the fieldName argument value. + FieldName string + // ChildComplexity is the childComplexity argument value. + ChildComplexity int + // Args is the args argument value. + Args map[string]interface{} + } + // Exec holds details about calls to the Exec method. + Exec []struct { + // Ctx is the ctx argument value. + Ctx context.Context + } + // Schema holds details about calls to the Schema method. + Schema []struct { + } + } +} + +// Complexity calls ComplexityFunc. +func (mock *ExecutableSchemaMock) Complexity(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { + if mock.ComplexityFunc == nil { + panic("ExecutableSchemaMock.ComplexityFunc: method is nil but ExecutableSchema.Complexity was just called") + } + callInfo := struct { + TypeName string + FieldName string + ChildComplexity int + Args map[string]interface{} + }{ + TypeName: typeName, + FieldName: fieldName, + ChildComplexity: childComplexity, + Args: args, + } + lockExecutableSchemaMockComplexity.Lock() + mock.calls.Complexity = append(mock.calls.Complexity, callInfo) + lockExecutableSchemaMockComplexity.Unlock() + return mock.ComplexityFunc(typeName, fieldName, childComplexity, args) +} + +// ComplexityCalls gets all the calls that were made to Complexity. +// Check the length with: +// len(mockedExecutableSchema.ComplexityCalls()) +func (mock *ExecutableSchemaMock) ComplexityCalls() []struct { + TypeName string + FieldName string + ChildComplexity int + Args map[string]interface{} +} { + var calls []struct { + TypeName string + FieldName string + ChildComplexity int + Args map[string]interface{} + } + lockExecutableSchemaMockComplexity.RLock() + calls = mock.calls.Complexity + lockExecutableSchemaMockComplexity.RUnlock() + return calls +} + +// Exec calls ExecFunc. +func (mock *ExecutableSchemaMock) Exec(ctx context.Context) ResponseHandler { + if mock.ExecFunc == nil { + panic("ExecutableSchemaMock.ExecFunc: method is nil but ExecutableSchema.Exec was just called") + } + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + lockExecutableSchemaMockExec.Lock() + mock.calls.Exec = append(mock.calls.Exec, callInfo) + lockExecutableSchemaMockExec.Unlock() + return mock.ExecFunc(ctx) +} + +// ExecCalls gets all the calls that were made to Exec. +// Check the length with: +// len(mockedExecutableSchema.ExecCalls()) +func (mock *ExecutableSchemaMock) ExecCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + lockExecutableSchemaMockExec.RLock() + calls = mock.calls.Exec + lockExecutableSchemaMockExec.RUnlock() + return calls +} + +// Schema calls SchemaFunc. +func (mock *ExecutableSchemaMock) Schema() *ast.Schema { + if mock.SchemaFunc == nil { + panic("ExecutableSchemaMock.SchemaFunc: method is nil but ExecutableSchema.Schema was just called") + } + callInfo := struct { + }{} + lockExecutableSchemaMockSchema.Lock() + mock.calls.Schema = append(mock.calls.Schema, callInfo) + lockExecutableSchemaMockSchema.Unlock() + return mock.SchemaFunc() +} + +// SchemaCalls gets all the calls that were made to Schema. +// Check the length with: +// len(mockedExecutableSchema.SchemaCalls()) +func (mock *ExecutableSchemaMock) SchemaCalls() []struct { +} { + var calls []struct { + } + lockExecutableSchemaMockSchema.RLock() + calls = mock.calls.Schema + lockExecutableSchemaMockSchema.RUnlock() + return calls +} diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 3aa12b76035..6d066e1fcf6 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -2,6 +2,8 @@ package apollotracing import ( "context" + "fmt" + "runtime/debug" "sync" "time" @@ -100,6 +102,8 @@ func (a ApolloTracing) InterceptResponse(ctx context.Context, next graphql.Respo graphql.RegisterExtension(ctx, "tracing", td) + fmt.Println("AAAAAAAAAAa") + debug.PrintStack() resp := next(ctx) end := graphql.Now() diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 8cd2937ef8f..8125fb303c5 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -12,8 +12,8 @@ import ( type executor struct { operationMiddleware graphql.OperationHandler - resultHandler graphql.ResponseMiddleware - responseMiddleware graphql.FieldMiddleware + responseMiddleware graphql.ResponseMiddleware + fieldMiddleware graphql.FieldMiddleware requestParamMutators []graphql.RequestParameterMutator requestContextMutators []graphql.RequestContextMutator server *Server @@ -26,10 +26,10 @@ func newExecutor(s *Server) executor { server: s, } e.operationMiddleware = e.executableSchemaHandler - e.resultHandler = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + e.responseMiddleware = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { return next(ctx) } - e.responseMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + e.fieldMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { return next(ctx) } @@ -44,8 +44,8 @@ func newExecutor(s *Server) executor { } if p, ok := p.(graphql.ResponseInterceptor); ok { - previous := e.resultHandler - e.resultHandler = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + previous := e.responseMiddleware + e.responseMiddleware = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { return p.InterceptResponse(ctx, func(ctx context.Context) *graphql.Response { return previous(ctx, next) }) @@ -53,8 +53,8 @@ func newExecutor(s *Server) executor { } if p, ok := p.(graphql.FieldInterceptor); ok { - previous := e.responseMiddleware - e.responseMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + previous := e.fieldMiddleware + e.fieldMiddleware = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { return p.InterceptField(ctx, func(ctx context.Context) (res interface{}, err error) { return previous(ctx, next) }) @@ -83,39 +83,43 @@ func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { ctx = graphql.WithServerContext(ctx, e.server.es) + stats := graphql.Stats{ + OperationStart: graphql.GetStartTime(ctx), + } for _, p := range e.requestParamMutators { if err := p.MutateRequestParameters(ctx, params); err != nil { return nil, gqlerror.List{err} } } - rc := &graphql.RequestContext{ - DisableIntrospection: true, - Recover: graphql.DefaultRecover, - ResolverMiddleware: e.responseMiddleware, - RawQuery: params.Query, - OperationName: params.OperationName, - Variables: params.Variables, - } - rc.Stats.OperationStart = graphql.GetStartTime(ctx) - - var listErr gqlerror.List - rc.Doc, listErr = e.parseQuery(ctx, rc) + doc, listErr := e.parseQuery(ctx, &stats, params.Query) if len(listErr) != 0 { return nil, listErr } - op := rc.Doc.Operations.ForName(rc.OperationName) + op := doc.Operations.ForName(params.OperationName) if op == nil { - return nil, gqlerror.List{gqlerror.Errorf("operation %s not found", rc.OperationName)} + return nil, gqlerror.List{gqlerror.Errorf("operation %s not found", params.OperationName)} } - vars, err := validator.VariableValues(e.server.es.Schema(), op, rc.Variables) + vars, err := validator.VariableValues(e.server.es.Schema(), op, params.Variables) if err != nil { return nil, gqlerror.List{err} } - rc.Stats.Validation.End = graphql.Now() - rc.Variables = vars + stats.Validation.End = graphql.Now() + + rc := &graphql.RequestContext{ + RawQuery: params.Query, + Variables: vars, + OperationName: params.OperationName, + Doc: doc, + Operation: op, + DisableIntrospection: true, + Recover: graphql.DefaultRecover, + ResolverMiddleware: e.fieldMiddleware, + DirectiveMiddleware: nil, //todo fixme + Stats: stats, + } for _, p := range e.requestContextMutators { if err := p.MutateRequestContext(ctx, rc); err != nil { @@ -138,45 +142,21 @@ func (e *executor) write(ctx context.Context, resp *graphql.Response, writer gra // executableSchemaHandler is the inner most operation handler, it invokes the graph directly after all middleware // and sends responses to the transport so it can be returned to the client func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Writer) { - rc := graphql.GetRequestContext(ctx) - - op := rc.Doc.Operations.ForName(rc.OperationName) - - switch op.Operation { - case ast.Query: - resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) - resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { - return e.server.es.Query(ctx, op) - }) - e.write(resCtx, resp, write) - - case ast.Mutation: + responses := e.server.es.Exec(ctx) + for { resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) - resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { - return e.server.es.Mutation(ctx, op) - }) - e.write(resCtx, resp, write) - - case ast.Subscription: - responses := e.server.es.Subscription(ctx, op) - for { - resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) - resp := e.resultHandler(resCtx, func(ctx context.Context) *graphql.Response { - resp := responses() - if resp == nil { - return nil - } - resp.Extensions = graphql.GetExtensions(ctx) - return resp - }) + resp := e.responseMiddleware(resCtx, func(ctx context.Context) *graphql.Response { + resp := responses(resCtx) if resp == nil { - break + return nil } - e.write(resCtx, resp, write) + resp.Extensions = graphql.GetExtensions(ctx) + return resp + }) + if resp == nil { + break } - - default: - write(graphql.StatusValidationError, graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + e.write(resCtx, resp, write) } } @@ -184,30 +164,30 @@ func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Wr // // NOTE: This should NOT look at variables, they will change per request. It should only parse and validate // the raw query string. -func (e executor) parseQuery(ctx context.Context, rc *graphql.RequestContext) (*ast.QueryDocument, gqlerror.List) { - rc.Stats.Parsing.Start = graphql.Now() +func (e executor) parseQuery(ctx context.Context, stats *graphql.Stats, query string) (*ast.QueryDocument, gqlerror.List) { + stats.Parsing.Start = graphql.Now() - if doc, ok := e.server.queryCache.Get(rc.RawQuery); ok { + if doc, ok := e.server.queryCache.Get(query); ok { now := graphql.Now() - rc.Stats.Parsing.End = now - rc.Stats.Validation.Start = now + stats.Parsing.End = now + stats.Validation.Start = now return doc.(*ast.QueryDocument), nil } - doc, err := parser.ParseQuery(&ast.Source{Input: rc.RawQuery}) + doc, err := parser.ParseQuery(&ast.Source{Input: query}) if err != nil { return nil, gqlerror.List{err} } - rc.Stats.Parsing.End = graphql.Now() + stats.Parsing.End = graphql.Now() - rc.Stats.Validation.Start = graphql.Now() + stats.Validation.Start = graphql.Now() listErr := validator.Validate(e.server.es.Schema(), doc) if len(listErr) != 0 { return nil, listErr } - e.server.queryCache.Add(rc.RawQuery, doc) + e.server.queryCache.Add(query, doc) return doc, nil } diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index afd77a3c166..c31b193ef32 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -42,39 +42,50 @@ func New() *TestServer { } srv.Server = handler.New(&graphql.ExecutableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - // Field execution happens inside the generated code, lets simulate some of it. - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ - Object: "Query", - Field: graphql.CollectedField{ - Field: &ast.Field{ - Name: "name", - Alias: "name", - Definition: schema.Types["Query"].Fields.ForName("name"), - }, - }, - }) - res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { - return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil - }) - if err != nil { - panic(err) - } - return res.(*graphql.Response) - }, - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") - }, - SubscriptionFunc: func(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return func() *graphql.Response { - select { - case <-ctx.Done(): - return nil - case <-next: - return &graphql.Response{ - Data: []byte(`{"name":"test"}`), + ExecFunc: func(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + switch rc.Operation.Operation { + case ast.Query: + ran := false + return func(ctx context.Context) *graphql.Response { + if ran { + return nil + } + ran = true + // Field execution happens inside the generated code, lets simulate some of it. + ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + Object: "Query", + Field: graphql.CollectedField{ + Field: &ast.Field{ + Name: "name", + Alias: "name", + Definition: schema.Types["Query"].Fields.ForName("name"), + }, + }, + }) + res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { + return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil + }) + if err != nil { + panic(err) + } + return res.(*graphql.Response) + } + case ast.Mutation: + return graphql.OneShot(graphql.ErrorResponse(ctx, "mutations are not supported")) + case ast.Subscription: + return func(context context.Context) *graphql.Response { + select { + case <-ctx.Done(): + return nil + case <-next: + return &graphql.Response{ + Data: []byte(`{"name":"test"}`), + } } } + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } }, SchemaFunc: func() *ast.Schema { diff --git a/graphql/handler/transport/http_form_test.go b/graphql/handler/transport/http_form_test.go index 1974594e283..5533a8fdb32 100644 --- a/graphql/handler/transport/http_form_test.go +++ b/graphql/handler/transport/http_form_test.go @@ -19,8 +19,8 @@ import ( func TestFileUpload(t *testing.T) { es := &graphql.ExecutableSchemaMock{ - MutationFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "not implemented") + ExecFunc: func(ctx context.Context) graphql.ResponseHandler { + return graphql.OneShot(graphql.ErrorResponse(ctx, "not implemented")) }, SchemaFunc: func() *ast.Schema { return gqlparser.MustLoadSchema(&ast.Source{Input: ` @@ -41,10 +41,11 @@ func TestFileUpload(t *testing.T) { h.AddTransport(&multipartForm) t.Run("valid single file upload", func(t *testing.T) { - es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { + op := graphql.GetRequestContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "file") - return &graphql.Response{Data: []byte(`{"singleUpload":"test"}`)} + return graphql.OneShot(&graphql.Response{Data: []byte(`{"singleUpload":"test"}`)}) } operations := `{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) }", "variables": { "file": null } }` @@ -65,10 +66,11 @@ func TestFileUpload(t *testing.T) { }) t.Run("valid single file upload with payload", func(t *testing.T) { - es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { + op := graphql.GetRequestContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "req") - return &graphql.Response{Data: []byte(`{"singleUploadWithPayload":"test"}`)} + return graphql.OneShot(&graphql.Response{Data: []byte(`{"singleUploadWithPayload":"test"}`)}) } operations := `{ "query": "mutation ($req: UploadFile!) { singleUploadWithPayload(req: $req) }", "variables": { "req": {"file": null, "id": 1 } } }` @@ -89,10 +91,11 @@ func TestFileUpload(t *testing.T) { }) t.Run("valid file list upload", func(t *testing.T) { - es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { + op := graphql.GetRequestContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "files") - return &graphql.Response{Data: []byte(`{"multipleUpload":[{"id":1},{"id":2}]}`)} + return graphql.OneShot(&graphql.Response{Data: []byte(`{"multipleUpload":[{"id":1},{"id":2}]}`)}) } operations := `{ "query": "mutation($files: [Upload!]!) { multipleUpload(files: $files) }", "variables": { "files": [null, null] } }` @@ -118,10 +121,11 @@ func TestFileUpload(t *testing.T) { }) t.Run("valid file list upload with payload", func(t *testing.T) { - es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { + op := graphql.GetRequestContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "req") - return &graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)} + return graphql.OneShot(&graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)}) } operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` @@ -148,10 +152,11 @@ func TestFileUpload(t *testing.T) { t.Run("valid file list upload with payload and file reuse", func(t *testing.T) { test := func(uploadMaxMemory int64) { - es.MutationFunc = func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { + op := graphql.GetRequestContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "req") - return &graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)} + return graphql.OneShot(&graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)}) } multipartForm.MaxMemory = uploadMaxMemory diff --git a/graphql/handler/transport/websocket_test.go b/graphql/handler/transport/websocket_test.go index e7a5436e486..db91bebf51e 100644 --- a/graphql/handler/transport/websocket_test.go +++ b/graphql/handler/transport/websocket_test.go @@ -231,9 +231,9 @@ func TestWebsocketInitFunc(t *testing.T) { t.Run("can return context for request from WebsocketInitFunc", func(t *testing.T) { es := &graphql.ExecutableSchemaMock{ - QueryFunc: func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + ExecFunc: func(ctx context.Context) graphql.ResponseHandler { assert.Equal(t, "newvalue", ctx.Value("newkey")) - return &graphql.Response{Data: []byte(`{"empty":"ok"}`)} + return graphql.OneShot(&graphql.Response{Data: []byte(`{"empty":"ok"}`)}) }, SchemaFunc: func() *ast.Schema { return gqlparser.MustLoadSchema(&ast.Source{Input: ` diff --git a/graphql/oneshot.go b/graphql/oneshot.go index dd31f5baa79..01fa15f896b 100644 --- a/graphql/oneshot.go +++ b/graphql/oneshot.go @@ -1,9 +1,11 @@ package graphql -func OneShot(resp *Response) func() *Response { +import "context" + +func OneShot(resp *Response) ResponseHandler { var oneshot bool - return func() *Response { + return func(context context.Context) *Response { if oneshot { return nil } From 631142cfacc0d6b4c7773fea7750bd9d92cea4c4 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 1 Nov 2019 16:31:39 +1100 Subject: [PATCH 24/53] move writer all the way back to the transport --- graphql/handler.go | 22 ++++---- graphql/handler/apollotracing/tracer.go | 5 -- graphql/handler/executor.go | 73 +++++++++++++------------ graphql/handler/server_test.go | 14 ++--- graphql/handler/transport/http_form.go | 4 +- graphql/handler/transport/http_get.go | 15 ++--- graphql/handler/transport/http_post.go | 4 +- graphql/handler/transport/websocket.go | 16 ++++-- 8 files changed, 78 insertions(+), 75 deletions(-) diff --git a/graphql/handler.go b/graphql/handler.go index 5c1d91def7f..13caabaac59 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -11,14 +11,16 @@ import ( ) type ( - Resolver func(ctx context.Context) (res interface{}, err error) - Writer func(Status, *Response) - OperationMiddleware func(ctx context.Context, next OperationHandler, writer Writer) - OperationHandler func(ctx context.Context, writer Writer) - ResponseHandler func(ctx context.Context) *Response - ResponseStream func() *Response - ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response - FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) + Writer func(Status, *Response) + + OperationMiddleware func(ctx context.Context, next OperationHandler) ResponseHandler + OperationHandler func(ctx context.Context) ResponseHandler + + ResponseHandler func(ctx context.Context) *Response + ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response + + Resolver func(ctx context.Context) (res interface{}, err error) + FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) RawParams struct { Query string `json:"query"` @@ -29,7 +31,7 @@ type ( GraphExecutor interface { CreateRequestContext(ctx context.Context, params *RawParams) (*RequestContext, gqlerror.List) - DispatchRequest(ctx context.Context, writer Writer) + DispatchRequest(ctx context.Context, rc *RequestContext) (ResponseHandler, context.Context) } // HandlerExtension interface is entirely optional, see the list of possible hook points below @@ -60,7 +62,7 @@ type ( // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once, // for subscriptions it will be invoked multiple times. OperationInterceptor interface { - InterceptOperation(ctx context.Context, next OperationHandler, writer Writer) + InterceptOperation(ctx context.Context, next OperationHandler) ResponseHandler } // ResponseInterceptor is called around each graphql operation response. This can be called many times for a single diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 6d066e1fcf6..cc7eaf6fe14 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -2,8 +2,6 @@ package apollotracing import ( "context" - "fmt" - "runtime/debug" "sync" "time" @@ -101,9 +99,6 @@ func (a ApolloTracing) InterceptResponse(ctx context.Context, next graphql.Respo } graphql.RegisterExtension(ctx, "tracing", td) - - fmt.Println("AAAAAAAAAAa") - debug.PrintStack() resp := next(ctx) end := graphql.Now() diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 8125fb303c5..bdb639026db 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -11,7 +11,7 @@ import ( ) type executor struct { - operationMiddleware graphql.OperationHandler + operationMiddleware graphql.OperationMiddleware responseMiddleware graphql.ResponseMiddleware fieldMiddleware graphql.FieldMiddleware requestParamMutators []graphql.RequestParameterMutator @@ -25,7 +25,9 @@ func newExecutor(s *Server) executor { e := executor{ server: s, } - e.operationMiddleware = e.executableSchemaHandler + e.operationMiddleware = func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + return next(ctx) + } e.responseMiddleware = func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { return next(ctx) } @@ -38,8 +40,10 @@ func newExecutor(s *Server) executor { p := s.extensions[i] if p, ok := p.(graphql.OperationInterceptor); ok { previous := e.operationMiddleware - e.operationMiddleware = func(ctx context.Context, writer graphql.Writer) { - p.InterceptOperation(ctx, previous, writer) + e.operationMiddleware = func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + return p.InterceptOperation(ctx, func(ctx context.Context) graphql.ResponseHandler { + return previous(ctx, next) + }) } } @@ -76,8 +80,35 @@ func newExecutor(s *Server) executor { return e } -func (e executor) DispatchRequest(ctx context.Context, writer graphql.Writer) { - e.operationMiddleware(ctx, writer) +func (e executor) DispatchRequest(ctx context.Context, rc *graphql.RequestContext) (graphql.ResponseHandler, context.Context) { + var innerCtx context.Context + res := e.operationMiddleware(graphql.WithRequestContext(ctx, rc), func(ctx context.Context) graphql.ResponseHandler { + innerCtx = ctx + + responses := e.server.es.Exec(ctx) + + return func(ctx context.Context) *graphql.Response { + ctx = graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) + resp := e.responseMiddleware(ctx, func(ctx context.Context) *graphql.Response { + resp := responses(ctx) + if resp == nil { + return nil + } + resp.Extensions = graphql.GetExtensions(ctx) + return resp + }) + if resp == nil { + return nil + } + + for _, err := range graphql.GetErrors(ctx) { + resp.Errors = append(resp.Errors, err) + } + return resp + } + }) + + return res, innerCtx } func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { @@ -130,36 +161,6 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP return rc, nil } -func (e *executor) write(ctx context.Context, resp *graphql.Response, writer graphql.Writer) { - resp.Extensions = graphql.GetExtensions(ctx) - - for _, err := range graphql.GetErrors(ctx) { - resp.Errors = append(resp.Errors, err) - } - writer(getStatus(resp), resp) -} - -// executableSchemaHandler is the inner most operation handler, it invokes the graph directly after all middleware -// and sends responses to the transport so it can be returned to the client -func (e *executor) executableSchemaHandler(ctx context.Context, write graphql.Writer) { - responses := e.server.es.Exec(ctx) - for { - resCtx := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) - resp := e.responseMiddleware(resCtx, func(ctx context.Context) *graphql.Response { - resp := responses(resCtx) - if resp == nil { - return nil - } - resp.Extensions = graphql.GetExtensions(ctx) - return resp - }) - if resp == nil { - break - } - e.write(resCtx, resp, write) - } -} - // parseQuery decodes the incoming query and validates it, pulling from cache if present. // // NOTE: This should NOT look at variables, they will change per request. It should only parse and validate diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index 91b75eb1452..5f031fe4c30 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -46,13 +46,13 @@ func TestServer(t *testing.T) { t.Run("invokes operation middleware in order", func(t *testing.T) { var calls []string - srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) { + srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { calls = append(calls, "first") - next(ctx, writer) + return next(ctx) })) - srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) { + srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { calls = append(calls, "second") - next(ctx, writer) + return next(ctx) })) resp := get(srv, "/foo?query={name}") @@ -108,10 +108,10 @@ func TestServer(t *testing.T) { } -type opFunc func(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) +type opFunc func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler -func (r opFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler, writer graphql.Writer) { - r(ctx, next, writer) +func (r opFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + return r(ctx, next) } type fieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) diff --git a/graphql/handler/transport/http_form.go b/graphql/handler/transport/http_form.go index 6e3298c79a1..bf9a7b59eda 100644 --- a/graphql/handler/transport/http_form.go +++ b/graphql/handler/transport/http_form.go @@ -194,6 +194,6 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G write.GraphqlErr(gerr...) return } - ctx := graphql.WithRequestContext(r.Context(), rc) - exec.DispatchRequest(ctx, write) + responses, ctx := exec.DispatchRequest(r.Context(), rc) + write(graphql.StatusResolverError, responses(ctx)) } diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 2a8efe44f07..e21e86d083b 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -30,7 +30,7 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut OperationName: r.URL.Query().Get("operationName"), } - writer := graphql.Writer(func(status graphql.Status, response *graphql.Response) { + write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { switch status { case graphql.StatusOk, graphql.StatusResolverError: w.WriteHeader(http.StatusOK) @@ -47,7 +47,7 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if variables := r.URL.Query().Get("variables"); variables != "" { if err := jsonDecode(strings.NewReader(variables), &raw.Variables); err != nil { w.WriteHeader(http.StatusBadRequest) - writer.Errorf("variables could not be decoded") + write.Errorf("variables could not be decoded") return } } @@ -55,7 +55,7 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if extensions := r.URL.Query().Get("extensions"); extensions != "" { if err := jsonDecode(strings.NewReader(extensions), &raw.Extensions); err != nil { w.WriteHeader(http.StatusBadRequest) - writer.Errorf("extensions could not be decoded") + write.Errorf("extensions could not be decoded") return } } @@ -63,17 +63,18 @@ func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut rc, err := exec.CreateRequestContext(r.Context(), raw) if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) - writer.GraphqlErr(err...) + write.GraphqlErr(err...) return } op := rc.Doc.Operations.ForName(rc.OperationName) if op.Operation != ast.Query { w.WriteHeader(http.StatusNotAcceptable) - writer.Errorf("GET requests only allow query operations") + write.Errorf("GET requests only allow query operations") return } - ctx := graphql.WithRequestContext(r.Context(), rc) - exec.DispatchRequest(ctx, writer) + + responses, ctx := exec.DispatchRequest(r.Context(), rc) + write(graphql.StatusResolverError, responses(ctx)) } func jsonDecode(r io.Reader, val interface{}) error { diff --git a/graphql/handler/transport/http_post.go b/graphql/handler/transport/http_post.go index 930b621d90a..f8d955447f8 100644 --- a/graphql/handler/transport/http_post.go +++ b/graphql/handler/transport/http_post.go @@ -58,6 +58,6 @@ func (H POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecu write.GraphqlErr(err...) return } - ctx := graphql.WithRequestContext(r.Context(), rc) - exec.DispatchRequest(ctx, write) + responses, ctx := exec.DispatchRequest(r.Context(), rc) + write(graphql.StatusResolverError, responses(ctx)) } diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 1e40bbc61c5..caa3c09f5bd 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -214,6 +214,7 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.mu.Lock() c.active[message.ID] = cancel c.mu.Unlock() + go func() { defer func() { if r := recover(); r != nil { @@ -221,12 +222,15 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.sendError(message.ID, &gqlerror.Error{Message: userErr.Error()}) } }() - c.exec.DispatchRequest(ctx, func(status graphql.Status, response *graphql.Response) { + responses, ctx := c.exec.DispatchRequest(ctx, rc) + for { + response := responses(ctx) + if response == nil { + break + } + msgType := dataMsg - switch status { - case graphql.StatusOk, graphql.StatusResolverError: - msgType = dataMsg - case graphql.StatusParseError, graphql.StatusValidationError: + if len(response.Errors) > 0 { msgType = errorMsg } @@ -239,7 +243,7 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { ID: message.ID, Type: msgType, }) - }) + } c.write(&operationMessage{ID: message.ID, Type: completeMsg}) c.mu.Lock() From 473a0d256af2a23ed5b59facd0850ccf137d6fa8 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 1 Nov 2019 16:48:14 +1100 Subject: [PATCH 25/53] Implement bc shim for old handler package --- graphql/handler/lru/lru.go | 30 ++++ graphql/handler/server.go | 41 ++++- graphql/handler/server_test.go | 44 ++--- graphql/handler/transport/websocket.go | 4 +- handler/handler.go | 225 +++++++++++++++++++++++++ 5 files changed, 315 insertions(+), 29 deletions(-) create mode 100644 graphql/handler/lru/lru.go create mode 100644 handler/handler.go diff --git a/graphql/handler/lru/lru.go b/graphql/handler/lru/lru.go new file mode 100644 index 00000000000..e539fdf4fe8 --- /dev/null +++ b/graphql/handler/lru/lru.go @@ -0,0 +1,30 @@ +package lru + +import ( + "github.com/99designs/gqlgen/graphql" + lru "github.com/hashicorp/golang-lru" +) + +type LRU struct { + lru *lru.Cache +} + +var _ graphql.Cache = &LRU{} + +func New(size int) *LRU { + cache, err := lru.New(size) + if err != nil { + // An error is only returned for non-positive cache size + // and we already checked for that. + panic("unexpected error creating cache: " + err.Error()) + } + return &LRU{cache} +} + +func (l LRU) Get(key string) (value interface{}, ok bool) { + return l.lru.Get(key) +} + +func (l LRU) Add(key string, value interface{}) { + l.lru.Add(key, value) +} diff --git a/graphql/handler/server.go b/graphql/handler/server.go index a73556ae779..0e3d44fb0a5 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -1,6 +1,7 @@ package handler import ( + "context" "encoding/json" "fmt" "net/http" @@ -64,6 +65,21 @@ func (s *Server) Use(extension graphql.HandlerExtension) { } } +// AroundFields is a convenience method for creating an extension that only implements field middleware +func (s *Server) AroundFields(f graphql.FieldMiddleware) { + s.Use(FieldFunc(f)) +} + +// AroundOperations is a convenience method for creating an extension that only implements operation middleware +func (s *Server) AroundOperations(f graphql.OperationMiddleware) { + s.Use(OperationFunc(f)) +} + +// AroundResponses is a convenience method for creating an extension that only implements response middleware +func (s *Server) AroundResponses(f graphql.ResponseMiddleware) { + s.Use(ResponseFunc(f)) +} + func (s *Server) getTransport(r *http.Request) graphql.Transport { for _, t := range s.transports { if t.Supports(r) { @@ -85,13 +101,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { transport.Do(w, r, s.exec) } -func getStatus(resp *graphql.Response) graphql.Status { - if len(resp.Errors) > 0 { - return graphql.StatusResolverError - } - return graphql.StatusOk -} - func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { w.WriteHeader(code) b, err := json.Marshal(&graphql.Response{Errors: errors}) @@ -104,3 +113,21 @@ func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) { func sendErrorf(w http.ResponseWriter, code int, format string, args ...interface{}) { sendError(w, code, &gqlerror.Error{Message: fmt.Sprintf(format, args...)}) } + +type OperationFunc func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler + +func (r OperationFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + return r(ctx, next) +} + +type ResponseFunc func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response + +func (r ResponseFunc) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + return r(ctx, next) +} + +type FieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) + +func (f FieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + return f(ctx, next) +} diff --git a/graphql/handler/server_test.go b/graphql/handler/server_test.go index 5f031fe4c30..e141c19e734 100644 --- a/graphql/handler/server_test.go +++ b/graphql/handler/server_test.go @@ -46,14 +46,30 @@ func TestServer(t *testing.T) { t.Run("invokes operation middleware in order", func(t *testing.T) { var calls []string - srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { calls = append(calls, "first") return next(ctx) - })) - srv.Use(opFunc(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + }) + srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { calls = append(calls, "second") return next(ctx) - })) + }) + + resp := get(srv, "/foo?query={name}") + assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + assert.Equal(t, []string{"first", "second"}, calls) + }) + + t.Run("invokes response middleware in order", func(t *testing.T) { + var calls []string + srv.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + calls = append(calls, "first") + return next(ctx) + }) + srv.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + calls = append(calls, "second") + return next(ctx) + }) resp := get(srv, "/foo?query={name}") assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) @@ -62,14 +78,14 @@ func TestServer(t *testing.T) { t.Run("invokes field middleware in order", func(t *testing.T) { var calls []string - srv.Use(fieldFunc(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { calls = append(calls, "first") return next(ctx) - })) - srv.Use(fieldFunc(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + }) + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { calls = append(calls, "second") return next(ctx) - })) + }) resp := get(srv, "/foo?query={name}") assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) @@ -108,18 +124,6 @@ func TestServer(t *testing.T) { } -type opFunc func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler - -func (r opFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { - return r(ctx, next) -} - -type fieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) - -func (f fieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - return f(ctx, next) -} - func get(handler http.Handler, target string) *httptest.ResponseRecorder { r := httptest.NewRequest("GET", target, nil) w := httptest.NewRecorder() diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index caa3c09f5bd..a5fba9ff685 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -31,7 +31,7 @@ const ( type ( Websocket struct { Upgrader websocket.Upgrader - InitFunc websocketInitFunc + InitFunc WebsocketInitFunc KeepAlivePingInterval time.Duration } wsConnection struct { @@ -50,7 +50,7 @@ type ( ID string `json:"id,omitempty"` Type string `json:"type"` } - websocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error) + WebsocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error) ) var _ graphql.Transport = Websocket{} diff --git a/handler/handler.go b/handler/handler.go new file mode 100644 index 00000000000..47b26b69f99 --- /dev/null +++ b/handler/handler.go @@ -0,0 +1,225 @@ +package handler + +import ( + "context" + "net/http" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/lru" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/gorilla/websocket" +) + +func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc { + var cfg Config + + for _, option := range options { + option(&cfg) + } + + srv := handler.New(exec) + + srv.AddTransport(transport.Websocket{ + Upgrader: cfg.upgrader, + InitFunc: cfg.websocketInitFunc, + KeepAlivePingInterval: cfg.connectionKeepAlivePingInterval, + }) + srv.AddTransport(transport.Options{}) + srv.AddTransport(transport.GET{}) + srv.AddTransport(transport.POST{}) + srv.AddTransport(transport.MultipartForm{ + MaxUploadSize: cfg.uploadMaxSize, + MaxMemory: cfg.uploadMaxMemory, + }) + + if cfg.cacheSize != 0 { + srv.SetQueryCache(lru.New(cfg.cacheSize)) + } + if cfg.recover != nil { + srv.SetRecoverFunc(cfg.recover) + } + if cfg.errorPresenter != nil { + srv.SetErrorPresenter(cfg.errorPresenter) + } + for _, hook := range cfg.fieldHooks { + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + if !graphql.GetResolverContext(ctx).IsMethod { + return next(ctx) + } + return hook(ctx, next) + }) + } + for _, hook := range cfg.requestHooks { + srv.AroundResponses(hook) + } + if cfg.complexityLimit != 0 { + srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { + return cfg.complexityLimit + })) + } else if cfg.complexityLimitFunc != nil { + srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { + return cfg.complexityLimitFunc(graphql.WithRequestContext(ctx, rc)) + })) + } + if !cfg.disableIntrospection { + srv.Use(extension.Introspection{}) + } + if cfg.apqCache != nil { + srv.Use(extension.AutomaticPersistedQuery{Cache: apqAdapter{cfg.apqCache}}) + } + return srv.ServeHTTP +} + +type Config struct { + cacheSize int + upgrader websocket.Upgrader + websocketInitFunc transport.WebsocketInitFunc + connectionKeepAlivePingInterval time.Duration + recover graphql.RecoverFunc + errorPresenter graphql.ErrorPresenterFunc + fieldHooks []graphql.FieldMiddleware + requestHooks []graphql.ResponseMiddleware + complexityLimit int + complexityLimitFunc func(ctx context.Context) int + disableIntrospection bool + uploadMaxMemory int64 + uploadMaxSize int64 + apqCache PersistedQueryCache +} + +type Option func(cfg *Config) + +func WebsocketUpgrader(upgrader websocket.Upgrader) Option { + return func(cfg *Config) { + cfg.upgrader = upgrader + } +} + +func RecoverFunc(recover graphql.RecoverFunc) Option { + return func(cfg *Config) { + cfg.recover = recover + } +} + +// ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides +// a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default +// implementation in graphql.DefaultErrorPresenter for an example. +func ErrorPresenter(f graphql.ErrorPresenterFunc) Option { + return func(cfg *Config) { + cfg.errorPresenter = f + } +} + +// IntrospectionEnabled = false will forbid clients from calling introspection endpoints. Can be useful in prod when you dont +// want clients introspecting the full schema. +func IntrospectionEnabled(enabled bool) Option { + return func(cfg *Config) { + cfg.disableIntrospection = !enabled + } +} + +// ComplexityLimit sets a maximum query complexity that is allowed to be executed. +// If a query is submitted that exceeds the limit, a 422 status code will be returned. +func ComplexityLimit(limit int) Option { + return func(cfg *Config) { + cfg.complexityLimit = limit + } +} + +// ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed +// to be executed. +// If a query is submitted that exceeds the limit, a 422 status code will be returned. +func ComplexityLimitFunc(complexityLimitFunc func(ctx context.Context) int) Option { + return func(cfg *Config) { + cfg.complexityLimitFunc = complexityLimitFunc + } +} + +// ResolverMiddleware allows you to define a function that will be called around every resolver, +// useful for logging. +func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { + return func(cfg *Config) { + cfg.fieldHooks = append(cfg.fieldHooks, middleware) + } +} + +// RequestMiddleware allows you to define a function that will be called around the root request, +// after the query has been parsed. This is useful for logging +func RequestMiddleware(middleware graphql.ResponseMiddleware) Option { + return func(cfg *Config) { + cfg.requestHooks = append(cfg.requestHooks, middleware) + } +} + +// WebsocketInitFunc is called when the server receives connection init message from the client. +// This can be used to check initial payload to see whether to accept the websocket connection. +func WebsocketInitFunc(websocketInitFunc transport.WebsocketInitFunc) Option { + return func(cfg *Config) { + cfg.websocketInitFunc = websocketInitFunc + } +} + +// CacheSize sets the maximum size of the query cache. +// If size is less than or equal to 0, the cache is disabled. +func CacheSize(size int) Option { + return func(cfg *Config) { + cfg.cacheSize = size + } +} + +// UploadMaxSize sets the maximum number of bytes used to parse a request body +// as multipart/form-data. +func UploadMaxSize(size int64) Option { + return func(cfg *Config) { + cfg.uploadMaxSize = size + } +} + +// UploadMaxMemory sets the maximum number of bytes used to parse a request body +// as multipart/form-data in memory, with the remainder stored on disk in +// temporary files. +func UploadMaxMemory(size int64) Option { + return func(cfg *Config) { + cfg.uploadMaxMemory = size + } +} + +// WebsocketKeepAliveDuration allows you to reconfigure the keepalive behavior. +// By default, keepalive is enabled with a DefaultConnectionKeepAlivePingInterval +// duration. Set handler.connectionKeepAlivePingInterval = 0 to disable keepalive +// altogether. +func WebsocketKeepAliveDuration(duration time.Duration) Option { + return func(cfg *Config) { + cfg.connectionKeepAlivePingInterval = duration + } +} + +// Add cache that will hold queries for automatic persisted queries (APQ) +func EnablePersistedQueryCache(cache PersistedQueryCache) Option { + return func(cfg *Config) { + cfg.apqCache = cache + } +} + +func GetInitPayload(ctx context.Context) transport.InitPayload { + return transport.GetInitPayload(ctx) +} + +type apqAdapter struct { + PersistedQueryCache +} + +func (a apqAdapter) Get(key string) (value interface{}, ok bool) { + return a.Get(key) +} +func (a apqAdapter) Add(key string, value interface{}) { + a.Add(key, value) +} + +type PersistedQueryCache interface { + Add(ctx context.Context, hash string, query string) + Get(ctx context.Context, hash string) (string, bool) +} From bc98156929b06eeca1d95f475501470bd9034c2d Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2019 15:18:04 +1100 Subject: [PATCH 26/53] Combine root handlers in ExecutableSchema into a single Exec method --- codegen/field.gotpl | 7 +- codegen/generated!.gotpl | 122 +++--- codegen/testserver/introspection_test.go | 2 +- codegen/testserver/panics_test.go | 3 +- codegen/testserver/response_extension_test.go | 8 +- codegen/testserver/tracer_test.go | 346 ------------------ codegen/type.gotpl | 4 +- complexity/complexity_test.go | 53 +-- graphql/handler/executor.go | 12 +- graphql/handler/server.go | 10 + graphql/handler/transport/websocket.go | 7 +- handler/handler.go | 7 +- 12 files changed, 98 insertions(+), 483 deletions(-) delete mode 100644 codegen/testserver/tracer_test.go diff --git a/codegen/field.gotpl b/codegen/field.gotpl index f0bf5db7629..97ec20a684c 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -5,13 +5,12 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- if $object.Stream }} {{- $null = "nil" }} {{- end }} - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func () { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = {{ $null }} } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: {{$object.Name|quote}}, @@ -29,7 +28,6 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex } rctx.Args = args {{- end }} - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) {{- if $.Directives.LocationDirectives "FIELD" }} resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { {{ template "field" $field }} @@ -45,7 +43,7 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- end }} if resTmp == nil { {{- if $field.TypeReference.GQL.NonNull }} - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } {{- end }} @@ -68,7 +66,6 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- else }} res := resTmp.({{$field.TypeReference.GO | ref}}) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res) {{- end }} } diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index a95e57b625c..59bf9173ca4 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -112,101 +112,79 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - {{- if .QueryRoot }} - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - {{ if .Directives.LocationDirectives "QUERY" -}} - data := ec._queryMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){ - return ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet), nil - }) - {{- else -}} - data := ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet) - {{- end }} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + {{- if .QueryRoot }} case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { return nil } + first = false + {{ if .Directives.LocationDirectives "QUERY" -}} + data := ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil + }) + {{- else -}} + data := ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet) + {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) - return buf.Bytes() - }) - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + return &graphql.Response{ + Data: buf.Bytes(), + } } - {{- else }} - return graphql.ErrorResponse(ctx, "queries are not supported") - {{- end }} -} - -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - {{- if .MutationRoot }} - ec := executionContext{graphql.GetRequestContext(ctx), e} + {{ end }} - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - {{ if .Directives.LocationDirectives "MUTATION" -}} - data := ec._mutationMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){ - return ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet), nil - }) - {{- else -}} - data := ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet) - {{- end }} + {{- if .MutationRoot }} case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { return nil } + first = false + {{ if .Directives.LocationDirectives "MUTATION" -}} + data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil + }) + {{- else -}} + data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet) + {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) - return buf.Bytes() - }) - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + return &graphql.Response{ + Data: buf.Bytes(), + } } - {{- else }} - return graphql.ErrorResponse(ctx, "mutations are not supported") - {{- end }} -} - -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - {{- if .SubscriptionRoot }} - ec := executionContext{graphql.GetRequestContext(ctx), e} + {{ end }} + {{- if .SubscriptionRoot }} case ast.Subscription: {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} - next := ec._subscriptionMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){ - return ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet),nil + next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil }) {{- else -}} - next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet) + next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet) {{- end }} - if ec.Errors != nil { - return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) - } var buf bytes.Buffer - return func() *graphql.Response { - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - buf.Reset() - data := next() - - if data == nil { - return nil - } - data.MarshalGQL(&buf) - return buf.Bytes() - }) + return func(ctx context.Context) *graphql.Response { + buf.Reset() + data := next() - if buf == nil { + if data == nil { return nil } + data.MarshalGQL(&buf) return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + Data: buf.Bytes(), } } - {{- else }} - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) - {{- end }} + {{ end }} + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } } type executionContext struct { diff --git a/codegen/testserver/introspection_test.go b/codegen/testserver/introspection_test.go index 97178798665..c33ea6e5bdd 100644 --- a/codegen/testserver/introspection_test.go +++ b/codegen/testserver/introspection_test.go @@ -67,7 +67,7 @@ func TestIntrospection(t *testing.T) { c := client.New(handler.GraphQL( NewExecutableSchema(Config{Resolvers: resolvers}), - handler.RequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { + handler.RequestMiddleware(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { graphql.GetRequestContext(ctx).DisableIntrospection = true return next(ctx) diff --git a/codegen/testserver/panics_test.go b/codegen/testserver/panics_test.go index 92319ed4abb..f5de5ab4715 100644 --- a/codegen/testserver/panics_test.go +++ b/codegen/testserver/panics_test.go @@ -4,10 +4,9 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/handler" + "github.com/stretchr/testify/require" ) func TestPanics(t *testing.T) { diff --git a/codegen/testserver/response_extension_test.go b/codegen/testserver/response_extension_test.go index 985c7aa09e4..198ea08e561 100644 --- a/codegen/testserver/response_extension_test.go +++ b/codegen/testserver/response_extension_test.go @@ -18,11 +18,9 @@ func TestResponseExtension(t *testing.T) { srv := handler.GraphQL( NewExecutableSchema(Config{Resolvers: resolvers}), - handler.RequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { - rctx := graphql.GetRequestContext(ctx) - if err := rctx.RegisterExtension("example", "value"); err != nil { - panic(err) - } + handler.RequestMiddleware(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + graphql.RegisterExtension(ctx, "example", "value") + return next(ctx) }), ) diff --git a/codegen/testserver/tracer_test.go b/codegen/testserver/tracer_test.go deleted file mode 100644 index 07c39b080f5..00000000000 --- a/codegen/testserver/tracer_test.go +++ /dev/null @@ -1,346 +0,0 @@ -package testserver - -import ( - "context" - "fmt" - "sync" - "testing" - - "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestTracer(t *testing.T) { - resolvers := &Stub{} - resolvers.QueryResolver.User = func(ctx context.Context, id int) (user *User, e error) { - return &User{ID: 1}, nil - } - t.Run("called in the correct order", func(t *testing.T) { - var tracerLog []string - var mu sync.Mutex - - srv := handler.GraphQL( - NewExecutableSchema(Config{Resolvers: resolvers}), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 1))) - }), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 2))) - }), - handler.Tracer(&testTracer{ - id: 1, - append: func(s string) { - mu.Lock() - defer mu.Unlock() - tracerLog = append(tracerLog, s) - }, - }), - handler.Tracer(&testTracer{ - id: 2, - append: func(s string) { - mu.Lock() - defer mu.Unlock() - tracerLog = append(tracerLog, s) - }, - }), - ) - c := client.New(srv) - - var resp struct { - User struct { - ID int - Friends []struct { - ID int - } - } - } - - called := false - resolvers.UserResolver.Friends = func(ctx context.Context, obj *User) ([]*User, error) { - assert.Equal(t, []string{ - "op:p:start:1", "op:p:start:2", - "op:v:start:1", "op:v:start:2", - "op:e:start:1", "op:e:start:2", - "field'a:e:start:1:user", "field'a:e:start:2:user", - "field'b:e:start:1:[user]", "field'b:e:start:2:[user]", - "field'c:e:start:1", "field'c:e:start:2", - "field'a:e:start:1:friends", "field'a:e:start:2:friends", - "field'b:e:start:1:[user friends]", "field'b:e:start:2:[user friends]", - }, ctx.Value("tracer")) - called = true - return []*User{}, nil - } - - err := c.Post(`query { user(id: 1) { id, friends { id } } }`, &resp) - - require.NoError(t, err) - require.True(t, called) - mu.Lock() - defer mu.Unlock() - assert.Equal(t, []string{ - "op:p:start:1", "op:p:start:2", - "op:p:end:2", "op:p:end:1", - - "op:v:start:1", "op:v:start:2", - "op:v:end:2", "op:v:end:1", - - "op:e:start:1", "op:e:start:2", - - "field'a:e:start:1:user", "field'a:e:start:2:user", - "field'b:e:start:1:[user]", "field'b:e:start:2:[user]", - "field'c:e:start:1", "field'c:e:start:2", - "field'a:e:start:1:id", "field'a:e:start:2:id", - "field'b:e:start:1:[user id]", "field'b:e:start:2:[user id]", - "field'c:e:start:1", "field'c:e:start:2", - "field:e:end:2", "field:e:end:1", - "field'a:e:start:1:friends", "field'a:e:start:2:friends", - "field'b:e:start:1:[user friends]", "field'b:e:start:2:[user friends]", - "field'c:e:start:1", "field'c:e:start:2", - "field:e:end:2", "field:e:end:1", - "field:e:end:2", "field:e:end:1", - - "op:e:end:2", "op:e:end:1", - }, tracerLog) - }) - - t.Run("take ctx over from prev step", func(t *testing.T) { - - configurableTracer := &configurableTracer{ - StartOperationParsingCallback: func(ctx context.Context) context.Context { - return context.WithValue(ctx, "StartOperationParsing", true) - }, - EndOperationParsingCallback: func(ctx context.Context) { - assert.NotNil(t, ctx.Value("StartOperationParsing")) - }, - - StartOperationValidationCallback: func(ctx context.Context) context.Context { - return context.WithValue(ctx, "StartOperationValidation", true) - }, - EndOperationValidationCallback: func(ctx context.Context) { - assert.NotNil(t, ctx.Value("StartOperationParsing")) - assert.NotNil(t, ctx.Value("StartOperationValidation")) - }, - - StartOperationExecutionCallback: func(ctx context.Context) context.Context { - return context.WithValue(ctx, "StartOperationExecution", true) - }, - StartFieldExecutionCallback: func(ctx context.Context, field graphql.CollectedField) context.Context { - return context.WithValue(ctx, "StartFieldExecution", true) - }, - StartFieldResolverExecutionCallback: func(ctx context.Context, rc *graphql.ResolverContext) context.Context { - return context.WithValue(ctx, "StartFieldResolverExecution", true) - }, - StartFieldChildExecutionCallback: func(ctx context.Context) context.Context { - return context.WithValue(ctx, "StartFieldChildExecution", true) - }, - EndFieldExecutionCallback: func(ctx context.Context) { - assert.NotNil(t, ctx.Value("StartOperationParsing")) - assert.NotNil(t, ctx.Value("StartOperationValidation")) - assert.NotNil(t, ctx.Value("StartOperationExecution")) - assert.NotNil(t, ctx.Value("StartFieldExecution")) - assert.NotNil(t, ctx.Value("StartFieldResolverExecution")) - assert.NotNil(t, ctx.Value("StartFieldChildExecution")) - }, - - EndOperationExecutionCallback: func(ctx context.Context) { - assert.NotNil(t, ctx.Value("StartOperationParsing")) - assert.NotNil(t, ctx.Value("StartOperationValidation")) - assert.NotNil(t, ctx.Value("StartOperationExecution")) - }, - } - - c := client.New(handler.GraphQL( - NewExecutableSchema(Config{Resolvers: resolvers}), - handler.Tracer(configurableTracer), - )) - - var resp struct { - User struct { - ID int - Friends []struct { - ID int - } - } - } - - called := false - resolvers.UserResolver.Friends = func(ctx context.Context, obj *User) ([]*User, error) { - called = true - return []*User{}, nil - } - - err := c.Post(`query { user(id: 1) { id, friends { id } } }`, &resp) - - require.NoError(t, err) - require.True(t, called) - }) -} - -var _ graphql.Tracer = (*configurableTracer)(nil) - -type configurableTracer struct { - StartOperationParsingCallback func(ctx context.Context) context.Context - EndOperationParsingCallback func(ctx context.Context) - StartOperationValidationCallback func(ctx context.Context) context.Context - EndOperationValidationCallback func(ctx context.Context) - StartOperationExecutionCallback func(ctx context.Context) context.Context - StartFieldExecutionCallback func(ctx context.Context, field graphql.CollectedField) context.Context - StartFieldResolverExecutionCallback func(ctx context.Context, rc *graphql.ResolverContext) context.Context - StartFieldChildExecutionCallback func(ctx context.Context) context.Context - EndFieldExecutionCallback func(ctx context.Context) - EndOperationExecutionCallback func(ctx context.Context) -} - -func (ct *configurableTracer) StartOperationParsing(ctx context.Context) context.Context { - if f := ct.StartOperationParsingCallback; f != nil { - ctx = f(ctx) - } - return ctx -} - -func (ct *configurableTracer) EndOperationParsing(ctx context.Context) { - if f := ct.EndOperationParsingCallback; f != nil { - f(ctx) - } -} - -func (ct *configurableTracer) StartOperationValidation(ctx context.Context) context.Context { - if f := ct.StartOperationValidationCallback; f != nil { - ctx = f(ctx) - } - return ctx -} - -func (ct *configurableTracer) EndOperationValidation(ctx context.Context) { - if f := ct.EndOperationValidationCallback; f != nil { - f(ctx) - } -} - -func (ct *configurableTracer) StartOperationExecution(ctx context.Context) context.Context { - if f := ct.StartOperationExecutionCallback; f != nil { - ctx = f(ctx) - } - return ctx -} - -func (ct *configurableTracer) StartFieldExecution(ctx context.Context, field graphql.CollectedField) context.Context { - if f := ct.StartFieldExecutionCallback; f != nil { - ctx = f(ctx, field) - } - return ctx -} - -func (ct *configurableTracer) StartFieldResolverExecution(ctx context.Context, rc *graphql.ResolverContext) context.Context { - if f := ct.StartFieldResolverExecutionCallback; f != nil { - ctx = f(ctx, rc) - } - return ctx -} - -func (ct *configurableTracer) StartFieldChildExecution(ctx context.Context) context.Context { - if f := ct.StartFieldChildExecutionCallback; f != nil { - ctx = f(ctx) - } - return ctx -} - -func (ct *configurableTracer) EndFieldExecution(ctx context.Context) { - if f := ct.EndFieldExecutionCallback; f != nil { - f(ctx) - } -} - -func (ct *configurableTracer) EndOperationExecution(ctx context.Context) { - if f := ct.EndOperationExecutionCallback; f != nil { - f(ctx) - } -} - -var _ graphql.Tracer = (*testTracer)(nil) - -type testTracer struct { - id int - append func(string) -} - -func (tt *testTracer) StartOperationParsing(ctx context.Context) context.Context { - line := fmt.Sprintf("op:p:start:%d", tt.id) - - tracerLogs, _ := ctx.Value("tracer").([]string) - ctx = context.WithValue(ctx, "tracer", append(append([]string{}, tracerLogs...), line)) - tt.append(line) - - return ctx -} - -func (tt *testTracer) EndOperationParsing(ctx context.Context) { - tt.append(fmt.Sprintf("op:p:end:%d", tt.id)) -} - -func (tt *testTracer) StartOperationValidation(ctx context.Context) context.Context { - line := fmt.Sprintf("op:v:start:%d", tt.id) - - tracerLogs, _ := ctx.Value("tracer").([]string) - ctx = context.WithValue(ctx, "tracer", append(append([]string{}, tracerLogs...), line)) - tt.append(line) - - return ctx -} - -func (tt *testTracer) EndOperationValidation(ctx context.Context) { - tt.append(fmt.Sprintf("op:v:end:%d", tt.id)) -} - -func (tt *testTracer) StartOperationExecution(ctx context.Context) context.Context { - line := fmt.Sprintf("op:e:start:%d", tt.id) - - tracerLogs, _ := ctx.Value("tracer").([]string) - ctx = context.WithValue(ctx, "tracer", append(append([]string{}, tracerLogs...), line)) - tt.append(line) - - return ctx -} - -func (tt *testTracer) StartFieldExecution(ctx context.Context, field graphql.CollectedField) context.Context { - line := fmt.Sprintf("field'a:e:start:%d:%s", tt.id, field.Name) - - tracerLogs, _ := ctx.Value("tracer").([]string) - ctx = context.WithValue(ctx, "tracer", append(append([]string{}, tracerLogs...), line)) - tt.append(line) - - return ctx -} - -func (tt *testTracer) StartFieldResolverExecution(ctx context.Context, rc *graphql.ResolverContext) context.Context { - line := fmt.Sprintf("field'b:e:start:%d:%v", tt.id, rc.Path()) - - tracerLogs, _ := ctx.Value("tracer").([]string) - ctx = context.WithValue(ctx, "tracer", append(append([]string{}, tracerLogs...), line)) - tt.append(line) - - return ctx -} - -func (tt *testTracer) StartFieldChildExecution(ctx context.Context) context.Context { - line := fmt.Sprintf("field'c:e:start:%d", tt.id) - - tracerLogs, _ := ctx.Value("tracer").([]string) - ctx = context.WithValue(ctx, "tracer", append(append([]string{}, tracerLogs...), line)) - tt.append(line) - - return ctx -} - -func (tt *testTracer) EndFieldExecution(ctx context.Context) { - tt.append(fmt.Sprintf("field:e:end:%d", tt.id)) -} - -func (tt *testTracer) EndOperationExecution(ctx context.Context) { - tt.append(fmt.Sprintf("op:e:end:%d", tt.id)) -} diff --git a/codegen/type.gotpl b/codegen/type.gotpl index cb2782c39ed..11425c30f2e 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -50,7 +50,7 @@ {{- if $type.IsNilable }} if v == nil { {{- if $type.GQL.NonNull }} - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } {{- end }} @@ -113,7 +113,7 @@ {{- else if $type.GQL.NonNull }} res := {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}(v){{else}}v{{- end }}) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/complexity/complexity_test.go b/complexity/complexity_test.go index 93b61980992..a7a2f25565b 100644 --- a/complexity/complexity_test.go +++ b/complexity/complexity_test.go @@ -1,7 +1,6 @@ package complexity import ( - "context" "math" "testing" @@ -50,7 +49,24 @@ var schema = gqlparser.MustLoadSchema( func requireComplexity(t *testing.T, source string, complexity int) { t.Helper() query := gqlparser.MustLoadQuery(schema, source) - es := &executableSchemaStub{} + + es := &graphql.ExecutableSchemaMock{ + ComplexityFunc: func(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) { + switch typeName + "." + field { + case "ExpensiveItem.name": + return 5, true + case "Query.list", "Item.list": + return int(args["size"].(int64)) * childComplexity, true + case "Query.customObject": + return 1, true + } + return 0, false + }, + SchemaFunc: func() *ast.Schema { + return schema + }, + } + actualComplexity := Calculate(es, query.Operations[0], nil) require.Equal(t, complexity, actualComplexity) } @@ -197,36 +213,3 @@ func TestCalculate(t *testing.T) { requireComplexity(t, query, math.MaxInt64) }) } - -type executableSchemaStub struct { -} - -var _ graphql.ExecutableSchema = &executableSchemaStub{} - -func (e *executableSchemaStub) Schema() *ast.Schema { - return schema -} - -func (e *executableSchemaStub) Complexity(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) { - switch typeName + "." + field { - case "ExpensiveItem.name": - return 5, true - case "Query.list", "Item.list": - return int(args["size"].(int64)) * childComplexity, true - case "Query.customObject": - return 1, true - } - return 0, false -} - -func (e *executableSchemaStub) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - panic("Query should never be called by complexity calculations") -} - -func (e *executableSchemaStub) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - panic("Mutation should never be called by complexity calculations") -} - -func (e *executableSchemaStub) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - panic("Subscription should never be called by complexity calculations") -} diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index bdb639026db..dca3ecf92d1 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -80,12 +80,18 @@ func newExecutor(s *Server) executor { return e } -func (e executor) DispatchRequest(ctx context.Context, rc *graphql.RequestContext) (graphql.ResponseHandler, context.Context) { +func (e executor) DispatchRequest(ctx context.Context, rc *graphql.RequestContext) (h graphql.ResponseHandler, resctx context.Context) { + ctx = graphql.WithRequestContext(ctx, rc) + var innerCtx context.Context - res := e.operationMiddleware(graphql.WithRequestContext(ctx, rc), func(ctx context.Context) graphql.ResponseHandler { + res := e.operationMiddleware(ctx, func(ctx context.Context) graphql.ResponseHandler { innerCtx = ctx - responses := e.server.es.Exec(ctx) + tmpResponseContext := graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) + responses := e.server.es.Exec(tmpResponseContext) + if errs := graphql.GetErrors(tmpResponseContext); errs != nil { + return graphql.OneShot(&graphql.Response{Errors: errs}) + } return func(ctx context.Context) *graphql.Response { ctx = graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 0e3d44fb0a5..7c6517e605d 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -90,6 +90,16 @@ func (s *Server) getTransport(r *http.Request) graphql.Transport { } func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + defer func() { + if err := recover(); err != nil { + err := s.errorPresenter(r.Context(), s.recoverFunc(r.Context(), err)) + resp := &graphql.Response{Errors: []*gqlerror.Error{err}} + b, _ := json.Marshal(resp) + w.WriteHeader(http.StatusUnprocessableEntity) + w.Write(b) + } + }() + r = r.WithContext(graphql.StartOperationTrace(r.Context())) transport := s.getTransport(r) diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index a5fba9ff685..4a7764f86d6 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -229,11 +229,6 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { break } - msgType := dataMsg - if len(response.Errors) > 0 { - msgType = errorMsg - } - b, err := json.Marshal(response) if err != nil { panic(err) @@ -241,7 +236,7 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.write(&operationMessage{ Payload: b, ID: message.ID, - Type: msgType, + Type: dataMsg, }) } c.write(&operationMessage{ID: message.ID, Type: completeMsg}) diff --git a/handler/handler.go b/handler/handler.go index 47b26b69f99..13720835f8a 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -45,12 +45,7 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc srv.SetErrorPresenter(cfg.errorPresenter) } for _, hook := range cfg.fieldHooks { - srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - if !graphql.GetResolverContext(ctx).IsMethod { - return next(ctx) - } - return hook(ctx, next) - }) + srv.AroundFields(hook) } for _, hook := range cfg.requestHooks { srv.AroundResponses(hook) From 479abbef5e8f6a00b23db8c5f68e04a6fcd3e9a8 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2019 15:18:35 +1100 Subject: [PATCH 27/53] update generated code --- codegen/testserver/generated.go | 1064 ++++++-------------- example/chat/generated.go | 370 +++---- example/config/generated.go | 347 ++----- example/dataloader/generated.go | 358 ++----- example/fileupload/generated.go | 340 ++----- example/scalars/generated.go | 333 ++---- example/selection/generated.go | 310 ++---- example/starwars/generated/exec.go | 528 +++------- example/todo/generated.go | 342 ++----- example/type-system-extension/generated.go | 327 ++---- integration/generated.go | 333 ++---- 11 files changed, 1390 insertions(+), 3262 deletions(-) diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 0891bd075fa..c0a26eda2de 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1373,38 +1373,31 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} - -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") -} - -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) - next := ec._Subscription(ctx, op.SelectionSet) - if ec.Errors != nil { - return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) - } + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Subscription: + next := ec._Subscription(ctx, rc.Operation.SelectionSet) - var buf bytes.Buffer - return func() *graphql.Response { - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { + var buf bytes.Buffer + return func(ctx context.Context) *graphql.Response { buf.Reset() data := next() @@ -1412,18 +1405,14 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe return nil } data.MarshalGQL(&buf) - return buf.Bytes() - }) - if buf == nil { - return nil + return &graphql.Response{ + Data: buf.Bytes(), + } } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } @@ -2725,13 +2714,12 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "A", @@ -2740,32 +2728,29 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.CollectedField, obj *AIt) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "AIt", @@ -2774,32 +2759,29 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.CollectedField, obj *AbIt) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "AbIt", @@ -2808,32 +2790,29 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Autobind", @@ -2842,32 +2821,29 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Autobind", @@ -2876,32 +2852,29 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int32, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int32) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int32(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Autobind", @@ -2910,32 +2883,29 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int64, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int64(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Autobind", @@ -2944,32 +2914,29 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdStr, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Autobind", @@ -2978,32 +2945,29 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdInt, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2int(ctx, field.Selections, res) } func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedField, obj *B) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "B", @@ -3012,32 +2976,29 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Circle", @@ -3046,7 +3007,6 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Radius, nil @@ -3057,18 +3017,16 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Circle", @@ -3077,7 +3035,6 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -3088,18 +3045,16 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Content_Post", @@ -3108,7 +3063,6 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3119,18 +3073,16 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Content_User", @@ -3139,7 +3091,6 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3150,18 +3101,16 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, field graphql.CollectedField, obj *EmbeddedDefaultScalar) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "EmbeddedDefaultScalar", @@ -3170,7 +3119,6 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil @@ -3181,18 +3129,16 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalODefaultScalarImplementation2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "EmbeddedPointer", @@ -3201,7 +3147,6 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3212,18 +3157,16 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "EmbeddedPointer", @@ -3232,7 +3175,6 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Title, nil @@ -3243,18 +3185,16 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_id(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Error", @@ -3263,32 +3203,29 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Error", @@ -3297,7 +3234,6 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnNonRequiredField() @@ -3308,18 +3244,16 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Error", @@ -3328,32 +3262,29 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnRequiredField() }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Error", @@ -3362,32 +3293,29 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NilOnRequiredField(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Errors", @@ -3396,32 +3324,29 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().A(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Errors", @@ -3430,32 +3355,29 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().B(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Errors", @@ -3464,32 +3386,29 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().C(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Errors", @@ -3498,32 +3417,29 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().D(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Errors", @@ -3532,32 +3448,29 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().E(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field graphql.CollectedField, obj *ForcedResolver) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ForcedResolver", @@ -3566,7 +3479,6 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ForcedResolver().Field(rctx, obj) @@ -3577,18 +3489,16 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra } res := resTmp.(*Circle) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐCircle(ctx, field.Selections, res) } func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.CollectedField, obj *InnerObject) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "InnerObject", @@ -3597,32 +3507,29 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field graphql.CollectedField, obj *invalid_packagename.InvalidIdentifier) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "InvalidIdentifier", @@ -3631,32 +3538,29 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedField, obj *introspection1.It) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "It", @@ -3665,32 +3569,29 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.CollectedField, obj *LoopA) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "LoopA", @@ -3699,32 +3600,29 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.B, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*LoopB) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopB(ctx, field.Selections, res) } func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.CollectedField, obj *LoopB) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "LoopB", @@ -3733,32 +3631,29 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.A, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*LoopA) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopA(ctx, field.Selections, res) } func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Map", @@ -3767,32 +3662,29 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MapStringInterfaceType", @@ -3801,7 +3693,6 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["a"].(type) { @@ -3821,18 +3712,16 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MapStringInterfaceType", @@ -3841,7 +3730,6 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["b"].(type) { @@ -3861,18 +3749,16 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field } res := resTmp.(*int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", @@ -3881,32 +3767,29 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ModelMethods().ResolverField(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", @@ -3915,32 +3798,29 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NoContext(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", @@ -3949,32 +3829,29 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.WithContext(ctx), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ObjectDirectives", @@ -3983,7 +3860,6 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4022,25 +3898,23 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ObjectDirectives", @@ -4049,7 +3923,6 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4080,18 +3953,16 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectivesWithCustomGoModel) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ObjectDirectivesWithCustomGoModel", @@ -4100,7 +3971,6 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4131,18 +4001,16 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphql.CollectedField, obj *OuterObject) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "OuterObject", @@ -4151,32 +4019,29 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Inner, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*InnerObject) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerObject(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", @@ -4185,32 +4050,29 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", @@ -4219,32 +4081,29 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", @@ -4253,32 +4112,29 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", @@ -4287,32 +4143,29 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", @@ -4321,32 +4174,29 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Panics", @@ -4355,32 +4205,29 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]MarshalPanic) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, field.Selections, res) } func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Panics", @@ -4396,32 +4243,29 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FieldFuncMarshal(ctx, args["u"].([]MarshalPanic)), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]MarshalPanic) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, field.Selections, res) } func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Panics", @@ -4437,32 +4281,29 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, args["u"].([]MarshalPanic)) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Primitive", @@ -4471,32 +4312,29 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Primitive().Value(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Primitive", @@ -4505,32 +4343,29 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Squared(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", @@ -4539,32 +4374,29 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Value(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", @@ -4573,32 +4405,29 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Doubled(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", @@ -4607,32 +4436,29 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Len(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4641,7 +4467,6 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InvalidIdentifier(rctx) @@ -4652,18 +4477,16 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field } res := resTmp.(*invalid_packagename.InvalidIdentifier) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOInvalidIdentifier2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋinvalidᚑpackagenameᚐInvalidIdentifier(ctx, field.Selections, res) } func (ec *executionContext) _Query_collision(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4672,7 +4495,6 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Collision(rctx) @@ -4683,18 +4505,16 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. } res := resTmp.(*introspection1.It) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋintrospectionᚐIt(ctx, field.Selections, res) } func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4710,7 +4530,6 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapInput(rctx, args["input"].(map[string]interface{})) @@ -4721,18 +4540,16 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C } res := resTmp.(*bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4748,7 +4565,6 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Recursive(rctx, args["input"].(*RecursiveInputSlice)) @@ -4759,18 +4575,16 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. } res := resTmp.(*bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4786,7 +4600,6 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedInputs(rctx, args["input"].([][]*OuterInput)) @@ -4797,18 +4610,16 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph } res := resTmp.(*bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4817,7 +4628,6 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedOutputs(rctx) @@ -4828,18 +4638,16 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap } res := resTmp.([][]*OuterObject) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOOuterObject2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterObject(ctx, field.Selections, res) } func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4848,7 +4656,6 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ModelMethods(rctx) @@ -4859,18 +4666,16 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph } res := resTmp.(*ModelMethods) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOModelMethods2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐModelMethods(ctx, field.Selections, res) } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4886,32 +4691,29 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(int)) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*User) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4927,7 +4729,6 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NullableArg(rctx, args["arg"].(*int)) @@ -4938,18 +4739,16 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4965,32 +4764,29 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InputSlice(rctx, args["arg"].([]string)) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -4999,32 +4795,29 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ShapeUnion(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(ShapeUnion) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShapeUnion(ctx, field.Selections, res) } func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5033,7 +4826,6 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Autobind(rctx) @@ -5044,18 +4836,16 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C } res := resTmp.(*Autobind) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOAutobind2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐAutobind(ctx, field.Selections, res) } func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5064,32 +4854,29 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DeprecatedField(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5098,7 +4885,6 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Overlapping(rctx) @@ -5109,18 +4895,16 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq } res := resTmp.(*OverlappingFields) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOOverlappingFields2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOverlappingFields(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5136,7 +4920,6 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveArg(rctx, args["arg"].(string)) @@ -5147,18 +4930,16 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5174,7 +4955,6 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -5185,18 +4965,16 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5212,7 +4990,6 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputNullable(rctx, args["arg"].(*InputDirectives)) @@ -5223,18 +5000,16 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5250,7 +5025,6 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInput(rctx, args["arg"].(InputDirectives)) @@ -5261,18 +5035,16 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5288,7 +5060,6 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputType(rctx, args["arg"].(InnerInput)) @@ -5299,18 +5070,16 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5319,7 +5088,6 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObject(rctx) @@ -5330,18 +5098,16 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr } res := resTmp.(*ObjectDirectives) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOObjectDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐObjectDirectives(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5350,7 +5116,6 @@ func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObjectWithCustomGoModel(rctx) @@ -5361,18 +5126,16 @@ func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context. } res := resTmp.(*ObjectDirectivesWithCustomGoModel) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOObjectDirectivesWithCustomGoModel2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐObjectDirectivesWithCustomGoModel(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5388,7 +5151,6 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5423,25 +5185,23 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5450,7 +5210,6 @@ func (ec *executionContext) _Query_directiveField(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveField(rctx) @@ -5461,18 +5220,16 @@ func (ec *executionContext) _Query_directiveField(ctx context.Context, field gra } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5481,7 +5238,6 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5518,18 +5274,16 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5538,7 +5292,6 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5569,18 +5322,16 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5589,7 +5340,6 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Shapes(rctx) @@ -5600,18 +5350,16 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col } res := resTmp.([]Shape) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) } func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5620,7 +5368,6 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5651,18 +5398,16 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co } res := resTmp.(Shape) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) } func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5678,7 +5423,6 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapStringInterface(rctx, args["in"].(map[string]interface{})) @@ -5689,18 +5433,16 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field } res := resTmp.(map[string]interface{}) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOMapStringInterfaceType2map(ctx, field.Selections, res) } func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5716,7 +5458,6 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapNestedStringInterface(rctx, args["in"].(*NestedMapInput)) @@ -5727,18 +5468,16 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, } res := resTmp.(map[string]interface{}) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOMapStringInterfaceType2map(ctx, field.Selections, res) } func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5747,7 +5486,6 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ErrorBubble(rctx) @@ -5758,18 +5496,16 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq } res := resTmp.(*Error) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5778,7 +5514,6 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Errors(rctx) @@ -5789,18 +5524,16 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col } res := resTmp.(*Errors) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOErrors2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrors(ctx, field.Selections, res) } func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5809,32 +5542,29 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Valid(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5843,7 +5573,6 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Panics(rctx) @@ -5854,18 +5583,16 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col } res := resTmp.(*Panics) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOPanics2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPanics(ctx, field.Selections, res) } func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5874,32 +5601,29 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveObject(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]Primitive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNPrimitive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitive(ctx, field.Selections, res) } func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5908,32 +5632,29 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveStringObject(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]PrimitiveString) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitiveString(ctx, field.Selections, res) } func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5949,32 +5670,29 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DefaultScalar(rctx, args["arg"].(string)) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNDefaultScalarImplementation2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -5983,7 +5701,6 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Slices(rctx) @@ -5994,18 +5711,16 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col } res := resTmp.(*Slices) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSlices(ctx, field.Selections, res) } func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6014,32 +5729,29 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ScalarSlice(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]byte) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBytes2ᚕbyte(ctx, field.Selections, res) } func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6055,32 +5767,29 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Fallback(rctx, args["arg"].(FallbackToStringEncoding)) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(FallbackToStringEncoding) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, field.Selections, res) } func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6089,7 +5798,6 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().OptionalUnion(rctx) @@ -6100,18 +5808,16 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap } res := resTmp.(TestUnion) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTestUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐTestUnion(ctx, field.Selections, res) } func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6120,7 +5826,6 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ValidType(rctx) @@ -6131,18 +5836,16 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. } res := resTmp.(*ValidType) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOValidType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidType(ctx, field.Selections, res) } func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6151,32 +5854,29 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedStruct(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*WrappedStruct) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx, field.Selections, res) } func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6185,32 +5885,29 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedScalar(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(WrappedScalar) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6226,7 +5923,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -6237,18 +5933,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -6257,7 +5951,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -6268,18 +5961,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Rectangle", @@ -6288,7 +5979,6 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Length, nil @@ -6299,18 +5989,16 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Rectangle", @@ -6319,7 +6007,6 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Width, nil @@ -6330,18 +6017,16 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Rectangle", @@ -6350,7 +6035,6 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -6361,18 +6045,16 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Slices", @@ -6381,7 +6063,6 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test1, nil @@ -6392,18 +6073,16 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col } res := resTmp.([]*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚕᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Slices", @@ -6412,7 +6091,6 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test2, nil @@ -6423,18 +6101,16 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Slices", @@ -6443,32 +6119,29 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test3, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Slices", @@ -6477,32 +6150,29 @@ func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test4, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Subscription_updated(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -6511,14 +6181,13 @@ func (ec *executionContext) _Subscription_updated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().Updated(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return nil @@ -6539,13 +6208,12 @@ func (ec *executionContext) _Subscription_updated(ctx context.Context, field gra } func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -6554,14 +6222,13 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().InitPayload(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return nil @@ -6582,13 +6249,12 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field } func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -6604,7 +6270,6 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel return nil } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveArg(rctx, args["arg"].(string)) @@ -6629,13 +6294,12 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel } func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -6651,7 +6315,6 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte return nil } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -6676,13 +6339,12 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte } func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -6691,7 +6353,6 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6742,13 +6403,12 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f } func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -6757,7 +6417,6 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6802,13 +6461,12 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -6817,32 +6475,29 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _User_friends(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -6851,32 +6506,29 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Friends(rctx, obj) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*User) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -6885,32 +6537,29 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -6919,7 +6568,6 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Updated, nil @@ -6930,18 +6578,16 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col } res := resTmp.(*time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ValidType", @@ -6950,32 +6596,29 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCase, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ValidType", @@ -6984,32 +6627,29 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCaseOld, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ValidType", @@ -7025,32 +6665,29 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidInputKeywords, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "ValidType", @@ -7066,32 +6703,29 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidArgs, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "WrappedStruct", @@ -7100,32 +6734,29 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "XXIt", @@ -7134,32 +6765,29 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.CollectedField, obj *XxIt) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "XxIt", @@ -7168,32 +6796,29 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -7202,32 +6827,29 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -7236,7 +6858,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7247,18 +6868,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -7267,32 +6886,29 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -7301,32 +6917,29 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -7335,32 +6948,29 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -7369,7 +6979,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7380,18 +6989,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -7400,32 +7007,29 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -7434,7 +7038,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7445,18 +7048,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -7465,32 +7066,29 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -7499,7 +7097,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7510,18 +7107,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -7530,32 +7125,29 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -7564,32 +7156,29 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -7598,32 +7187,29 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -7632,7 +7218,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7643,18 +7228,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -7663,32 +7246,29 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -7697,7 +7277,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7708,18 +7287,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -7728,32 +7305,29 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -7762,7 +7336,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -7773,18 +7346,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -7793,32 +7364,29 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -7827,32 +7395,29 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -7861,7 +7426,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -7872,18 +7436,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -7892,7 +7454,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -7903,18 +7464,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -7923,32 +7482,29 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -7957,32 +7513,29 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -7991,7 +7544,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -8002,18 +7554,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8022,7 +7572,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -8033,18 +7582,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8060,7 +7607,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -8071,18 +7617,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8091,7 +7635,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -8102,18 +7645,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8122,7 +7663,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -8133,18 +7673,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8160,7 +7698,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -8171,18 +7708,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8191,7 +7726,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -8202,18 +7736,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -8222,7 +7754,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -8233,18 +7764,16 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.CollectedField, obj *AsdfIt) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "asdfIt", @@ -8253,32 +7782,29 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.CollectedField, obj *IIt) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "iIt", @@ -8287,21 +7813,19 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } @@ -10858,7 +10382,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10872,7 +10396,7 @@ func (ec *executionContext) unmarshalNBytes2ᚕbyte(ctx context.Context, v inter func (ec *executionContext) marshalNBytes2ᚕbyte(ctx context.Context, sel ast.SelectionSet, v []byte) graphql.Marshaler { res := MarshalBytes(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10886,7 +10410,7 @@ func (ec *executionContext) unmarshalNDefaultScalarImplementation2string(ctx con func (ec *executionContext) marshalNDefaultScalarImplementation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10899,7 +10423,7 @@ func (ec *executionContext) marshalNError2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx context.Context, sel ast.SelectionSet, v *Error) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -10915,7 +10439,7 @@ func (ec *executionContext) unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99 func (ec *executionContext) marshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx context.Context, sel ast.SelectionSet, v FallbackToStringEncoding) graphql.Marshaler { res := graphql.MarshalString(string(v)) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10929,7 +10453,7 @@ func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalIntID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10943,7 +10467,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10980,7 +10504,7 @@ func (ec *executionContext) marshalNInnerObject2githubᚗcomᚋ99designsᚋgqlge func (ec *executionContext) marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerObject(ctx context.Context, sel ast.SelectionSet, v *InnerObject) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -10999,7 +10523,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11013,7 +10537,7 @@ func (ec *executionContext) unmarshalNInt2int32(ctx context.Context, v interface func (ec *executionContext) marshalNInt2int32(ctx context.Context, sel ast.SelectionSet, v int32) graphql.Marshaler { res := graphql.MarshalInt32(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11027,7 +10551,7 @@ func (ec *executionContext) unmarshalNInt2int64(ctx context.Context, v interface func (ec *executionContext) marshalNInt2int64(ctx context.Context, sel ast.SelectionSet, v int64) graphql.Marshaler { res := graphql.MarshalInt64(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11040,7 +10564,7 @@ func (ec *executionContext) marshalNLoopA2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) marshalNLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopA(ctx context.Context, sel ast.SelectionSet, v *LoopA) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11054,7 +10578,7 @@ func (ec *executionContext) marshalNLoopB2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopB(ctx context.Context, sel ast.SelectionSet, v *LoopB) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11188,7 +10712,7 @@ func (ec *executionContext) unmarshalNRecursiveInputSlice2githubᚗcomᚋ99desig func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShapeUnion(ctx context.Context, sel ast.SelectionSet, v ShapeUnion) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11203,7 +10727,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11278,7 +10802,7 @@ func (ec *executionContext) unmarshalNString2ᚖstring(ctx context.Context, v in func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11293,7 +10817,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11307,7 +10831,7 @@ func (ec *executionContext) unmarshalNUUID2string(ctx context.Context, v interfa func (ec *executionContext) marshalNUUID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11357,7 +10881,7 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx context.Context, sel ast.SelectionSet, v *User) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11373,7 +10897,7 @@ func (ec *executionContext) unmarshalNWrappedScalar2githubᚗcomᚋ99designsᚋg func (ec *executionContext) marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx context.Context, sel ast.SelectionSet, v WrappedScalar) graphql.Marshaler { res := graphql.MarshalString(string(v)) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11386,7 +10910,7 @@ func (ec *executionContext) marshalNWrappedStruct2githubᚗcomᚋ99designsᚋgql func (ec *executionContext) marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx context.Context, sel ast.SelectionSet, v *WrappedStruct) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11442,7 +10966,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11598,7 +11122,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11613,7 +11137,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/chat/generated.go b/example/chat/generated.go index deb141e7c1c..01ff89513f1 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -177,53 +177,47 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Subscription: + next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { + return ec._Subscription(ctx, rc.Operation.SelectionSet), nil + }) - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Mutation(ctx, op.SelectionSet) var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} - -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - next := ec._subscriptionMiddleware(ctx, op, func(ctx context.Context) (interface{}, error) { - return ec._Subscription(ctx, op.SelectionSet), nil - }) - if ec.Errors != nil { - return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) - } - - var buf bytes.Buffer - return func() *graphql.Response { - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { + return func(ctx context.Context) *graphql.Response { buf.Reset() data := next() @@ -231,18 +225,14 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe return nil } data.MarshalGQL(&buf) - return buf.Bytes() - }) - if buf == nil { - return nil + return &graphql.Response{ + Data: buf.Bytes(), + } } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } @@ -460,13 +450,12 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as // region **************************** field.gotpl ***************************** func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Chatroom", @@ -475,7 +464,6 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -485,25 +473,23 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Chatroom", @@ -512,7 +498,6 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Messages, nil @@ -522,25 +507,23 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]Message) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) } func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Message", @@ -549,7 +532,6 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -559,25 +541,23 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Message", @@ -586,7 +566,6 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -596,25 +575,23 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Message", @@ -623,7 +600,6 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedBy, nil @@ -633,25 +609,23 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Message", @@ -660,7 +634,6 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil @@ -670,25 +643,23 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -704,7 +675,6 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().Post(rctx, args["text"].(string), args["username"].(string), args["roomName"].(string)) @@ -714,25 +684,23 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Message) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) } func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -748,7 +716,6 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Room(rctx, args["name"].(string)) @@ -762,18 +729,16 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle } res := resTmp.(*Chatroom) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOChatroom2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐChatroom(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -789,7 +754,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -803,18 +767,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -823,7 +785,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -837,18 +798,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Subscription", @@ -864,7 +823,6 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel return nil } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().MessageAdded(rctx, args["roomName"].(string)) @@ -874,7 +832,7 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel return nil } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return nil @@ -895,13 +853,12 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -910,7 +867,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -920,25 +876,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -947,7 +901,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -961,18 +914,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -981,7 +932,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -991,25 +941,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1018,7 +966,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1028,25 +975,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1055,7 +1000,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1065,25 +1009,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1092,7 +1034,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1106,18 +1047,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1126,7 +1065,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1136,25 +1074,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1163,7 +1099,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1177,18 +1112,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1197,7 +1130,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1207,25 +1139,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1234,7 +1164,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1248,18 +1177,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1268,7 +1195,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1278,25 +1204,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1305,7 +1229,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1315,25 +1238,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1342,7 +1263,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1352,25 +1272,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1379,7 +1297,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1393,18 +1310,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1413,7 +1328,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1423,25 +1337,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1450,7 +1362,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1464,18 +1375,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1484,7 +1393,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1494,25 +1402,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1521,7 +1427,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1535,18 +1440,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1555,7 +1458,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1565,25 +1467,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1592,7 +1492,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1602,25 +1501,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1629,7 +1526,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1643,18 +1539,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1663,7 +1557,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1677,18 +1570,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1697,7 +1588,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1707,25 +1597,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1734,7 +1622,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1744,25 +1631,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1771,7 +1656,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1785,18 +1669,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1805,7 +1687,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1819,18 +1700,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1846,7 +1725,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1860,18 +1738,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1880,7 +1756,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1894,18 +1769,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1914,7 +1787,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1928,18 +1800,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1955,7 +1825,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1969,18 +1838,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1989,7 +1856,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2003,18 +1869,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2023,7 +1887,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2037,7 +1900,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2471,7 +2333,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2485,7 +2347,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2535,7 +2397,7 @@ func (ec *executionContext) marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx context.Context, sel ast.SelectionSet, v *Message) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2550,7 +2412,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2564,7 +2426,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2619,7 +2481,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2775,7 +2637,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2790,7 +2652,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/config/generated.go b/example/config/generated.go index 5c81a0fa06e..86084c649d3 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -162,44 +162,46 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Mutation(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) + return &graphql.Response{ + Data: buf.Bytes(), + } + } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) -} - type executionContext struct { *graphql.RequestContext *executableSchema @@ -322,13 +324,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -344,7 +345,6 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateTodo(rctx, args["input"].(NewTodo)) @@ -354,25 +354,23 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -381,7 +379,6 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Todos(rctx) @@ -391,25 +388,23 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -425,7 +420,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -439,18 +433,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -459,7 +451,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -473,18 +464,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -493,7 +482,6 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Todo().ID(rctx, obj) @@ -503,25 +491,23 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -530,7 +516,6 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DatabaseID, nil @@ -540,25 +525,23 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -567,7 +550,6 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -577,25 +559,23 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -604,7 +584,6 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Done, nil @@ -614,25 +593,23 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -641,7 +618,6 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -651,25 +627,23 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*User) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -678,7 +652,6 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -688,25 +661,23 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -715,7 +686,6 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FullName(), nil @@ -725,25 +695,23 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -752,7 +720,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -762,25 +729,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -789,7 +754,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -803,18 +767,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -823,7 +785,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -833,25 +794,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -860,7 +819,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -870,25 +828,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -897,7 +853,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -907,25 +862,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -934,7 +887,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -948,18 +900,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -968,7 +918,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -978,25 +927,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1005,7 +952,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1019,18 +965,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1039,7 +983,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1049,25 +992,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1076,7 +1017,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1090,18 +1030,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1110,7 +1048,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1120,25 +1057,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1147,7 +1082,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1157,25 +1091,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1184,7 +1116,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1194,25 +1125,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1221,7 +1150,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1235,18 +1163,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1255,7 +1181,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1265,25 +1190,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1292,7 +1215,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1306,18 +1228,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1326,7 +1246,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1336,25 +1255,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1363,7 +1280,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1377,18 +1293,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1397,7 +1311,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1407,25 +1320,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1434,7 +1345,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1444,25 +1354,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1471,7 +1379,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1485,18 +1392,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1505,7 +1410,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1519,18 +1423,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1539,7 +1441,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1549,25 +1450,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1576,7 +1475,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1586,25 +1484,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1613,7 +1509,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1627,18 +1522,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1647,7 +1540,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1661,18 +1553,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1688,7 +1578,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1702,18 +1591,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1722,7 +1609,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1736,18 +1622,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1756,7 +1640,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1770,18 +1653,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1797,7 +1678,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1811,18 +1691,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1831,7 +1709,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1845,18 +1722,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1865,7 +1740,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1879,7 +1753,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2334,7 +2207,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2348,7 +2221,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2362,7 +2235,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2380,7 +2253,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2430,7 +2303,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx context.Context, sel ast.SelectionSet, v *Todo) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2444,7 +2317,7 @@ func (ec *executionContext) marshalNUser2githubᚗcomᚋ99designsᚋgqlgenᚋexa func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐUser(ctx context.Context, sel ast.SelectionSet, v *User) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2500,7 +2373,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2656,7 +2529,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2671,7 +2544,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index c4e04e815de..c755625e488 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -222,29 +222,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") -} + return &graphql.Response{ + Data: buf.Bytes(), + } + } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } } type executionContext struct { @@ -385,13 +386,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Address", @@ -400,7 +400,6 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -410,25 +409,23 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Address_street(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Address", @@ -437,7 +434,6 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Street, nil @@ -447,25 +443,23 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Address_country(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Address", @@ -474,7 +468,6 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Country, nil @@ -484,25 +477,23 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Customer", @@ -511,7 +502,6 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -521,25 +511,23 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Customer", @@ -548,7 +536,6 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -558,25 +545,23 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Customer_address(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Customer", @@ -585,7 +570,6 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Address(rctx, obj) @@ -599,18 +583,16 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql } res := resTmp.(*Address) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOAddress2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐAddress(ctx, field.Selections, res) } func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Customer", @@ -619,7 +601,6 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Orders(rctx, obj) @@ -633,18 +614,16 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. } res := resTmp.([]*Order) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐOrder(ctx, field.Selections, res) } func (ec *executionContext) _Item_name(ctx context.Context, field graphql.CollectedField, obj *Item) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Item", @@ -653,7 +632,6 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -663,25 +641,23 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Order_id(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Order", @@ -690,7 +666,6 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -700,25 +675,23 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Order_date(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Order", @@ -727,7 +700,6 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Date, nil @@ -737,25 +709,23 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Order", @@ -764,7 +734,6 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Amount, nil @@ -774,25 +743,23 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Order_items(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Order", @@ -801,7 +768,6 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Order().Items(rctx, obj) @@ -815,18 +781,16 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll } res := resTmp.([]*Item) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOItem2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐItem(ctx, field.Selections, res) } func (ec *executionContext) _Query_customers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -835,7 +799,6 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Customers(rctx) @@ -849,18 +812,16 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. } res := resTmp.([]*Customer) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -876,7 +837,6 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture1d(rctx, args["customerIds"].([]int)) @@ -890,18 +850,16 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. } res := resTmp.([]*Customer) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -917,7 +875,6 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture2d(rctx, args["customerIds"].([][]int)) @@ -931,18 +888,16 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. } res := resTmp.([][]*Customer) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCustomer2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -958,7 +913,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -972,18 +926,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -992,7 +944,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -1006,18 +957,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1026,7 +975,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1036,25 +984,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1063,7 +1009,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1077,18 +1022,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1097,7 +1040,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -1107,25 +1049,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1134,7 +1074,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1144,25 +1083,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1171,7 +1108,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1181,25 +1117,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1208,7 +1142,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1222,18 +1155,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1242,7 +1173,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1252,25 +1182,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1279,7 +1207,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1293,18 +1220,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1313,7 +1238,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1323,25 +1247,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1350,7 +1272,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1364,18 +1285,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1384,7 +1303,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1394,25 +1312,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1421,7 +1337,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1431,25 +1346,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1458,7 +1371,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1468,25 +1380,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1495,7 +1405,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1509,18 +1418,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1529,7 +1436,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1539,25 +1445,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1566,7 +1470,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1580,18 +1483,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1600,7 +1501,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1610,25 +1510,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1637,7 +1535,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1651,18 +1548,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1671,7 +1566,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1681,25 +1575,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1708,7 +1600,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1718,25 +1609,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1745,7 +1634,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1759,18 +1647,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1779,7 +1665,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1793,18 +1678,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1813,7 +1696,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1823,25 +1705,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1850,7 +1730,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1860,25 +1739,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1887,7 +1764,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1901,18 +1777,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1921,7 +1795,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1935,18 +1808,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1962,7 +1833,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1976,18 +1846,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1996,7 +1864,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -2010,18 +1877,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2030,7 +1895,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -2044,18 +1908,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2071,7 +1933,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -2085,18 +1946,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2105,7 +1964,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2119,18 +1977,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2139,7 +1995,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2153,7 +2008,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2650,7 +2504,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2663,7 +2517,7 @@ func (ec *executionContext) marshalNCustomer2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNCustomer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx context.Context, sel ast.SelectionSet, v *Customer) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2678,7 +2532,7 @@ func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v inter func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { res := graphql.MarshalFloat(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2692,7 +2546,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2705,7 +2559,7 @@ func (ec *executionContext) marshalNItem2githubᚗcomᚋ99designsᚋgqlgenᚋexa func (ec *executionContext) marshalNItem2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐItem(ctx context.Context, sel ast.SelectionSet, v *Item) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2719,7 +2573,7 @@ func (ec *executionContext) marshalNOrder2githubᚗcomᚋ99designsᚋgqlgenᚋex func (ec *executionContext) marshalNOrder2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐOrder(ctx context.Context, sel ast.SelectionSet, v *Order) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2734,7 +2588,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2748,7 +2602,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2803,7 +2657,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2959,7 +2813,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2974,7 +2828,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 51d089f0625..31e6645d38b 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -166,44 +166,46 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Mutation(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) + return &graphql.Response{ + Data: buf.Bytes(), + } + } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) -} - type executionContext struct { *graphql.RequestContext *executableSchema @@ -367,13 +369,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "File", @@ -382,7 +383,6 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -392,25 +392,23 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _File_name(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "File", @@ -419,7 +417,6 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -429,25 +426,23 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _File_content(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "File", @@ -456,7 +451,6 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Content, nil @@ -466,25 +460,23 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -500,7 +492,6 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUpload(rctx, args["file"].(graphql.Upload)) @@ -510,25 +501,23 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*model.File) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -544,7 +533,6 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUploadWithPayload(rctx, args["req"].(model.UploadFile)) @@ -554,25 +542,23 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*model.File) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -588,7 +574,6 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUpload(rctx, args["files"].([]*graphql.Upload)) @@ -598,25 +583,23 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*model.File) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -632,7 +615,6 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUploadWithPayload(rctx, args["req"].([]*model.UploadFile)) @@ -642,25 +624,23 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*model.File) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -669,7 +649,6 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Empty(rctx) @@ -679,25 +658,23 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -713,7 +690,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -727,18 +703,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -747,7 +721,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -761,18 +734,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -781,7 +752,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -791,25 +761,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -818,7 +786,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -832,18 +799,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -852,7 +817,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -862,25 +826,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -889,7 +851,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -899,25 +860,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -926,7 +885,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -936,25 +894,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -963,7 +919,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -977,18 +932,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -997,7 +950,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1007,25 +959,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1034,7 +984,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1048,18 +997,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1068,7 +1015,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1078,25 +1024,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1105,7 +1049,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1119,18 +1062,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1139,7 +1080,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1149,25 +1089,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1176,7 +1114,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1186,25 +1123,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1213,7 +1148,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1223,25 +1157,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1250,7 +1182,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1264,18 +1195,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1284,7 +1213,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1294,25 +1222,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1321,7 +1247,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1335,18 +1260,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1355,7 +1278,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1365,25 +1287,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1392,7 +1312,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1406,18 +1325,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1426,7 +1343,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1436,25 +1352,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1463,7 +1377,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1473,25 +1386,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1500,7 +1411,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1514,18 +1424,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1534,7 +1442,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1548,18 +1455,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1568,7 +1473,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1578,25 +1482,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1605,7 +1507,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1615,25 +1516,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1642,7 +1541,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1656,18 +1554,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1676,7 +1572,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1690,18 +1585,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1717,7 +1610,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1731,18 +1623,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1751,7 +1641,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1765,18 +1654,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1785,7 +1672,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1799,18 +1685,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1826,7 +1710,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1840,18 +1723,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1860,7 +1741,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1874,18 +1754,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1894,7 +1772,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1908,7 +1785,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2327,7 +2203,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2377,7 +2253,7 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx context.Context, sel ast.SelectionSet, v *model.File) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2392,7 +2268,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2406,7 +2282,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2420,7 +2296,7 @@ func (ec *executionContext) unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v graphql.Upload) graphql.Marshaler { res := graphql.MarshalUpload(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2466,7 +2342,7 @@ func (ec *executionContext) unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlge func (ec *executionContext) marshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v *graphql.Upload) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2554,7 +2430,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2710,7 +2586,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2725,7 +2601,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/scalars/generated.go b/example/scalars/generated.go index e38459d81e7..0cacd4c2b92 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -189,29 +189,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") -} + return &graphql.Response{ + Data: buf.Bytes(), + } + } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } } type executionContext struct { @@ -356,13 +357,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Address", @@ -371,7 +371,6 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -381,25 +380,23 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(external.ObjectID) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, field.Selections, res) } func (ec *executionContext) _Address_location(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Address", @@ -408,7 +405,6 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Location, nil @@ -422,18 +418,16 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql } res := resTmp.(*model.Point) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, field.Selections, res) } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -449,7 +443,6 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(external.ObjectID)) @@ -463,18 +456,16 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } res := resTmp.(*model.User) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -490,7 +481,6 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["input"].(*model.SearchArgs)) @@ -500,25 +490,23 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*model.User) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -534,7 +522,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -548,18 +535,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -568,7 +553,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -582,18 +566,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -602,7 +584,6 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -612,25 +593,23 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(external.ObjectID) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, field.Selections, res) } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -639,7 +618,6 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -649,25 +627,23 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -676,7 +652,6 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil @@ -690,18 +665,16 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTimestamp2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -710,7 +683,6 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsBanned, nil @@ -720,25 +692,23 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(model.Banned) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx, field.Selections, res) } func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -747,7 +717,6 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().PrimitiveResolver(rctx, obj) @@ -757,25 +726,23 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _User_customResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -784,7 +751,6 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().CustomResolver(rctx, obj) @@ -794,25 +760,23 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*model.Point) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, field.Selections, res) } func (ec *executionContext) _User_address(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -821,7 +785,6 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Address, nil @@ -835,18 +798,16 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col } res := resTmp.(model.Address) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOAddress2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐAddress(ctx, field.Selections, res) } func (ec *executionContext) _User_tier(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -855,7 +816,6 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Tier, nil @@ -869,18 +829,16 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec } res := resTmp.(model.Tier) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -889,7 +847,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -899,25 +856,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -926,7 +881,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -940,18 +894,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -960,7 +912,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -970,25 +921,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -997,7 +946,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1007,25 +955,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1034,7 +980,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1044,25 +989,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1071,7 +1014,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1085,18 +1027,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1105,7 +1045,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1115,25 +1054,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1142,7 +1079,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1156,18 +1092,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1176,7 +1110,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1186,25 +1119,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1213,7 +1144,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1227,18 +1157,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1247,7 +1175,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1257,25 +1184,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1284,7 +1209,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1294,25 +1218,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1321,7 +1243,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1331,25 +1252,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1358,7 +1277,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1372,18 +1290,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1392,7 +1308,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1402,25 +1317,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1429,7 +1342,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1443,18 +1355,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1463,7 +1373,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1473,25 +1382,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1500,7 +1407,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1514,18 +1420,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1534,7 +1438,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1544,25 +1447,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1571,7 +1472,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1581,25 +1481,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1608,7 +1506,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1622,18 +1519,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1642,7 +1537,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1656,18 +1550,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1676,7 +1568,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1686,25 +1577,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1713,7 +1602,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1723,25 +1611,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1750,7 +1636,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1764,18 +1649,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1784,7 +1667,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1798,18 +1680,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1825,7 +1705,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1839,18 +1718,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1859,7 +1736,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1873,18 +1749,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1893,7 +1767,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1907,18 +1780,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1934,7 +1805,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1948,18 +1818,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1968,7 +1836,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1982,18 +1849,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2002,7 +1867,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2016,7 +1880,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2478,7 +2341,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2492,7 +2355,7 @@ func (ec *executionContext) unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexa func (ec *executionContext) marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx context.Context, sel ast.SelectionSet, v external.ObjectID) graphql.Marshaler { res := model.MarshalID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2518,7 +2381,7 @@ func (ec *executionContext) unmarshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v *model.Point) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2533,7 +2396,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2583,7 +2446,7 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2639,7 +2502,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2795,7 +2658,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2810,7 +2673,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/selection/generated.go b/example/selection/generated.go index 206fef77566..3cf0c0b4553 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -147,29 +147,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") -} + return &graphql.Response{ + Data: buf.Bytes(), + } + } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } } type executionContext struct { @@ -274,13 +275,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Like", @@ -289,7 +289,6 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Reaction, nil @@ -299,25 +298,23 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Like", @@ -326,7 +323,6 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -336,25 +332,23 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Like", @@ -363,7 +357,6 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -377,18 +370,16 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Like", @@ -397,7 +388,6 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -411,18 +401,16 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Post", @@ -431,7 +419,6 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Message, nil @@ -441,25 +428,23 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Post", @@ -468,7 +453,6 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -478,25 +462,23 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Post", @@ -505,7 +487,6 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -519,18 +500,16 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Post", @@ -539,7 +518,6 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -553,18 +531,16 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -573,7 +549,6 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Events(rctx) @@ -587,18 +562,16 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col } res := resTmp.([]Event) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋselectionᚐEvent(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -614,7 +587,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -628,18 +600,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -648,7 +618,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -662,18 +631,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -682,7 +649,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -692,25 +658,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -719,7 +683,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -733,18 +696,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -753,7 +714,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -763,25 +723,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -790,7 +748,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -800,25 +757,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -827,7 +782,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -837,25 +791,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -864,7 +816,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -878,18 +829,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -898,7 +847,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -908,25 +856,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -935,7 +881,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -949,18 +894,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -969,7 +912,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -979,25 +921,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1006,7 +946,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1020,18 +959,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1040,7 +977,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1050,25 +986,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1077,7 +1011,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1087,25 +1020,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1114,7 +1045,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1124,25 +1054,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1151,7 +1079,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1165,18 +1092,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1185,7 +1110,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1195,25 +1119,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1222,7 +1144,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1236,18 +1157,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1256,7 +1175,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1266,25 +1184,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1293,7 +1209,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1307,18 +1222,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1327,7 +1240,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1337,25 +1249,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1364,7 +1274,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1374,25 +1283,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1401,7 +1308,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1415,18 +1321,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1435,7 +1339,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1449,18 +1352,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1469,7 +1370,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1479,25 +1379,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1506,7 +1404,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1516,25 +1413,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1543,7 +1438,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1557,18 +1451,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1577,7 +1469,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1591,18 +1482,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1618,7 +1507,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1632,18 +1520,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1652,7 +1538,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1666,18 +1551,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1686,7 +1569,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1700,18 +1582,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1727,7 +1607,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1741,18 +1620,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1761,7 +1638,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1775,18 +1651,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1795,7 +1669,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1809,7 +1682,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2207,7 +2079,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2216,7 +2088,7 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se func (ec *executionContext) marshalNEvent2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋselectionᚐEvent(ctx context.Context, sel ast.SelectionSet, v Event) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2231,7 +2103,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2245,7 +2117,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2300,7 +2172,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2456,7 +2328,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2471,7 +2343,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index bca57b48a19..807f0dfc351 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -490,44 +490,46 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Mutation(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) + return &graphql.Response{ + Data: buf.Bytes(), + } + } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) -} - type executionContext struct { *graphql.RequestContext *executableSchema @@ -937,13 +939,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Droid", @@ -952,7 +953,6 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -962,25 +962,23 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Droid", @@ -989,7 +987,6 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -999,25 +996,23 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Droid", @@ -1026,7 +1021,6 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().Friends(rctx, obj) @@ -1040,18 +1034,16 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co } res := resTmp.([]models.Character) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Droid", @@ -1067,7 +1059,6 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1077,25 +1068,23 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*models.FriendsConnection) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx, field.Selections, res) } func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Droid", @@ -1104,7 +1093,6 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1114,25 +1102,23 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]models.Episode) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, field.Selections, res) } func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Droid", @@ -1141,7 +1127,6 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PrimaryFunction, nil @@ -1155,18 +1140,16 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", @@ -1175,7 +1158,6 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount(), nil @@ -1185,25 +1167,23 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", @@ -1212,7 +1192,6 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Edges(rctx, obj) @@ -1226,18 +1205,16 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field } res := resTmp.([]*models.FriendsEdge) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFriendsEdge2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsEdge(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", @@ -1246,7 +1223,6 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Friends(rctx, obj) @@ -1260,18 +1236,16 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel } res := resTmp.([]models.Character) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", @@ -1280,7 +1254,6 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo(), nil @@ -1290,25 +1263,23 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(models.PageInfo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNPageInfo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "FriendsEdge", @@ -1317,7 +1288,6 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil @@ -1327,25 +1297,23 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "FriendsEdge", @@ -1354,7 +1322,6 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil @@ -1368,18 +1335,16 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql } res := resTmp.(models.Character) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1388,7 +1353,6 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -1398,25 +1362,23 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1425,7 +1387,6 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1435,25 +1396,23 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1469,7 +1428,6 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Height(args["unit"].(models.LengthUnit)), nil @@ -1479,25 +1437,23 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1506,7 +1462,6 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Mass, nil @@ -1520,18 +1475,16 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1540,7 +1493,6 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Friends(rctx, obj) @@ -1554,18 +1506,16 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co } res := resTmp.([]models.Character) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1581,7 +1531,6 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1591,25 +1540,23 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*models.FriendsConnection) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx, field.Selections, res) } func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1618,7 +1565,6 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1628,25 +1574,23 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]models.Episode) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, field.Selections, res) } func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Human", @@ -1655,7 +1599,6 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Starships(rctx, obj) @@ -1669,18 +1612,16 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. } res := resTmp.([]*models.Starship) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOStarship2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Mutation", @@ -1696,7 +1637,6 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateReview(rctx, args["episode"].(models.Episode), args["review"].(models.Review)) @@ -1710,18 +1650,16 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr } res := resTmp.(*models.Review) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOReview2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, field.Selections, res) } func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "PageInfo", @@ -1730,7 +1668,6 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.StartCursor, nil @@ -1740,25 +1677,23 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "PageInfo", @@ -1767,7 +1702,6 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EndCursor, nil @@ -1777,25 +1711,23 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "PageInfo", @@ -1804,7 +1736,6 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.HasNextPage, nil @@ -1814,25 +1745,23 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -1848,7 +1777,6 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Hero(rctx, args["episode"].(*models.Episode)) @@ -1862,18 +1790,16 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle } res := resTmp.(models.Character) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -1889,7 +1815,6 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Reviews(rctx, args["episode"].(models.Episode), args["since"].(*time.Time)) @@ -1899,25 +1824,23 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*models.Review) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, field.Selections, res) } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -1933,7 +1856,6 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["text"].(string)) @@ -1943,25 +1865,23 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]models.SearchResult) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNSearchResult2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐSearchResult(ctx, field.Selections, res) } func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -1977,7 +1897,6 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Character(rctx, args["id"].(string)) @@ -1991,18 +1910,16 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. } res := resTmp.(models.Character) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -2018,7 +1935,6 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Droid(rctx, args["id"].(string)) @@ -2032,18 +1948,16 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll } res := resTmp.(*models.Droid) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalODroid2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐDroid(ctx, field.Selections, res) } func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -2059,7 +1973,6 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Human(rctx, args["id"].(string)) @@ -2073,18 +1986,16 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll } res := resTmp.(*models.Human) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOHuman2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐHuman(ctx, field.Selections, res) } func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -2100,7 +2011,6 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Starship(rctx, args["id"].(string)) @@ -2114,18 +2024,16 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C } res := resTmp.(*models.Starship) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOStarship2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -2141,7 +2049,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -2155,18 +2062,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -2175,7 +2080,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -2189,18 +2093,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Review", @@ -2209,7 +2111,6 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Stars, nil @@ -2219,25 +2120,23 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Review", @@ -2246,7 +2145,6 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Commentary, nil @@ -2260,18 +2158,16 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Review", @@ -2280,7 +2176,6 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Time, nil @@ -2294,18 +2189,16 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll } res := resTmp.(time.Time) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Starship", @@ -2314,7 +2207,6 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2324,25 +2216,23 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Starship", @@ -2351,7 +2241,6 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2361,25 +2250,23 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Starship", @@ -2395,7 +2282,6 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Starship().Length(rctx, obj, args["unit"].(*models.LengthUnit)) @@ -2405,25 +2291,23 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(float64) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Starship", @@ -2432,7 +2316,6 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.History, nil @@ -2442,25 +2325,23 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([][]int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNInt2ᚕᚕint(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -2469,7 +2350,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2479,25 +2359,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -2506,7 +2384,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2520,18 +2397,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -2540,7 +2415,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -2550,25 +2424,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -2577,7 +2449,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2587,25 +2458,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -2614,7 +2483,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2624,25 +2492,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -2651,7 +2517,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2665,18 +2530,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -2685,7 +2548,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2695,25 +2557,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -2722,7 +2582,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2736,18 +2595,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -2756,7 +2613,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2766,25 +2622,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -2793,7 +2647,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2807,18 +2660,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -2827,7 +2678,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2837,25 +2687,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -2864,7 +2712,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -2874,25 +2721,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -2901,7 +2746,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2911,25 +2755,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -2938,7 +2780,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2952,18 +2793,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -2972,7 +2811,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2982,25 +2820,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -3009,7 +2845,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -3023,18 +2858,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -3043,7 +2876,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -3053,25 +2885,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -3080,7 +2910,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -3094,18 +2923,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -3114,7 +2941,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -3124,25 +2950,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -3151,7 +2975,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -3161,25 +2984,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -3188,7 +3009,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -3202,18 +3022,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -3222,7 +3040,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -3236,18 +3053,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -3256,7 +3071,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -3266,25 +3080,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3293,7 +3105,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -3303,25 +3114,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3330,7 +3139,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -3344,18 +3152,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3364,7 +3170,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -3378,18 +3183,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3405,7 +3208,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -3419,18 +3221,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3439,7 +3239,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -3453,18 +3252,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3473,7 +3270,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -3487,18 +3283,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3514,7 +3308,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -3528,18 +3321,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3548,7 +3339,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -3562,18 +3352,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -3582,7 +3370,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -3596,7 +3383,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -4419,7 +4205,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4428,7 +4214,7 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se func (ec *executionContext) marshalNCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx context.Context, sel ast.SelectionSet, v models.Character) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4509,7 +4295,7 @@ func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v inter func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { res := graphql.MarshalFloat(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4522,7 +4308,7 @@ func (ec *executionContext) marshalNFriendsConnection2githubᚗcomᚋ99designs func (ec *executionContext) marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx context.Context, sel ast.SelectionSet, v *models.FriendsConnection) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4536,7 +4322,7 @@ func (ec *executionContext) marshalNFriendsEdge2githubᚗcomᚋ99designsᚋgqlge func (ec *executionContext) marshalNFriendsEdge2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsEdge(ctx context.Context, sel ast.SelectionSet, v *models.FriendsEdge) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4551,7 +4337,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4565,7 +4351,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4677,7 +4463,7 @@ func (ec *executionContext) marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg func (ec *executionContext) marshalNReview2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx context.Context, sel ast.SelectionSet, v *models.Review) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4691,7 +4477,7 @@ func (ec *executionContext) unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgql func (ec *executionContext) marshalNSearchResult2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐSearchResult(ctx context.Context, sel ast.SelectionSet, v models.SearchResult) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4742,7 +4528,7 @@ func (ec *executionContext) marshalNStarship2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNStarship2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx context.Context, sel ast.SelectionSet, v *models.Starship) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4757,7 +4543,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4812,7 +4598,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4968,7 +4754,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4983,7 +4769,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/todo/generated.go b/example/todo/generated.go index 29740ea6f75..3ba49625bae 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -164,48 +164,50 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._queryMiddleware(ctx, op, func(ctx context.Context) (interface{}, error) { - return ec._MyQuery(ctx, op.SelectionSet), nil - }) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { + return ec._MyQuery(ctx, rc.Operation.SelectionSet), nil + }) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { + return ec._MyMutation(ctx, rc.Operation.SelectionSet), nil + }) + var buf bytes.Buffer + data.MarshalGQL(&buf) - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._mutationMiddleware(ctx, op, func(ctx context.Context) (interface{}, error) { - return ec._MyMutation(ctx, op.SelectionSet), nil - }) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) + return &graphql.Response{ + Data: buf.Bytes(), + } + } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) -} - type executionContext struct { *graphql.RequestContext *executableSchema @@ -496,13 +498,12 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyMutation", @@ -518,32 +519,29 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyMutation", @@ -559,7 +557,6 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{})) @@ -570,18 +567,16 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -597,7 +592,6 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int)) @@ -608,18 +602,16 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -628,7 +620,6 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().LastTodo(rctx) @@ -639,18 +630,16 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -659,32 +648,29 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -700,7 +686,6 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -711,18 +696,16 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -731,7 +714,6 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -742,18 +724,16 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -762,32 +742,29 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2int(ctx, field.Selections, res) } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -796,32 +773,29 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -830,7 +804,6 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -861,25 +834,23 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -888,32 +859,29 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -922,7 +890,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -933,18 +900,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -953,32 +918,29 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -987,32 +949,29 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1021,32 +980,29 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1055,7 +1011,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1066,18 +1021,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1086,32 +1039,29 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1120,7 +1070,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1131,18 +1080,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1151,32 +1098,29 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1185,7 +1129,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1196,18 +1139,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1216,32 +1157,29 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1250,32 +1188,29 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1284,32 +1219,29 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1318,7 +1250,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1329,18 +1260,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1349,32 +1278,29 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1383,7 +1309,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1394,18 +1319,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1414,32 +1337,29 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1448,7 +1368,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1459,18 +1378,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1479,32 +1396,29 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1513,32 +1427,29 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1547,7 +1458,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1558,18 +1468,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1578,7 +1486,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1589,18 +1496,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1609,32 +1514,29 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1643,32 +1545,29 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1677,7 +1576,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1688,18 +1586,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1708,7 +1604,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1719,18 +1614,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1746,7 +1639,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1757,18 +1649,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1777,7 +1667,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1788,18 +1677,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1808,7 +1695,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1819,18 +1705,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1846,7 +1730,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1857,18 +1740,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1877,7 +1758,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1888,18 +1768,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1908,7 +1786,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1919,7 +1796,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2347,7 +2223,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2361,7 +2237,7 @@ func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalIntID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2377,14 +2253,14 @@ func (ec *executionContext) unmarshalNMap2map(ctx context.Context, v interface{} func (ec *executionContext) marshalNMap2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := graphql.MarshalMap(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2407,7 +2283,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2457,7 +2333,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx context.Context, sel ast.SelectionSet, v *Todo) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2517,7 +2393,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2673,7 +2549,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2688,7 +2564,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index a490de20442..aab12d618d8 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -159,44 +159,46 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._MyQuery(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._MyQuery(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._MyMutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._MyMutation(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) + return &graphql.Response{ + Data: buf.Bytes(), + } + } - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) -} - type executionContext struct { *graphql.RequestContext *executableSchema @@ -377,13 +379,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyMutation", @@ -399,7 +400,6 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) @@ -409,25 +409,23 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -436,7 +434,6 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) @@ -446,25 +443,23 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -480,7 +475,6 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(string)) @@ -494,18 +488,16 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } res := resTmp.(*Todo) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -521,7 +513,6 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -535,18 +526,16 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "MyQuery", @@ -555,7 +544,6 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -569,18 +557,16 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -589,7 +575,6 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -599,25 +584,23 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -626,7 +609,6 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -636,25 +618,23 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -663,7 +643,6 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.State, nil @@ -673,25 +652,23 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(State) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx, field.Selections, res) } func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Todo", @@ -700,7 +677,6 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 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 @@ -730,25 +706,23 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -757,7 +731,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -767,25 +740,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -794,7 +765,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -808,18 +778,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -828,7 +796,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -838,25 +805,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -865,7 +830,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -875,25 +839,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -902,7 +864,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -912,25 +873,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -939,7 +898,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -953,18 +911,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -973,7 +929,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -983,25 +938,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1010,7 +963,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1024,18 +976,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1044,7 +994,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1054,25 +1003,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1081,7 +1028,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1095,18 +1041,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1115,7 +1059,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1125,25 +1068,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1152,7 +1093,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1162,25 +1102,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1189,7 +1127,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1199,25 +1136,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1226,7 +1161,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1240,18 +1174,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1260,7 +1192,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1270,25 +1201,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1297,7 +1226,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1311,18 +1239,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1331,7 +1257,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1341,25 +1266,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1368,7 +1291,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1382,18 +1304,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1402,7 +1322,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1412,25 +1331,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1439,7 +1356,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1449,25 +1365,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1476,7 +1390,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1490,18 +1403,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1510,7 +1421,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1524,18 +1434,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1544,7 +1452,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1554,25 +1461,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1581,7 +1486,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1591,25 +1495,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1618,7 +1520,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1632,18 +1533,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1652,7 +1551,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1666,18 +1564,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1693,7 +1589,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1707,18 +1602,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1727,7 +1620,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1741,18 +1633,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1761,7 +1651,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1775,18 +1664,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1802,7 +1689,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1816,18 +1702,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1836,7 +1720,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1850,18 +1733,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1870,7 +1751,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1884,7 +1764,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2324,7 +2203,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2338,7 +2217,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2361,7 +2240,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2411,7 +2290,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx context.Context, sel ast.SelectionSet, v *Todo) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2471,7 +2350,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2627,7 +2506,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2642,7 +2521,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/integration/generated.go b/integration/generated.go index bcbe243707d..a197023e435 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -206,29 +206,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } -func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e} - - buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._Query(ctx, op.SelectionSet) - var buf bytes.Buffer - data.MarshalGQL(&buf) - return buf.Bytes() - }) - - return &graphql.Response{ - Data: buf, - Errors: ec.Errors, - Extensions: ec.Extensions, - } -} +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetRequestContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) -func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - return graphql.ErrorResponse(ctx, "mutations are not supported") -} + return &graphql.Response{ + Data: buf.Bytes(), + } + } -func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } } type executionContext struct { @@ -416,13 +417,12 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Element", @@ -431,7 +431,6 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Child(rctx, obj) @@ -441,25 +440,23 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*models.Element) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNElement2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx, field.Selections, res) } func (ec *executionContext) _Element_error(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Element", @@ -468,7 +465,6 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Error(rctx, obj) @@ -478,25 +474,23 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Element_mismatched(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Element", @@ -505,7 +499,6 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Mismatched(rctx, obj) @@ -519,18 +512,16 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph } res := resTmp.([]bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOBoolean2ᚕbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_path(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -539,7 +530,6 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Path(rctx) @@ -553,18 +543,16 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle } res := resTmp.([]*models.Element) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOElement2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx, field.Selections, res) } func (ec *executionContext) _Query_date(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -580,7 +568,6 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Date(rctx, args["filter"].(models.DateFilter)) @@ -590,25 +577,23 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -617,7 +602,6 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Viewer(rctx) @@ -631,18 +615,16 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col } res := resTmp.(*models.Viewer) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOViewer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐViewer(ctx, field.Selections, res) } func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -651,7 +633,6 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().JSONEncoding(rctx) @@ -661,25 +642,23 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_error(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -695,7 +674,6 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Error(rctx, args["type"].(*models.ErrorType)) @@ -705,25 +683,23 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -739,7 +715,6 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Complexity(rctx, args["value"].(int)) @@ -749,25 +724,23 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -783,7 +756,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -797,18 +769,16 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Query", @@ -817,7 +787,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -831,18 +800,16 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } res := resTmp.(*introspection.Schema) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -851,7 +818,6 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -861,25 +827,23 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _User_likes(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "User", @@ -888,7 +852,6 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Likes(rctx, obj) @@ -898,25 +861,23 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.CollectedField, obj *models.Viewer) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "Viewer", @@ -925,7 +886,6 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -939,18 +899,16 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll } res := resTmp.(*remote_api.User) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋremote_apiᚐUser(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -959,7 +917,6 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -969,25 +926,23 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -996,7 +951,6 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1010,18 +964,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1030,7 +982,6 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -1040,25 +991,23 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Directive", @@ -1067,7 +1016,6 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1077,25 +1025,23 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1104,7 +1050,6 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1114,25 +1059,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1141,7 +1084,6 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1155,18 +1097,16 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1175,7 +1115,6 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1185,25 +1124,23 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", @@ -1212,7 +1149,6 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1226,18 +1162,16 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1246,7 +1180,6 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1256,25 +1189,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1283,7 +1214,6 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1297,18 +1227,16 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1317,7 +1245,6 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1327,25 +1254,23 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1354,7 +1279,6 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1364,25 +1288,23 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1391,7 +1313,6 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1401,25 +1322,23 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Field", @@ -1428,7 +1347,6 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1442,18 +1360,16 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1462,7 +1378,6 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1472,25 +1387,23 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1499,7 +1412,6 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1513,18 +1425,16 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1533,7 +1443,6 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1543,25 +1452,23 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__InputValue", @@ -1570,7 +1477,6 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1584,18 +1490,16 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1604,7 +1508,6 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1614,25 +1517,23 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1641,7 +1542,6 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1651,25 +1551,23 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1678,7 +1576,6 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1692,18 +1589,16 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1712,7 +1607,6 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1726,18 +1620,16 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Schema", @@ -1746,7 +1638,6 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1756,25 +1647,23 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1783,7 +1672,6 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1793,25 +1681,23 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !ec.HasError(rctx) { + if !graphql.HasFieldError(ctx, rctx) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1820,7 +1706,6 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1834,18 +1719,16 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } res := resTmp.(*string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1854,7 +1737,6 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1868,18 +1750,16 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } res := resTmp.(string) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1895,7 +1775,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1909,18 +1788,16 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } res := resTmp.([]introspection.Field) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1929,7 +1806,6 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1943,18 +1819,16 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -1963,7 +1837,6 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1977,18 +1850,16 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } res := resTmp.([]introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2004,7 +1875,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -2018,18 +1888,16 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } res := resTmp.([]introspection.EnumValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2038,7 +1906,6 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2052,18 +1919,16 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } res := resTmp.([]introspection.InputValue) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } - ec.Tracer.EndFieldExecution(ctx) }() rctx := &graphql.ResolverContext{ Object: "__Type", @@ -2072,7 +1937,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2086,7 +1950,6 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } res := resTmp.(*introspection.Type) rctx.Result = res - ctx = ec.Tracer.StartFieldChildExecution(ctx) return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2625,7 +2488,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2642,7 +2505,7 @@ func (ec *executionContext) marshalNElement2githubᚗcomᚋ99designsᚋgqlgenᚋ func (ec *executionContext) marshalNElement2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx context.Context, sel ast.SelectionSet, v *models.Element) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2657,7 +2520,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2671,7 +2534,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2755,7 +2618,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2911,7 +2774,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2926,7 +2789,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } } From 3476ac44bf70da28b606bd92f7d7e8dd68b371e7 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2019 15:32:02 +1100 Subject: [PATCH 28/53] fix linting issues --- graphql/handler/apollotracing/tracer.go | 2 +- graphql/handler/apollotracing/tracer_test.go | 2 +- graphql/handler/executor.go | 4 +- graphql/handler/extension/apq.go | 11 +- graphql/handler/extension/apq_test.go | 6 +- .../handler/extension/introspection_test.go | 2 +- graphql/handler/transport/http_get.go | 4 +- graphql/handler/transport/http_post.go | 4 +- graphql/tracer.go | 119 ------------------ handler/handler.go | 4 +- 10 files changed, 17 insertions(+), 141 deletions(-) delete mode 100644 graphql/tracer.go diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index cc7eaf6fe14..27e424fff76 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -12,7 +12,7 @@ type ( ApolloTracing struct{} TracingExtension struct { - mu sync.Mutex `json:"-"` + mu sync.Mutex Version int `json:"version"` StartTime time.Time `json:"startTime"` EndTime time.Time `json:"endTime"` diff --git a/graphql/handler/apollotracing/tracer_test.go b/graphql/handler/apollotracing/tracer_test.go index f0622d471a1..e2e3a93ccdf 100644 --- a/graphql/handler/apollotracing/tracer_test.go +++ b/graphql/handler/apollotracing/tracer_test.go @@ -28,7 +28,7 @@ func TestApolloTracing(t *testing.T) { } require.NoError(t, json.Unmarshal(resp.Body.Bytes(), &respData)) - tracing := respData.Extensions.Tracing + tracing := &respData.Extensions.Tracing require.EqualValues(t, 1, tracing.Version) diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index dca3ecf92d1..93d7de6a0aa 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -107,9 +107,7 @@ func (e executor) DispatchRequest(ctx context.Context, rc *graphql.RequestContex return nil } - for _, err := range graphql.GetErrors(ctx) { - resp.Errors = append(resp.Errors, err) - } + resp.Errors = append(resp.Errors, graphql.GetErrors(ctx)...) return resp } }) diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index 749a5e34159..4b01afb2c91 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -10,10 +10,7 @@ import ( "github.com/mitchellh/mapstructure" ) -const ( - errPersistedQueryNotSupported = "PersistedQueryNotSupported" - errPersistedQueryNotFound = "PersistedQueryNotFound" -) +const errPersistedQueryNotFound = "PersistedQueryNotFound" // AutomaticPersistedQuery saves client upload by optimistically sending only the hashes of queries, if the server // does not yet know what the query is for the hash it will respond telling the client to send the query along with the @@ -34,11 +31,11 @@ func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *g } if err := mapstructure.Decode(rawParams.Extensions["persistedQuery"], &extension); err != nil { - return errors.New("Invalid APQ extension data") + return errors.New("invalid APQ extension data") } if extension.Version != 1 { - return errors.New("Unsupported APQ version") + return errors.New("unsupported APQ version") } if rawParams.Query == "" { @@ -51,7 +48,7 @@ func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *g } else { // client sent optimistic query hash with query string, verify and store it if computeQueryHash(rawParams.Query) != extension.Sha256 { - return errors.New("Provided APQ hash does not match query") + return errors.New("provided APQ hash does not match query") } a.Cache.Add(extension.Sha256, rawParams.Query) } diff --git a/graphql/handler/extension/apq_test.go b/graphql/handler/extension/apq_test.go index c3e4f32aaea..0add620e889 100644 --- a/graphql/handler/extension/apq_test.go +++ b/graphql/handler/extension/apq_test.go @@ -98,7 +98,7 @@ func TestAPQ(t *testing.T) { } err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "Invalid APQ extension data") + require.EqualError(t, err, "invalid APQ extension data") }) t.Run("with invalid extension version", func(t *testing.T) { @@ -110,7 +110,7 @@ func TestAPQ(t *testing.T) { }, } err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "Unsupported APQ version") + require.EqualError(t, err, "unsupported APQ version") }) t.Run("with hash mismatch", func(t *testing.T) { @@ -125,6 +125,6 @@ func TestAPQ(t *testing.T) { } err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "Provided APQ hash does not match query") + require.EqualError(t, err, "provided APQ hash does not match query") }) } diff --git a/graphql/handler/extension/introspection_test.go b/graphql/handler/extension/introspection_test.go index 2c9f71b76be..7e4a958b95b 100644 --- a/graphql/handler/extension/introspection_test.go +++ b/graphql/handler/extension/introspection_test.go @@ -12,6 +12,6 @@ func TestIntrospection(t *testing.T) { rc := &graphql.RequestContext{ DisableIntrospection: true, } - Introspection{}.MutateRequestContext(context.Background(), rc) + require.Nil(t, Introspection{}.MutateRequestContext(context.Background(), rc)) require.Equal(t, false, rc.DisableIntrospection) } diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index e21e86d083b..e061328570e 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -16,7 +16,7 @@ type GET struct{} var _ graphql.Transport = GET{} -func (H GET) Supports(r *http.Request) bool { +func (h GET) Supports(r *http.Request) bool { if r.Header.Get("Upgrade") != "" { return false } @@ -24,7 +24,7 @@ func (H GET) Supports(r *http.Request) bool { return r.Method == "GET" } -func (H GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { +func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { raw := &graphql.RawParams{ Query: r.URL.Query().Get("query"), OperationName: r.URL.Query().Get("operationName"), diff --git a/graphql/handler/transport/http_post.go b/graphql/handler/transport/http_post.go index f8d955447f8..c32d6700793 100644 --- a/graphql/handler/transport/http_post.go +++ b/graphql/handler/transport/http_post.go @@ -14,7 +14,7 @@ type POST struct{} var _ graphql.Transport = POST{} -func (H POST) Supports(r *http.Request) bool { +func (h POST) Supports(r *http.Request) bool { if r.Header.Get("Upgrade") != "" { return false } @@ -27,7 +27,7 @@ func (H POST) Supports(r *http.Request) bool { return r.Method == "POST" && mediaType == "application/json" } -func (H POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { +func (h POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { w.Header().Set("Content-Type", "application/json") write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { diff --git a/graphql/tracer.go b/graphql/tracer.go deleted file mode 100644 index 441ac0d4677..00000000000 --- a/graphql/tracer.go +++ /dev/null @@ -1,119 +0,0 @@ -package graphql - -import ( - "context" -) - -var _ Tracer = (*NopTracer)(nil) - -type Tracer interface { - StartOperationParsing(ctx context.Context) context.Context - EndOperationParsing(ctx context.Context) - StartOperationValidation(ctx context.Context) context.Context - EndOperationValidation(ctx context.Context) - StartOperationExecution(ctx context.Context) context.Context - StartFieldExecution(ctx context.Context, field CollectedField) context.Context - StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context - StartFieldChildExecution(ctx context.Context) context.Context - EndFieldExecution(ctx context.Context) - EndOperationExecution(ctx context.Context) -} - -type NopTracer struct{} - -func (NopTracer) StartOperationParsing(ctx context.Context) context.Context { - return ctx -} - -func (NopTracer) EndOperationParsing(ctx context.Context) { -} - -func (NopTracer) StartOperationValidation(ctx context.Context) context.Context { - return ctx -} - -func (NopTracer) EndOperationValidation(ctx context.Context) { -} - -func (NopTracer) StartOperationExecution(ctx context.Context) context.Context { - return ctx -} - -func (NopTracer) StartFieldExecution(ctx context.Context, field CollectedField) context.Context { - return ctx -} - -func (NopTracer) StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context { - return ctx -} - -func (NopTracer) StartFieldChildExecution(ctx context.Context) context.Context { - return ctx -} - -func (NopTracer) EndFieldExecution(ctx context.Context) { -} - -func (NopTracer) EndOperationExecution(ctx context.Context) { -} - -type tracerWrapper struct { - tracer1 Tracer - tracer2 Tracer -} - -func (tw *tracerWrapper) StartOperationParsing(ctx context.Context) context.Context { - ctx = tw.tracer1.StartOperationParsing(ctx) - ctx = tw.tracer2.StartOperationParsing(ctx) - return ctx -} - -func (tw *tracerWrapper) EndOperationParsing(ctx context.Context) { - tw.tracer2.EndOperationParsing(ctx) - tw.tracer1.EndOperationParsing(ctx) -} - -func (tw *tracerWrapper) StartOperationValidation(ctx context.Context) context.Context { - ctx = tw.tracer1.StartOperationValidation(ctx) - ctx = tw.tracer2.StartOperationValidation(ctx) - return ctx -} - -func (tw *tracerWrapper) EndOperationValidation(ctx context.Context) { - tw.tracer2.EndOperationValidation(ctx) - tw.tracer1.EndOperationValidation(ctx) -} - -func (tw *tracerWrapper) StartOperationExecution(ctx context.Context) context.Context { - ctx = tw.tracer1.StartOperationExecution(ctx) - ctx = tw.tracer2.StartOperationExecution(ctx) - return ctx -} - -func (tw *tracerWrapper) StartFieldExecution(ctx context.Context, field CollectedField) context.Context { - ctx = tw.tracer1.StartFieldExecution(ctx, field) - ctx = tw.tracer2.StartFieldExecution(ctx, field) - return ctx -} - -func (tw *tracerWrapper) StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context { - ctx = tw.tracer1.StartFieldResolverExecution(ctx, rc) - ctx = tw.tracer2.StartFieldResolverExecution(ctx, rc) - return ctx -} - -func (tw *tracerWrapper) StartFieldChildExecution(ctx context.Context) context.Context { - ctx = tw.tracer1.StartFieldChildExecution(ctx) - ctx = tw.tracer2.StartFieldChildExecution(ctx) - return ctx -} - -func (tw *tracerWrapper) EndFieldExecution(ctx context.Context) { - tw.tracer2.EndFieldExecution(ctx) - tw.tracer1.EndFieldExecution(ctx) -} - -func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) { - tw.tracer2.EndOperationExecution(ctx) - tw.tracer1.EndOperationExecution(ctx) -} diff --git a/handler/handler.go b/handler/handler.go index 13720835f8a..3390727eb24 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -208,10 +208,10 @@ type apqAdapter struct { } func (a apqAdapter) Get(key string) (value interface{}, ok bool) { - return a.Get(key) + return a.PersistedQueryCache.Get(context.Background(), key) } func (a apqAdapter) Add(key string, value interface{}) { - a.Add(key, value) + a.PersistedQueryCache.Add(context.Background(), key, value.(string)) } type PersistedQueryCache interface { From 1b57bc3eda296ffe15788626c628c6b0a092ced9 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2019 16:26:20 +1100 Subject: [PATCH 29/53] Rename RequestContext to OperationContext --- codegen/generated!.gotpl | 4 +- codegen/object.gotpl | 4 +- codegen/testserver/generated.go | 94 +++++++++---------- codegen/testserver/introspection_test.go | 2 +- docs/content/reference/introspection.md | 2 +- example/chat/generated.go | 26 ++--- example/config/generated.go | 24 ++--- example/dataloader/generated.go | 26 ++--- example/fileupload/generated.go | 22 ++--- example/scalars/generated.go | 22 ++--- example/selection/generated.go | 22 ++--- example/selection/selection.go | 2 +- example/starwars/generated/exec.go | 34 +++---- example/todo/generated.go | 22 ++--- example/type-system-extension/generated.go | 22 ++--- ...ontext_request.go => context_operation.go} | 28 ++++-- ...uest_test.go => context_operation_test.go} | 8 +- graphql/context_resolver_test.go | 4 +- graphql/executable_schema.go | 4 +- graphql/handler.go | 16 ++-- graphql/handler/apollotracing/tracer.go | 4 +- graphql/handler/executor.go | 36 +++---- graphql/handler/extension/complexity.go | 6 +- graphql/handler/extension/complexity_test.go | 2 +- graphql/handler/extension/introspection.go | 4 +- .../handler/extension/introspection_test.go | 4 +- graphql/handler/server.go | 4 +- graphql/handler/testserver/testserver.go | 4 +- graphql/handler/transport/http_form.go | 4 +- graphql/handler/transport/http_form_test.go | 10 +- graphql/handler/transport/http_get.go | 4 +- graphql/handler/transport/http_post.go | 4 +- graphql/handler/transport/websocket.go | 6 +- graphql/recovery.go | 4 +- handler/handler.go | 6 +- integration/generated.go | 24 ++--- 36 files changed, 261 insertions(+), 253 deletions(-) rename graphql/{context_request.go => context_operation.go} (67%) rename graphql/{context_request_test.go => context_operation_test.go} (84%) diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 59bf9173ca4..e173bfe3c47 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -113,7 +113,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -188,7 +188,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } diff --git a/codegen/object.gotpl b/codegen/object.gotpl index 98a75740e66..84a335989a7 100644 --- a/codegen/object.gotpl +++ b/codegen/object.gotpl @@ -4,7 +4,7 @@ var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}} {{- if .Stream }} func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, {{$object.Name|lcFirst}}Implementors) + fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: {{$object.Name|quote}}, }) @@ -24,7 +24,7 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec } {{- else }} func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, {{$object.Name|lcFirst}}Implementors) + fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) {{if $object.Root}} ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: {{$object.Name|quote}}, diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index c0a26eda2de..6047b50a0cf 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1374,7 +1374,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -1417,7 +1417,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -8290,7 +8290,7 @@ func (ec *executionContext) _TestUnion(ctx context.Context, sel ast.SelectionSet var aImplementors = []string{"A", "TestUnion"} func (ec *executionContext) _A(ctx context.Context, sel ast.SelectionSet, obj *A) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, aImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, aImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8317,7 +8317,7 @@ func (ec *executionContext) _A(ctx context.Context, sel ast.SelectionSet, obj *A var aItImplementors = []string{"AIt"} func (ec *executionContext) _AIt(ctx context.Context, sel ast.SelectionSet, obj *AIt) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, aItImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, aItImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8344,7 +8344,7 @@ func (ec *executionContext) _AIt(ctx context.Context, sel ast.SelectionSet, obj var abItImplementors = []string{"AbIt"} func (ec *executionContext) _AbIt(ctx context.Context, sel ast.SelectionSet, obj *AbIt) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, abItImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, abItImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8371,7 +8371,7 @@ func (ec *executionContext) _AbIt(ctx context.Context, sel ast.SelectionSet, obj var autobindImplementors = []string{"Autobind"} func (ec *executionContext) _Autobind(ctx context.Context, sel ast.SelectionSet, obj *Autobind) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, autobindImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, autobindImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8418,7 +8418,7 @@ func (ec *executionContext) _Autobind(ctx context.Context, sel ast.SelectionSet, var bImplementors = []string{"B", "TestUnion"} func (ec *executionContext) _B(ctx context.Context, sel ast.SelectionSet, obj *B) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, bImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, bImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8445,7 +8445,7 @@ func (ec *executionContext) _B(ctx context.Context, sel ast.SelectionSet, obj *B var circleImplementors = []string{"Circle", "Shape", "ShapeUnion"} func (ec *executionContext) _Circle(ctx context.Context, sel ast.SelectionSet, obj *Circle) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, circleImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, circleImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8471,7 +8471,7 @@ func (ec *executionContext) _Circle(ctx context.Context, sel ast.SelectionSet, o var content_PostImplementors = []string{"Content_Post", "Content_Child"} func (ec *executionContext) _Content_Post(ctx context.Context, sel ast.SelectionSet, obj *ContentPost) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, content_PostImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, content_PostImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8495,7 +8495,7 @@ func (ec *executionContext) _Content_Post(ctx context.Context, sel ast.Selection var content_UserImplementors = []string{"Content_User", "Content_Child"} func (ec *executionContext) _Content_User(ctx context.Context, sel ast.SelectionSet, obj *ContentUser) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, content_UserImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, content_UserImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8519,7 +8519,7 @@ func (ec *executionContext) _Content_User(ctx context.Context, sel ast.Selection var embeddedDefaultScalarImplementors = []string{"EmbeddedDefaultScalar"} func (ec *executionContext) _EmbeddedDefaultScalar(ctx context.Context, sel ast.SelectionSet, obj *EmbeddedDefaultScalar) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, embeddedDefaultScalarImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, embeddedDefaultScalarImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8543,7 +8543,7 @@ func (ec *executionContext) _EmbeddedDefaultScalar(ctx context.Context, sel ast. var embeddedPointerImplementors = []string{"EmbeddedPointer"} func (ec *executionContext) _EmbeddedPointer(ctx context.Context, sel ast.SelectionSet, obj *EmbeddedPointerModel) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, embeddedPointerImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, embeddedPointerImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8569,7 +8569,7 @@ func (ec *executionContext) _EmbeddedPointer(ctx context.Context, sel ast.Select var errorImplementors = []string{"Error"} func (ec *executionContext) _Error(ctx context.Context, sel ast.SelectionSet, obj *Error) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, errorImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, errorImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8608,7 +8608,7 @@ func (ec *executionContext) _Error(ctx context.Context, sel ast.SelectionSet, ob var errorsImplementors = []string{"Errors"} func (ec *executionContext) _Errors(ctx context.Context, sel ast.SelectionSet, obj *Errors) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, errorsImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, errorsImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8700,7 +8700,7 @@ func (ec *executionContext) _Errors(ctx context.Context, sel ast.SelectionSet, o var forcedResolverImplementors = []string{"ForcedResolver"} func (ec *executionContext) _ForcedResolver(ctx context.Context, sel ast.SelectionSet, obj *ForcedResolver) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, forcedResolverImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, forcedResolverImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8733,7 +8733,7 @@ func (ec *executionContext) _ForcedResolver(ctx context.Context, sel ast.Selecti var innerObjectImplementors = []string{"InnerObject"} func (ec *executionContext) _InnerObject(ctx context.Context, sel ast.SelectionSet, obj *InnerObject) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, innerObjectImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, innerObjectImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8760,7 +8760,7 @@ func (ec *executionContext) _InnerObject(ctx context.Context, sel ast.SelectionS var invalidIdentifierImplementors = []string{"InvalidIdentifier"} func (ec *executionContext) _InvalidIdentifier(ctx context.Context, sel ast.SelectionSet, obj *invalid_packagename.InvalidIdentifier) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, invalidIdentifierImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, invalidIdentifierImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8787,7 +8787,7 @@ func (ec *executionContext) _InvalidIdentifier(ctx context.Context, sel ast.Sele var itImplementors = []string{"It"} func (ec *executionContext) _It(ctx context.Context, sel ast.SelectionSet, obj *introspection1.It) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, itImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, itImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8814,7 +8814,7 @@ func (ec *executionContext) _It(ctx context.Context, sel ast.SelectionSet, obj * var loopAImplementors = []string{"LoopA"} func (ec *executionContext) _LoopA(ctx context.Context, sel ast.SelectionSet, obj *LoopA) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, loopAImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, loopAImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8841,7 +8841,7 @@ func (ec *executionContext) _LoopA(ctx context.Context, sel ast.SelectionSet, ob var loopBImplementors = []string{"LoopB"} func (ec *executionContext) _LoopB(ctx context.Context, sel ast.SelectionSet, obj *LoopB) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, loopBImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, loopBImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8868,7 +8868,7 @@ func (ec *executionContext) _LoopB(ctx context.Context, sel ast.SelectionSet, ob var mapImplementors = []string{"Map"} func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj *Map) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, mapImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, mapImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8895,7 +8895,7 @@ func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj var mapStringInterfaceTypeImplementors = []string{"MapStringInterfaceType"} func (ec *executionContext) _MapStringInterfaceType(ctx context.Context, sel ast.SelectionSet, obj map[string]interface{}) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, mapStringInterfaceTypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, mapStringInterfaceTypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8921,7 +8921,7 @@ func (ec *executionContext) _MapStringInterfaceType(ctx context.Context, sel ast var modelMethodsImplementors = []string{"ModelMethods"} func (ec *executionContext) _ModelMethods(ctx context.Context, sel ast.SelectionSet, obj *ModelMethods) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, modelMethodsImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, modelMethodsImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -8976,7 +8976,7 @@ func (ec *executionContext) _ModelMethods(ctx context.Context, sel ast.Selection var objectDirectivesImplementors = []string{"ObjectDirectives"} func (ec *executionContext) _ObjectDirectives(ctx context.Context, sel ast.SelectionSet, obj *ObjectDirectives) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, objectDirectivesImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, objectDirectivesImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9005,7 +9005,7 @@ func (ec *executionContext) _ObjectDirectives(ctx context.Context, sel ast.Selec var objectDirectivesWithCustomGoModelImplementors = []string{"ObjectDirectivesWithCustomGoModel"} func (ec *executionContext) _ObjectDirectivesWithCustomGoModel(ctx context.Context, sel ast.SelectionSet, obj *ObjectDirectivesWithCustomGoModel) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, objectDirectivesWithCustomGoModelImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, objectDirectivesWithCustomGoModelImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9029,7 +9029,7 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel(ctx context.Conte var outerObjectImplementors = []string{"OuterObject"} func (ec *executionContext) _OuterObject(ctx context.Context, sel ast.SelectionSet, obj *OuterObject) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, outerObjectImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, outerObjectImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9056,7 +9056,7 @@ func (ec *executionContext) _OuterObject(ctx context.Context, sel ast.SelectionS var overlappingFieldsImplementors = []string{"OverlappingFields"} func (ec *executionContext) _OverlappingFields(ctx context.Context, sel ast.SelectionSet, obj *OverlappingFields) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, overlappingFieldsImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, overlappingFieldsImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9112,7 +9112,7 @@ func (ec *executionContext) _OverlappingFields(ctx context.Context, sel ast.Sele var panicsImplementors = []string{"Panics"} func (ec *executionContext) _Panics(ctx context.Context, sel ast.SelectionSet, obj *Panics) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, panicsImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, panicsImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9176,7 +9176,7 @@ func (ec *executionContext) _Panics(ctx context.Context, sel ast.SelectionSet, o var primitiveImplementors = []string{"Primitive"} func (ec *executionContext) _Primitive(ctx context.Context, sel ast.SelectionSet, obj *Primitive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, primitiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, primitiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9217,7 +9217,7 @@ func (ec *executionContext) _Primitive(ctx context.Context, sel ast.SelectionSet var primitiveStringImplementors = []string{"PrimitiveString"} func (ec *executionContext) _PrimitiveString(ctx context.Context, sel ast.SelectionSet, obj *PrimitiveString) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, primitiveStringImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, primitiveStringImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9272,7 +9272,7 @@ func (ec *executionContext) _PrimitiveString(ctx context.Context, sel ast.Select var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -9814,7 +9814,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var rectangleImplementors = []string{"Rectangle", "Shape", "ShapeUnion"} func (ec *executionContext) _Rectangle(ctx context.Context, sel ast.SelectionSet, obj *Rectangle) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, rectangleImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, rectangleImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9842,7 +9842,7 @@ func (ec *executionContext) _Rectangle(ctx context.Context, sel ast.SelectionSet var slicesImplementors = []string{"Slices"} func (ec *executionContext) _Slices(ctx context.Context, sel ast.SelectionSet, obj *Slices) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, slicesImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, slicesImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9878,7 +9878,7 @@ func (ec *executionContext) _Slices(ctx context.Context, sel ast.SelectionSet, o var subscriptionImplementors = []string{"Subscription"} func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, subscriptionImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Subscription", }) @@ -9908,7 +9908,7 @@ func (ec *executionContext) _Subscription(ctx context.Context, sel ast.Selection var userImplementors = []string{"User"} func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *User) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, userImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9956,7 +9956,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj var validTypeImplementors = []string{"ValidType"} func (ec *executionContext) _ValidType(ctx context.Context, sel ast.SelectionSet, obj *ValidType) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, validTypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, validTypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -9998,7 +9998,7 @@ func (ec *executionContext) _ValidType(ctx context.Context, sel ast.SelectionSet var wrappedStructImplementors = []string{"WrappedStruct"} func (ec *executionContext) _WrappedStruct(ctx context.Context, sel ast.SelectionSet, obj *WrappedStruct) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, wrappedStructImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, wrappedStructImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10025,7 +10025,7 @@ func (ec *executionContext) _WrappedStruct(ctx context.Context, sel ast.Selectio var xXItImplementors = []string{"XXIt"} func (ec *executionContext) _XXIt(ctx context.Context, sel ast.SelectionSet, obj *XXIt) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, xXItImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, xXItImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10052,7 +10052,7 @@ func (ec *executionContext) _XXIt(ctx context.Context, sel ast.SelectionSet, obj var xxItImplementors = []string{"XxIt"} func (ec *executionContext) _XxIt(ctx context.Context, sel ast.SelectionSet, obj *XxIt) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, xxItImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, xxItImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10079,7 +10079,7 @@ func (ec *executionContext) _XxIt(ctx context.Context, sel ast.SelectionSet, obj var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10118,7 +10118,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10154,7 +10154,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10200,7 +10200,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10236,7 +10236,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10277,7 +10277,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10320,7 +10320,7 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o var asdfItImplementors = []string{"asdfIt"} func (ec *executionContext) _asdfIt(ctx context.Context, sel ast.SelectionSet, obj *AsdfIt) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, asdfItImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, asdfItImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -10347,7 +10347,7 @@ func (ec *executionContext) _asdfIt(ctx context.Context, sel ast.SelectionSet, o var iItImplementors = []string{"iIt"} func (ec *executionContext) _iIt(ctx context.Context, sel ast.SelectionSet, obj *IIt) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, iItImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, iItImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/codegen/testserver/introspection_test.go b/codegen/testserver/introspection_test.go index c33ea6e5bdd..75ce38e9b66 100644 --- a/codegen/testserver/introspection_test.go +++ b/codegen/testserver/introspection_test.go @@ -68,7 +68,7 @@ func TestIntrospection(t *testing.T) { c := client.New(handler.GraphQL( NewExecutableSchema(Config{Resolvers: resolvers}), handler.RequestMiddleware(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { - graphql.GetRequestContext(ctx).DisableIntrospection = true + graphql.GetOperationContext(ctx).DisableIntrospection = true return next(ctx) }), diff --git a/docs/content/reference/introspection.md b/docs/content/reference/introspection.md index b2460106786..f9c8cc9d2b8 100644 --- a/docs/content/reference/introspection.md +++ b/docs/content/reference/introspection.md @@ -30,7 +30,7 @@ srv := httptest.NewServer( NewExecutableSchema(Config{Resolvers: resolvers}), handler.RequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte { if !userForContext(ctx).IsAdmin { - graphql.GetRequestContext(ctx).DisableIntrospection = true + graphql.GetOperationContext(ctx).DisableIntrospection = true } return next(ctx) diff --git a/example/chat/generated.go b/example/chat/generated.go index 01ff89513f1..054f0d957a5 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -178,7 +178,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -237,7 +237,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1918,7 +1918,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co var chatroomImplementors = []string{"Chatroom"} func (ec *executionContext) _Chatroom(ctx context.Context, sel ast.SelectionSet, obj *Chatroom) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, chatroomImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, chatroomImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1950,7 +1950,7 @@ func (ec *executionContext) _Chatroom(ctx context.Context, sel ast.SelectionSet, var messageImplementors = []string{"Message"} func (ec *executionContext) _Message(ctx context.Context, sel ast.SelectionSet, obj *Message) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, messageImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, messageImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1992,7 +1992,7 @@ func (ec *executionContext) _Message(ctx context.Context, sel ast.SelectionSet, var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, mutationImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Mutation", @@ -2023,7 +2023,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -2064,7 +2064,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var subscriptionImplementors = []string{"Subscription"} func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, subscriptionImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Subscription", }) @@ -2084,7 +2084,7 @@ func (ec *executionContext) _Subscription(ctx context.Context, sel ast.Selection var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2123,7 +2123,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2159,7 +2159,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2205,7 +2205,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2241,7 +2241,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2282,7 +2282,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/config/generated.go b/example/config/generated.go index 86084c649d3..6942ac8865f 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -163,7 +163,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -203,7 +203,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1795,7 +1795,7 @@ func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, obj inter var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, mutationImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Mutation", @@ -1826,7 +1826,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -1870,7 +1870,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var todoImplementors = []string{"Todo"} func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj *Todo) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, todoImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, todoImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1926,7 +1926,7 @@ func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj var userImplementors = []string{"User"} func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *User) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, userImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1958,7 +1958,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1997,7 +1997,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2033,7 +2033,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2079,7 +2079,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2115,7 +2115,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2156,7 +2156,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index c755625e488..c8cfb87a7e6 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -223,7 +223,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -249,7 +249,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -2026,7 +2026,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co var addressImplementors = []string{"Address"} func (ec *executionContext) _Address(ctx context.Context, sel ast.SelectionSet, obj *Address) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, addressImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, addressImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2063,7 +2063,7 @@ func (ec *executionContext) _Address(ctx context.Context, sel ast.SelectionSet, var customerImplementors = []string{"Customer"} func (ec *executionContext) _Customer(ctx context.Context, sel ast.SelectionSet, obj *Customer) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, customerImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, customerImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2117,7 +2117,7 @@ func (ec *executionContext) _Customer(ctx context.Context, sel ast.SelectionSet, var itemImplementors = []string{"Item"} func (ec *executionContext) _Item(ctx context.Context, sel ast.SelectionSet, obj *Item) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, itemImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, itemImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2144,7 +2144,7 @@ func (ec *executionContext) _Item(ctx context.Context, sel ast.SelectionSet, obj var orderImplementors = []string{"Order"} func (ec *executionContext) _Order(ctx context.Context, sel ast.SelectionSet, obj *Order) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, orderImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, orderImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2192,7 +2192,7 @@ func (ec *executionContext) _Order(ctx context.Context, sel ast.SelectionSet, ob var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -2255,7 +2255,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2294,7 +2294,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2330,7 +2330,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2376,7 +2376,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2412,7 +2412,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2453,7 +2453,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 31e6645d38b..7deaac07650 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -167,7 +167,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -207,7 +207,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1827,7 +1827,7 @@ func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, obj in var fileImplementors = []string{"File"} func (ec *executionContext) _File(ctx context.Context, sel ast.SelectionSet, obj *model.File) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, fileImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, fileImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1864,7 +1864,7 @@ func (ec *executionContext) _File(ctx context.Context, sel ast.SelectionSet, obj var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, mutationImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Mutation", @@ -1910,7 +1910,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -1954,7 +1954,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1993,7 +1993,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2029,7 +2029,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2075,7 +2075,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2111,7 +2111,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2152,7 +2152,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 0cacd4c2b92..be6f2d7011f 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -190,7 +190,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -216,7 +216,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1928,7 +1928,7 @@ func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, obj in var addressImplementors = []string{"Address"} func (ec *executionContext) _Address(ctx context.Context, sel ast.SelectionSet, obj *model.Address) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, addressImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, addressImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1957,7 +1957,7 @@ func (ec *executionContext) _Address(ctx context.Context, sel ast.SelectionSet, var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -2012,7 +2012,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var userImplementors = []string{"User"} func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *model.User) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, userImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2083,7 +2083,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2122,7 +2122,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2158,7 +2158,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2204,7 +2204,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2240,7 +2240,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2281,7 +2281,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/selection/generated.go b/example/selection/generated.go index 3cf0c0b4553..7699270ad4a 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -148,7 +148,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -174,7 +174,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1717,7 +1717,7 @@ func (ec *executionContext) _Event(ctx context.Context, sel ast.SelectionSet, ob var likeImplementors = []string{"Like", "Event"} func (ec *executionContext) _Like(ctx context.Context, sel ast.SelectionSet, obj *Like) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, likeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, likeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1753,7 +1753,7 @@ func (ec *executionContext) _Like(ctx context.Context, sel ast.SelectionSet, obj var postImplementors = []string{"Post", "Event"} func (ec *executionContext) _Post(ctx context.Context, sel ast.SelectionSet, obj *Post) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, postImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, postImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1789,7 +1789,7 @@ func (ec *executionContext) _Post(ctx context.Context, sel ast.SelectionSet, obj var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -1830,7 +1830,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1869,7 +1869,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1905,7 +1905,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1951,7 +1951,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1987,7 +1987,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2028,7 +2028,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/selection/selection.go b/example/selection/selection.go index c74f13c9de0..ed6e8995e14 100644 --- a/example/selection/selection.go +++ b/example/selection/selection.go @@ -22,7 +22,7 @@ type queryResolver struct{ *Resolver } func (r *queryResolver) Events(ctx context.Context) ([]Event, error) { var sels []string - reqCtx := graphql.GetRequestContext(ctx) + reqCtx := graphql.GetOperationContext(ctx) fieldSelections := graphql.GetResolverContext(ctx).Field.Selections for _, sel := range fieldSelections { switch sel := sel.(type) { diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 807f0dfc351..20913590230 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -491,7 +491,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -531,7 +531,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -3469,7 +3469,7 @@ func (ec *executionContext) _SearchResult(ctx context.Context, sel ast.Selection var droidImplementors = []string{"Droid", "Character", "SearchResult"} func (ec *executionContext) _Droid(ctx context.Context, sel ast.SelectionSet, obj *models.Droid) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, droidImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, droidImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3533,7 +3533,7 @@ func (ec *executionContext) _Droid(ctx context.Context, sel ast.SelectionSet, ob var friendsConnectionImplementors = []string{"FriendsConnection"} func (ec *executionContext) _FriendsConnection(ctx context.Context, sel ast.SelectionSet, obj *models.FriendsConnection) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, friendsConnectionImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, friendsConnectionImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3587,7 +3587,7 @@ func (ec *executionContext) _FriendsConnection(ctx context.Context, sel ast.Sele var friendsEdgeImplementors = []string{"FriendsEdge"} func (ec *executionContext) _FriendsEdge(ctx context.Context, sel ast.SelectionSet, obj *models.FriendsEdge) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, friendsEdgeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, friendsEdgeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3616,7 +3616,7 @@ func (ec *executionContext) _FriendsEdge(ctx context.Context, sel ast.SelectionS var humanImplementors = []string{"Human", "Character", "SearchResult"} func (ec *executionContext) _Human(ctx context.Context, sel ast.SelectionSet, obj *models.Human) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, humanImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, humanImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3696,7 +3696,7 @@ func (ec *executionContext) _Human(ctx context.Context, sel ast.SelectionSet, ob var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, mutationImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Mutation", @@ -3724,7 +3724,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) var pageInfoImplementors = []string{"PageInfo"} func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *models.PageInfo) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, pageInfoImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3761,7 +3761,7 @@ func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -3874,7 +3874,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var reviewImplementors = []string{"Review"} func (ec *executionContext) _Review(ctx context.Context, sel ast.SelectionSet, obj *models.Review) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, reviewImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, reviewImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3905,7 +3905,7 @@ func (ec *executionContext) _Review(ctx context.Context, sel ast.SelectionSet, o var starshipImplementors = []string{"Starship", "SearchResult"} func (ec *executionContext) _Starship(ctx context.Context, sel ast.SelectionSet, obj *models.Starship) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, starshipImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, starshipImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3956,7 +3956,7 @@ func (ec *executionContext) _Starship(ctx context.Context, sel ast.SelectionSet, var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -3995,7 +3995,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -4031,7 +4031,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -4077,7 +4077,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -4113,7 +4113,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -4154,7 +4154,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/todo/generated.go b/example/todo/generated.go index 3ba49625bae..bdcd89b45fa 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -165,7 +165,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -209,7 +209,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1838,7 +1838,7 @@ func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj int var myMutationImplementors = []string{"MyMutation"} func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, myMutationImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, myMutationImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "MyMutation", @@ -1871,7 +1871,7 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe var myQueryImplementors = []string{"MyQuery"} func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, myQueryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, myQueryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "MyQuery", @@ -1937,7 +1937,7 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) var todoImplementors = []string{"Todo"} func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj *Todo) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, todoImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, todoImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1974,7 +1974,7 @@ func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2013,7 +2013,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2049,7 +2049,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2095,7 +2095,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2131,7 +2131,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2172,7 +2172,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index aab12d618d8..25b421ffff5 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -160,7 +160,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -200,7 +200,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -1826,7 +1826,7 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj var myMutationImplementors = []string{"MyMutation"} func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, myMutationImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, myMutationImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "MyMutation", @@ -1857,7 +1857,7 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe var myQueryImplementors = []string{"MyQuery"} func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, myQueryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, myQueryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "MyQuery", @@ -1912,7 +1912,7 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) var todoImplementors = []string{"Todo", "Node", "Data"} func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj *Todo) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, todoImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, todoImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1954,7 +1954,7 @@ func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -1993,7 +1993,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2029,7 +2029,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2075,7 +2075,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2111,7 +2111,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2152,7 +2152,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 diff --git a/graphql/context_request.go b/graphql/context_operation.go similarity index 67% rename from graphql/context_request.go rename to graphql/context_operation.go index 7a1eb1a7022..7d09a8aeb89 100644 --- a/graphql/context_request.go +++ b/graphql/context_operation.go @@ -7,7 +7,10 @@ import ( "github.com/vektah/gqlparser/ast" ) -type RequestContext struct { +// Deprecated: Please update all references to OperationContext instead +type RequestContext = OperationContext + +type OperationContext struct { RawQuery string Variables map[string]interface{} OperationName string @@ -22,9 +25,9 @@ type RequestContext struct { Stats Stats } -const requestCtx key = "request_context" +const operationCtx key = "operation_context" -func (rc *RequestContext) Validate(ctx context.Context) error { +func (rc *OperationContext) Validate(ctx context.Context) error { if rc.Doc == nil { return errors.New("field 'Doc' must be required") } @@ -47,28 +50,33 @@ func (rc *RequestContext) Validate(ctx context.Context) error { return nil } +// Deprecated: Please update all references to GetOperationContext instead func GetRequestContext(ctx context.Context) *RequestContext { - if val, ok := ctx.Value(requestCtx).(*RequestContext); ok { + return GetOperationContext(ctx) +} + +func GetOperationContext(ctx context.Context) *OperationContext { + if val, ok := ctx.Value(operationCtx).(*OperationContext); ok { return val } return nil } -func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context { - return context.WithValue(ctx, requestCtx, rc) +func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context { + return context.WithValue(ctx, operationCtx, rc) } // This is just a convenient wrapper method for CollectFields func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField { resctx := GetResolverContext(ctx) - return CollectFields(GetRequestContext(ctx), resctx.Field.Selections, satisfies) + return CollectFields(GetOperationContext(ctx), resctx.Field.Selections, satisfies) } // CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context. // The slice will contain the unique set of all field names requested regardless of fragment type conditions. func CollectAllFields(ctx context.Context) []string { resctx := GetResolverContext(ctx) - collected := CollectFields(GetRequestContext(ctx), resctx.Field.Selections, nil) + collected := CollectFields(GetOperationContext(ctx), resctx.Field.Selections, nil) uniq := make([]string, 0, len(collected)) Next: for _, f := range collected { @@ -84,12 +92,12 @@ Next: // Errorf sends an error string to the client, passing it through the formatter. // Deprecated: use graphql.AddErrorf(ctx, err) instead -func (c *RequestContext) Errorf(ctx context.Context, format string, args ...interface{}) { +func (c *OperationContext) Errorf(ctx context.Context, format string, args ...interface{}) { AddErrorf(ctx, format, args...) } // Error sends an error to the client, passing it through the formatter. // Deprecated: use graphql.AddError(ctx, err) instead -func (c *RequestContext) Error(ctx context.Context, err error) { +func (c *OperationContext) Error(ctx context.Context, err error) { AddError(ctx, err) } diff --git a/graphql/context_request_test.go b/graphql/context_operation_test.go similarity index 84% rename from graphql/context_request_test.go rename to graphql/context_operation_test.go index be01cc4309f..d590055bbd5 100644 --- a/graphql/context_request_test.go +++ b/graphql/context_operation_test.go @@ -8,11 +8,11 @@ import ( "github.com/vektah/gqlparser/ast" ) -func TestGetRequestContext(t *testing.T) { - require.Nil(t, GetRequestContext(context.Background())) +func TestGetOperationContext(t *testing.T) { + require.Nil(t, GetOperationContext(context.Background())) - rc := &RequestContext{} - require.Equal(t, rc, GetRequestContext(WithRequestContext(context.Background(), rc))) + rc := &OperationContext{} + require.Equal(t, rc, GetOperationContext(WithOperationContext(context.Background(), rc))) } func TestCollectAllFields(t *testing.T) { diff --git a/graphql/context_resolver_test.go b/graphql/context_resolver_test.go index cd83661a8c1..de59bc505d1 100644 --- a/graphql/context_resolver_test.go +++ b/graphql/context_resolver_test.go @@ -19,8 +19,8 @@ func testContext(sel ast.SelectionSet) context.Context { ctx := context.Background() - rqCtx := &RequestContext{} - ctx = WithRequestContext(ctx, rqCtx) + rqCtx := &OperationContext{} + ctx = WithOperationContext(ctx, rqCtx) root := &ResolverContext{ Field: CollectedField{ diff --git a/graphql/executable_schema.go b/graphql/executable_schema.go index c647f575044..7f0df9104ef 100644 --- a/graphql/executable_schema.go +++ b/graphql/executable_schema.go @@ -19,11 +19,11 @@ type ExecutableSchema interface { // CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types // passed through satisfies. Providing an empty or nil slice for satisfies will return collect all fields regardless of fragment // type conditions. -func CollectFields(reqCtx *RequestContext, selSet ast.SelectionSet, satisfies []string) []CollectedField { +func CollectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string) []CollectedField { return collectFields(reqCtx, selSet, satisfies, map[string]bool{}) } -func collectFields(reqCtx *RequestContext, selSet ast.SelectionSet, satisfies []string, visited map[string]bool) []CollectedField { +func collectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string, visited map[string]bool) []CollectedField { groupedFields := make([]CollectedField, 0, len(selSet)) for _, sel := range selSet { diff --git a/graphql/handler.go b/graphql/handler.go index 13caabaac59..0177b001c23 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -30,8 +30,8 @@ type ( } GraphExecutor interface { - CreateRequestContext(ctx context.Context, params *RawParams) (*RequestContext, gqlerror.List) - DispatchRequest(ctx context.Context, rc *RequestContext) (ResponseHandler, context.Context) + CreateOperationContext(ctx context.Context, params *RawParams) (*OperationContext, gqlerror.List) + DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context) } // HandlerExtension interface is entirely optional, see the list of possible hook points below @@ -48,15 +48,15 @@ type ( // +------------------------------------------------------------------------+ HandlerExtension interface{} - // RequestParameterMutator is called before creating a request context. allows manipulating the raw query + // OperationParameterMutator is called before creating a request context. allows manipulating the raw query // on the way in. - RequestParameterMutator interface { - MutateRequestParameters(ctx context.Context, request *RawParams) *gqlerror.Error + OperationParameterMutator interface { + MutateOperationParameters(ctx context.Context, request *RawParams) *gqlerror.Error } - // RequestContextMutator is called after creating the request context, but before executing the root resolver. - RequestContextMutator interface { - MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error + // OperationContextMutator is called after creating the request context, but before executing the root resolver. + OperationContextMutator interface { + MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error } // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once, diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 27e424fff76..9ac9ad16031 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -47,7 +47,7 @@ func New() graphql.HandlerExtension { } func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) td, ok := graphql.GetExtension(ctx, "tracing").(*TracingExtension) if !ok { panic("missing tracing extension") @@ -76,7 +76,7 @@ func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver } func (a ApolloTracing) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) start := rc.Stats.OperationStart diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 93d7de6a0aa..ffcc913d5bf 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -11,12 +11,12 @@ import ( ) type executor struct { - operationMiddleware graphql.OperationMiddleware - responseMiddleware graphql.ResponseMiddleware - fieldMiddleware graphql.FieldMiddleware - requestParamMutators []graphql.RequestParameterMutator - requestContextMutators []graphql.RequestContextMutator - server *Server + operationMiddleware graphql.OperationMiddleware + responseMiddleware graphql.ResponseMiddleware + fieldMiddleware graphql.FieldMiddleware + operationParameterMutators []graphql.OperationParameterMutator + operationContextMutators []graphql.OperationContextMutator + server *Server } var _ graphql.GraphExecutor = executor{} @@ -67,12 +67,12 @@ func newExecutor(s *Server) executor { } for _, p := range s.extensions { - if p, ok := p.(graphql.RequestParameterMutator); ok { - e.requestParamMutators = append(e.requestParamMutators, p) + if p, ok := p.(graphql.OperationParameterMutator); ok { + e.operationParameterMutators = append(e.operationParameterMutators, p) } - if p, ok := p.(graphql.RequestContextMutator); ok { - e.requestContextMutators = append(e.requestContextMutators, p) + if p, ok := p.(graphql.OperationContextMutator); ok { + e.operationContextMutators = append(e.operationContextMutators, p) } } @@ -80,8 +80,8 @@ func newExecutor(s *Server) executor { return e } -func (e executor) DispatchRequest(ctx context.Context, rc *graphql.RequestContext) (h graphql.ResponseHandler, resctx context.Context) { - ctx = graphql.WithRequestContext(ctx, rc) +func (e executor) DispatchOperation(ctx context.Context, rc *graphql.OperationContext) (h graphql.ResponseHandler, resctx context.Context) { + ctx = graphql.WithOperationContext(ctx, rc) var innerCtx context.Context res := e.operationMiddleware(ctx, func(ctx context.Context) graphql.ResponseHandler { @@ -115,14 +115,14 @@ func (e executor) DispatchRequest(ctx context.Context, rc *graphql.RequestContex return res, innerCtx } -func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawParams) (*graphql.RequestContext, gqlerror.List) { +func (e executor) CreateOperationContext(ctx context.Context, params *graphql.RawParams) (*graphql.OperationContext, gqlerror.List) { ctx = graphql.WithServerContext(ctx, e.server.es) stats := graphql.Stats{ OperationStart: graphql.GetStartTime(ctx), } - for _, p := range e.requestParamMutators { - if err := p.MutateRequestParameters(ctx, params); err != nil { + for _, p := range e.operationParameterMutators { + if err := p.MutateOperationParameters(ctx, params); err != nil { return nil, gqlerror.List{err} } } @@ -143,7 +143,7 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP } stats.Validation.End = graphql.Now() - rc := &graphql.RequestContext{ + rc := &graphql.OperationContext{ RawQuery: params.Query, Variables: vars, OperationName: params.OperationName, @@ -156,8 +156,8 @@ func (e executor) CreateRequestContext(ctx context.Context, params *graphql.RawP Stats: stats, } - for _, p := range e.requestContextMutators { - if err := p.MutateRequestContext(ctx, rc); err != nil { + for _, p := range e.operationContextMutators { + if err := p.MutateOperationContext(ctx, rc); err != nil { return nil, gqlerror.List{err} } } diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index 23a975eb889..da2b15e851e 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -11,11 +11,11 @@ import ( // ComplexityLimit allows you to define a limit on query complexity // // If a query is submitted that exceeds the limit, a 422 status code will be returned. -type ComplexityLimit func(ctx context.Context, rc *graphql.RequestContext) int +type ComplexityLimit func(ctx context.Context, rc *graphql.OperationContext) int -var _ graphql.RequestContextMutator = ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { return 0 }) +var _ graphql.OperationContextMutator = ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { return 0 }) -func (c ComplexityLimit) MutateRequestContext(ctx context.Context, rc *graphql.RequestContext) *gqlerror.Error { +func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { es := graphql.GetServerContext(ctx) op := rc.Doc.Operations.ForName(rc.OperationName) complexity := complexity.Calculate(es, op, rc.Variables) diff --git a/graphql/handler/extension/complexity_test.go b/graphql/handler/extension/complexity_test.go index afadf71f5e2..90465f4f81a 100644 --- a/graphql/handler/extension/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -15,7 +15,7 @@ import ( func TestHandlerComplexity(t *testing.T) { h := testserver.New() - h.Use(ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { + h.Use(ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { if rc.RawQuery == "{ ok: name }" { return 4 } diff --git a/graphql/handler/extension/introspection.go b/graphql/handler/extension/introspection.go index c8376bce1d7..1af70418e17 100644 --- a/graphql/handler/extension/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -10,9 +10,9 @@ import ( // EnableIntrospection enables clients to reflect all of the types available on the graph. type Introspection struct{} -var _ graphql.RequestContextMutator = Introspection{} +var _ graphql.OperationContextMutator = Introspection{} -func (c Introspection) MutateRequestContext(ctx context.Context, rc *graphql.RequestContext) *gqlerror.Error { +func (c Introspection) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { rc.DisableIntrospection = false return nil } diff --git a/graphql/handler/extension/introspection_test.go b/graphql/handler/extension/introspection_test.go index 7e4a958b95b..e001eb529f0 100644 --- a/graphql/handler/extension/introspection_test.go +++ b/graphql/handler/extension/introspection_test.go @@ -9,9 +9,9 @@ import ( ) func TestIntrospection(t *testing.T) { - rc := &graphql.RequestContext{ + rc := &graphql.OperationContext{ DisableIntrospection: true, } - require.Nil(t, Introspection{}.MutateRequestContext(context.Background(), rc)) + require.Nil(t, Introspection{}.MutateOperationContext(context.Background(), rc)) require.Equal(t, false, rc.DisableIntrospection) } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 7c6517e605d..9ef6e234d84 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -52,8 +52,8 @@ func (s *Server) SetQueryCache(cache graphql.Cache) { func (s *Server) Use(extension graphql.HandlerExtension) { switch extension.(type) { - case graphql.RequestParameterMutator, - graphql.RequestContextMutator, + case graphql.OperationParameterMutator, + graphql.OperationContextMutator, graphql.OperationInterceptor, graphql.FieldInterceptor, graphql.ResponseInterceptor: diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index c31b193ef32..8f7ebaf0997 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -43,7 +43,7 @@ func New() *TestServer { srv.Server = handler.New(&graphql.ExecutableSchemaMock{ ExecFunc: func(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) switch rc.Operation.Operation { case ast.Query: ran := false @@ -63,7 +63,7 @@ func New() *TestServer { }, }, }) - res, err := graphql.GetRequestContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { + res, err := graphql.GetOperationContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil }) if err != nil { diff --git a/graphql/handler/transport/http_form.go b/graphql/handler/transport/http_form.go index bf9a7b59eda..6d7a5acd531 100644 --- a/graphql/handler/transport/http_form.go +++ b/graphql/handler/transport/http_form.go @@ -188,12 +188,12 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G } } - rc, gerr := exec.CreateRequestContext(r.Context(), ¶ms) + rc, gerr := exec.CreateOperationContext(r.Context(), ¶ms) if gerr != nil { w.WriteHeader(http.StatusUnprocessableEntity) write.GraphqlErr(gerr...) return } - responses, ctx := exec.DispatchRequest(r.Context(), rc) + responses, ctx := exec.DispatchOperation(r.Context(), rc) write(graphql.StatusResolverError, responses(ctx)) } diff --git a/graphql/handler/transport/http_form_test.go b/graphql/handler/transport/http_form_test.go index 5533a8fdb32..0df529d4662 100644 --- a/graphql/handler/transport/http_form_test.go +++ b/graphql/handler/transport/http_form_test.go @@ -42,7 +42,7 @@ func TestFileUpload(t *testing.T) { t.Run("valid single file upload", func(t *testing.T) { es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { - op := graphql.GetRequestContext(ctx).Operation + op := graphql.GetOperationContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "file") return graphql.OneShot(&graphql.Response{Data: []byte(`{"singleUpload":"test"}`)}) @@ -67,7 +67,7 @@ func TestFileUpload(t *testing.T) { t.Run("valid single file upload with payload", func(t *testing.T) { es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { - op := graphql.GetRequestContext(ctx).Operation + op := graphql.GetOperationContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "req") return graphql.OneShot(&graphql.Response{Data: []byte(`{"singleUploadWithPayload":"test"}`)}) @@ -92,7 +92,7 @@ func TestFileUpload(t *testing.T) { t.Run("valid file list upload", func(t *testing.T) { es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { - op := graphql.GetRequestContext(ctx).Operation + op := graphql.GetOperationContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "files") return graphql.OneShot(&graphql.Response{Data: []byte(`{"multipleUpload":[{"id":1},{"id":2}]}`)}) @@ -122,7 +122,7 @@ func TestFileUpload(t *testing.T) { t.Run("valid file list upload with payload", func(t *testing.T) { es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { - op := graphql.GetRequestContext(ctx).Operation + op := graphql.GetOperationContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "req") return graphql.OneShot(&graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)}) @@ -153,7 +153,7 @@ func TestFileUpload(t *testing.T) { t.Run("valid file list upload with payload and file reuse", func(t *testing.T) { test := func(uploadMaxMemory int64) { es.ExecFunc = func(ctx context.Context) graphql.ResponseHandler { - op := graphql.GetRequestContext(ctx).Operation + op := graphql.GetOperationContext(ctx).Operation require.Equal(t, len(op.VariableDefinitions), 1) require.Equal(t, op.VariableDefinitions[0].Variable, "req") return graphql.OneShot(&graphql.Response{Data: []byte(`{"multipleUploadWithPayload":[{"id":1},{"id":2}]}`)}) diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index e061328570e..1ba9757a21f 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -60,7 +60,7 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut } } - rc, err := exec.CreateRequestContext(r.Context(), raw) + rc, err := exec.CreateOperationContext(r.Context(), raw) if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) write.GraphqlErr(err...) @@ -73,7 +73,7 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut return } - responses, ctx := exec.DispatchRequest(r.Context(), rc) + responses, ctx := exec.DispatchOperation(r.Context(), rc) write(graphql.StatusResolverError, responses(ctx)) } diff --git a/graphql/handler/transport/http_post.go b/graphql/handler/transport/http_post.go index c32d6700793..020b540f3ca 100644 --- a/graphql/handler/transport/http_post.go +++ b/graphql/handler/transport/http_post.go @@ -52,12 +52,12 @@ func (h POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecu return } - rc, err := exec.CreateRequestContext(r.Context(), params) + rc, err := exec.CreateOperationContext(r.Context(), params) if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) write.GraphqlErr(err...) return } - responses, ctx := exec.DispatchRequest(r.Context(), rc) + responses, ctx := exec.DispatchOperation(r.Context(), rc) write(graphql.StatusResolverError, responses(ctx)) } diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 4a7764f86d6..49e4ffe1db2 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -198,13 +198,13 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { return false } - rc, err := c.exec.CreateRequestContext(ctx, params) + rc, err := c.exec.CreateOperationContext(ctx, params) if err != nil { c.sendError(message.ID, err...) return false } - ctx = graphql.WithRequestContext(ctx, rc) + ctx = graphql.WithOperationContext(ctx, rc) if c.initPayload != nil { ctx = withInitPayload(ctx, c.initPayload) @@ -222,7 +222,7 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { c.sendError(message.ID, &gqlerror.Error{Message: userErr.Error()}) } }() - responses, ctx := c.exec.DispatchRequest(ctx, rc) + responses, ctx := c.exec.DispatchOperation(ctx, rc) for { response := responses(ctx) if response == nil { diff --git a/graphql/recovery.go b/graphql/recovery.go index 130d661b373..fbd18556d4f 100644 --- a/graphql/recovery.go +++ b/graphql/recovery.go @@ -20,9 +20,9 @@ func DefaultRecover(ctx context.Context, err interface{}) error { return errors.New("internal system error") } -var _ RequestContextMutator = RecoverFunc(nil) +var _ OperationContextMutator = RecoverFunc(nil) -func (f RecoverFunc) MutateRequestContext(ctx context.Context, rc *RequestContext) *gqlerror.Error { +func (f RecoverFunc) MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error { rc.Recover = f return nil } diff --git a/handler/handler.go b/handler/handler.go index 3390727eb24..573d20be7c3 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -51,12 +51,12 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc srv.AroundResponses(hook) } if cfg.complexityLimit != 0 { - srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { + srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { return cfg.complexityLimit })) } else if cfg.complexityLimitFunc != nil { - srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.RequestContext) int { - return cfg.complexityLimitFunc(graphql.WithRequestContext(ctx, rc)) + srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { + return cfg.complexityLimitFunc(graphql.WithOperationContext(ctx, rc)) })) } if !cfg.disableIntrospection { diff --git a/integration/generated.go b/integration/generated.go index a197023e435..44471dc2c8b 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -207,7 +207,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e} first := true @@ -233,7 +233,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } type executionContext struct { - *graphql.RequestContext + *graphql.OperationContext *executableSchema } @@ -2005,7 +2005,7 @@ func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, obj in var elementImplementors = []string{"Element"} func (ec *executionContext) _Element(ctx context.Context, sel ast.SelectionSet, obj *models.Element) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, elementImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, elementImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2066,7 +2066,7 @@ func (ec *executionContext) _Element(ctx context.Context, sel ast.SelectionSet, var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ Object: "Query", @@ -2174,7 +2174,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr var userImplementors = []string{"User"} func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *remote_api.User) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, userImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2215,7 +2215,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj var viewerImplementors = []string{"Viewer"} func (ec *executionContext) _Viewer(ctx context.Context, sel ast.SelectionSet, obj *models.Viewer) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, viewerImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, viewerImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2239,7 +2239,7 @@ func (ec *executionContext) _Viewer(ctx context.Context, sel ast.SelectionSet, o var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2278,7 +2278,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2314,7 +2314,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2360,7 +2360,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2396,7 +2396,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 @@ -2437,7 +2437,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors) + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 From 40f088681b169ef1249258f164b70f37ae7b66b6 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2019 17:55:32 +1100 Subject: [PATCH 30/53] add NewDefaultServer --- graphql/handler/apollotracing/tracer.go | 14 ++++------ graphql/handler/apollotracing/tracer_test.go | 2 +- graphql/handler/extension/complexity_test.go | 5 ++-- graphql/handler/server.go | 27 ++++++++++++++++++++ 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 9ac9ad16031..5e6d1211edf 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -9,7 +9,7 @@ import ( ) type ( - ApolloTracing struct{} + Tracer struct{} TracingExtension struct { mu sync.Mutex @@ -39,14 +39,10 @@ type ( } ) -var _ graphql.ResponseInterceptor = ApolloTracing{} -var _ graphql.FieldInterceptor = ApolloTracing{} +var _ graphql.ResponseInterceptor = Tracer{} +var _ graphql.FieldInterceptor = Tracer{} -func New() graphql.HandlerExtension { - return &ApolloTracing{} -} - -func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { +func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { rc := graphql.GetOperationContext(ctx) td, ok := graphql.GetExtension(ctx, "tracing").(*TracingExtension) if !ok { @@ -75,7 +71,7 @@ func (a ApolloTracing) InterceptField(ctx context.Context, next graphql.Resolver return next(ctx) } -func (a ApolloTracing) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { +func (a Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { rc := graphql.GetOperationContext(ctx) start := rc.Stats.OperationStart diff --git a/graphql/handler/apollotracing/tracer_test.go b/graphql/handler/apollotracing/tracer_test.go index e2e3a93ccdf..a905e7ffdd2 100644 --- a/graphql/handler/apollotracing/tracer_test.go +++ b/graphql/handler/apollotracing/tracer_test.go @@ -17,7 +17,7 @@ import ( func TestApolloTracing(t *testing.T) { h := testserver.New() h.AddTransport(transport.POST{}) - h.Use(apollotracing.New()) + h.Use(apollotracing.Tracer{}) resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) diff --git a/graphql/handler/extension/complexity_test.go b/graphql/handler/extension/complexity_test.go index 90465f4f81a..9ee1b398bd4 100644 --- a/graphql/handler/extension/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -1,4 +1,4 @@ -package extension +package extension_test import ( "context" @@ -8,6 +8,7 @@ import ( "testing" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/extension" "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" @@ -15,7 +16,7 @@ import ( func TestHandlerComplexity(t *testing.T) { h := testserver.New() - h.Use(ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { + h.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { if rc.RawQuery == "{ ok: name }" { return 4 } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index 9ef6e234d84..ae2680dce1b 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -5,8 +5,13 @@ import ( "encoding/json" "fmt" "net/http" + "time" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/apollotracing" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/lru" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/vektah/gqlparser/gqlerror" ) @@ -34,6 +39,28 @@ func New(es graphql.ExecutableSchema) *Server { return s } +func NewDefaultServer(es graphql.ExecutableSchema) *Server { + srv := New(es) + + srv.AddTransport(transport.Websocket{ + KeepAlivePingInterval: 10 * time.Second, + }) + srv.AddTransport(transport.Options{}) + srv.AddTransport(transport.GET{}) + srv.AddTransport(transport.POST{}) + srv.AddTransport(transport.MultipartForm{}) + + srv.SetQueryCache(lru.New(100)) + + srv.Use(extension.Introspection{}) + srv.Use(extension.AutomaticPersistedQuery{ + Cache: lru.New(100), + }) + srv.Use(apollotracing.Tracer{}) + + return srv +} + func (s *Server) AddTransport(transport graphql.Transport) { s.transports = append(s.transports, transport) } From 848c627c375d9cc991131d94bbb13f317a723ecf Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2019 18:10:30 +1100 Subject: [PATCH 31/53] remove DirectiveMiddleware --- graphql/context_operation.go | 30 +++++++++++++----------------- graphql/context_resolver.go | 8 -------- graphql/handler/executor.go | 1 - 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/graphql/context_operation.go b/graphql/context_operation.go index 7d09a8aeb89..daf077a3cba 100644 --- a/graphql/context_operation.go +++ b/graphql/context_operation.go @@ -20,36 +20,32 @@ type OperationContext struct { DisableIntrospection bool Recover RecoverFunc ResolverMiddleware FieldMiddleware - DirectiveMiddleware FieldMiddleware Stats Stats } -const operationCtx key = "operation_context" - -func (rc *OperationContext) Validate(ctx context.Context) error { - if rc.Doc == nil { - return errors.New("field 'Doc' must be required") - } - if rc.RawQuery == "" { - return errors.New("field 'RawQuery' must be required") +func (c *OperationContext) Validate(ctx context.Context) error { + if c.Doc == nil { + return errors.New("field 'Doc'is required") } - if rc.Variables == nil { - rc.Variables = make(map[string]interface{}) + if c.RawQuery == "" { + return errors.New("field 'RawQuery' is required") } - if rc.ResolverMiddleware == nil { - rc.ResolverMiddleware = DefaultResolverMiddleware + if c.Variables == nil { + c.Variables = make(map[string]interface{}) } - if rc.DirectiveMiddleware == nil { - rc.DirectiveMiddleware = DefaultDirectiveMiddleware + if c.ResolverMiddleware == nil { + return errors.New("field 'ResolverMiddleware' is required") } - if rc.Recover == nil { - rc.Recover = DefaultRecover + if c.Recover == nil { + c.Recover = DefaultRecover } return nil } +const operationCtx key = "operation_context" + // Deprecated: Please update all references to GetOperationContext instead func GetRequestContext(ctx context.Context) *RequestContext { return GetOperationContext(ctx) diff --git a/graphql/context_resolver.go b/graphql/context_resolver.go index 0a505c1fb3a..01e35681fee 100644 --- a/graphql/context_resolver.go +++ b/graphql/context_resolver.go @@ -4,14 +4,6 @@ import ( "context" ) -func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { - return next(ctx) -} - -func DefaultDirectiveMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) { - return next(ctx) -} - type key string const resolverCtx key = "resolver_context" diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index ffcc913d5bf..c4890bf2589 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -152,7 +152,6 @@ func (e executor) CreateOperationContext(ctx context.Context, params *graphql.Ra DisableIntrospection: true, Recover: graphql.DefaultRecover, ResolverMiddleware: e.fieldMiddleware, - DirectiveMiddleware: nil, //todo fixme Stats: stats, } From 092ed95fd7cc9587b88865175a055d8b35a9fb42 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Nov 2019 00:05:17 +1100 Subject: [PATCH 32/53] collect field timing in generated code --- codegen/field.gotpl | 16 +- codegen/testserver/generated.go | 2572 +++++++++++--------- example/chat/generated.go | 692 +++--- example/config/generated.go | 692 +++--- example/dataloader/generated.go | 788 +++--- example/fileupload/generated.go | 676 ++--- example/scalars/generated.go | 740 +++--- example/selection/generated.go | 694 +++--- example/starwars/generated/exec.go | 1156 +++++---- example/todo/generated.go | 676 ++--- example/type-system-extension/generated.go | 660 ++--- graphql/context_resolver.go | 15 + graphql/handler/apollotracing/tracer.go | 6 +- graphql/handler/testserver/testserver.go | 3 + integration/generated.go | 740 +++--- 15 files changed, 5696 insertions(+), 4430 deletions(-) diff --git a/codegen/field.gotpl b/codegen/field.gotpl index 97ec20a684c..ea90d0ff84e 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -5,19 +5,20 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- if $object.Stream }} {{- $null = "nil" }} {{- end }} - - defer func () { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = {{ $null }} - } - }() rctx := &graphql.ResolverContext{ Object: {{$object.Name|quote}}, Field: field, Args: nil, IsMethod: {{or $field.IsMethod $field.IsResolver}}, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func () { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = {{ $null }} + } + }() ctx = graphql.WithResolverContext(ctx, rctx) {{- if $field.Args }} rawArgs := field.ArgumentMap(ec.Variables) @@ -28,6 +29,7 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex } rctx.Args = args {{- end }} + rctx.Stats.ArgumentsCompleted = graphql.Now() {{- if $.Directives.LocationDirectives "FIELD" }} resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { {{ template "field" $field }} diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 6047b50a0cf..f75ac0b9b1b 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -2714,20 +2714,22 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "A", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2745,20 +2747,22 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi } func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.CollectedField, obj *AIt) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "AIt", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2776,20 +2780,22 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected } func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.CollectedField, obj *AbIt) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "AbIt", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2807,20 +2813,22 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int, nil @@ -2838,20 +2846,22 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col } func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int32, nil @@ -2869,20 +2879,22 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C } func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int64, nil @@ -2900,20 +2912,22 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C } func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdStr, nil @@ -2931,20 +2945,22 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C } func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdInt, nil @@ -2962,20 +2978,22 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C } func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedField, obj *B) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "B", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2993,20 +3011,22 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi } func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Circle", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Radius, nil @@ -3021,20 +3041,22 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co } func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Circle", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -3049,20 +3071,22 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Content_Post", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3077,20 +3101,22 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql } func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Content_User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3105,20 +3131,22 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql } func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, field graphql.CollectedField, obj *EmbeddedDefaultScalar) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "EmbeddedDefaultScalar", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil @@ -3133,20 +3161,22 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi } func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "EmbeddedPointer", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3161,20 +3191,22 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph } func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "EmbeddedPointer", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Title, nil @@ -3189,20 +3221,22 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr } func (ec *executionContext) _Error_id(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3220,20 +3254,22 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnNonRequiredField() @@ -3248,20 +3284,22 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, } func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnRequiredField() @@ -3279,20 +3317,22 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie } func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NilOnRequiredField(), nil @@ -3310,20 +3350,22 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field } func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().A(rctx, obj) @@ -3341,20 +3383,22 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().B(rctx, obj) @@ -3372,20 +3416,22 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().C(rctx, obj) @@ -3400,23 +3446,25 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect res := resTmp.(*Error) rctx.Result = res return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) -} - -func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() +} + +func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().D(rctx, obj) @@ -3434,20 +3482,22 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().E(rctx, obj) @@ -3465,20 +3515,22 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect } func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field graphql.CollectedField, obj *ForcedResolver) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ForcedResolver", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ForcedResolver().Field(rctx, obj) @@ -3493,20 +3545,22 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra } func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.CollectedField, obj *InnerObject) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "InnerObject", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3524,20 +3578,22 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C } func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field graphql.CollectedField, obj *invalid_packagename.InvalidIdentifier) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "InvalidIdentifier", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3555,20 +3611,22 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra } func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedField, obj *introspection1.It) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "It", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3586,20 +3644,22 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF } func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.CollectedField, obj *LoopA) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "LoopA", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.B, nil @@ -3617,20 +3677,22 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.CollectedField, obj *LoopB) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "LoopB", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.A, nil @@ -3648,20 +3710,22 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Map", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3679,20 +3743,22 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected } func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MapStringInterfaceType", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["a"].(type) { @@ -3716,20 +3782,22 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field } func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MapStringInterfaceType", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["b"].(type) { @@ -3753,20 +3821,22 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field } func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ModelMethods().ResolverField(rctx, obj) @@ -3784,20 +3854,22 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie } func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NoContext(), nil @@ -3815,20 +3887,22 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g } func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.WithContext(ctx), nil @@ -3846,20 +3920,22 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field } func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ObjectDirectives", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -3909,20 +3985,22 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr } func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ObjectDirectives", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -3957,20 +4035,22 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, } func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectivesWithCustomGoModel) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ObjectDirectivesWithCustomGoModel", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4005,20 +4085,22 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx } func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphql.CollectedField, obj *OuterObject) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "OuterObject", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Inner, nil @@ -4036,20 +4118,22 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq } func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -4061,26 +4145,28 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field } return graphql.Null } - res := resTmp.(int) - rctx.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) -} - -func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() + res := resTmp.(int) + rctx.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -4098,20 +4184,22 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) @@ -4129,20 +4217,22 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil @@ -4160,20 +4250,22 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil @@ -4191,20 +4283,22 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel } func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Panics", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) @@ -4222,19 +4316,20 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel } func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Panics", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Panics_fieldFuncMarshal_args(ctx, rawArgs) @@ -4243,6 +4338,7 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FieldFuncMarshal(ctx, args["u"].([]MarshalPanic)), nil @@ -4260,19 +4356,20 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field } func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Panics", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Panics_argUnmarshal_args(ctx, rawArgs) @@ -4281,6 +4378,7 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, args["u"].([]MarshalPanic)) @@ -4298,20 +4396,22 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap } func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Primitive", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Primitive().Value(rctx, obj) @@ -4329,20 +4429,22 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. } func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Primitive", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Squared(), nil @@ -4360,20 +4462,22 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq } func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Value(rctx, obj) @@ -4391,20 +4495,22 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr } func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Doubled(), nil @@ -4422,20 +4528,22 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field } func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Len(rctx, obj) @@ -4453,20 +4561,22 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap } func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InvalidIdentifier(rctx) @@ -4481,20 +4591,22 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field } func (ec *executionContext) _Query_collision(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Collision(rctx) @@ -4509,19 +4621,20 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. } func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapInput_args(ctx, rawArgs) @@ -4530,6 +4643,7 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapInput(rctx, args["input"].(map[string]interface{})) @@ -4544,19 +4658,20 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_recursive_args(ctx, rawArgs) @@ -4565,6 +4680,7 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Recursive(rctx, args["input"].(*RecursiveInputSlice)) @@ -4579,19 +4695,20 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. } func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_nestedInputs_args(ctx, rawArgs) @@ -4600,6 +4717,7 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedInputs(rctx, args["input"].([][]*OuterInput)) @@ -4614,20 +4732,22 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph } func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedOutputs(rctx) @@ -4642,20 +4762,22 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap } func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ModelMethods(rctx) @@ -4667,22 +4789,23 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph res := resTmp.(*ModelMethods) rctx.Result = res return ec.marshalOModelMethods2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐModelMethods(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() +} + +func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_user_args(ctx, rawArgs) @@ -4691,6 +4814,7 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(int)) @@ -4708,19 +4832,20 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_nullableArg_args(ctx, rawArgs) @@ -4729,6 +4854,7 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NullableArg(rctx, args["arg"].(*int)) @@ -4743,19 +4869,20 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq } func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_inputSlice_args(ctx, rawArgs) @@ -4764,6 +4891,7 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InputSlice(rctx, args["arg"].([]string)) @@ -4781,20 +4909,22 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql } func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ShapeUnion(rctx) @@ -4812,20 +4942,22 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql } func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Autobind(rctx) @@ -4840,20 +4972,22 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DeprecatedField(rctx) @@ -4871,20 +5005,22 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr } func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Overlapping(rctx) @@ -4899,19 +5035,20 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq } func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveArg_args(ctx, rawArgs) @@ -4920,6 +5057,7 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveArg(rctx, args["arg"].(string)) @@ -4934,19 +5072,20 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph } func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveNullableArg_args(ctx, rawArgs) @@ -4955,6 +5094,7 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -4969,19 +5109,20 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie } func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInputNullable_args(ctx, rawArgs) @@ -4990,6 +5131,7 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputNullable(rctx, args["arg"].(*InputDirectives)) @@ -5004,19 +5146,20 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f } func (ec *executionContext) _Query_directiveInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInput_args(ctx, rawArgs) @@ -5025,6 +5168,7 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInput(rctx, args["arg"].(InputDirectives)) @@ -5039,19 +5183,20 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra } func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInputType_args(ctx, rawArgs) @@ -5060,6 +5205,7 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputType(rctx, args["arg"].(InnerInput)) @@ -5074,20 +5220,22 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field } func (ec *executionContext) _Query_directiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObject(rctx) @@ -5102,20 +5250,22 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr } func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObjectWithCustomGoModel(rctx) @@ -5130,19 +5280,20 @@ func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context. } func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveFieldDef_args(ctx, rawArgs) @@ -5151,6 +5302,7 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5196,20 +5348,22 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field } func (ec *executionContext) _Query_directiveField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveField(rctx) @@ -5224,20 +5378,22 @@ func (ec *executionContext) _Query_directiveField(ctx context.Context, field gra } func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5278,20 +5434,22 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr } func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5326,20 +5484,22 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f } func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Shapes(rctx) @@ -5348,26 +5508,28 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col if resTmp == nil { return graphql.Null } - res := resTmp.([]Shape) - rctx.Result = res - return ec.marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() + res := resTmp.([]Shape) + rctx.Result = res + return ec.marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5402,19 +5564,20 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co } func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapStringInterface_args(ctx, rawArgs) @@ -5423,6 +5586,7 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapStringInterface(rctx, args["in"].(map[string]interface{})) @@ -5437,19 +5601,20 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field } func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapNestedStringInterface_args(ctx, rawArgs) @@ -5458,6 +5623,7 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapNestedStringInterface(rctx, args["in"].(*NestedMapInput)) @@ -5472,20 +5638,22 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, } func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ErrorBubble(rctx) @@ -5500,20 +5668,22 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq } func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Errors(rctx) @@ -5528,20 +5698,22 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Valid(rctx) @@ -5559,20 +5731,22 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Panics(rctx) @@ -5587,20 +5761,22 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveObject(rctx) @@ -5618,20 +5794,22 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr } func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveStringObject(rctx) @@ -5649,19 +5827,20 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi } func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_defaultScalar_args(ctx, rawArgs) @@ -5670,6 +5849,7 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DefaultScalar(rctx, args["arg"].(string)) @@ -5687,20 +5867,22 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap } func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Slices(rctx) @@ -5715,20 +5897,22 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ScalarSlice(rctx) @@ -5746,19 +5930,20 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq } func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_fallback_args(ctx, rawArgs) @@ -5767,6 +5952,7 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Fallback(rctx, args["arg"].(FallbackToStringEncoding)) @@ -5784,20 +5970,22 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().OptionalUnion(rctx) @@ -5812,20 +6000,22 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap } func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ValidType(rctx) @@ -5840,20 +6030,22 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. } func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedStruct(rctx) @@ -5871,20 +6063,22 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap } func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedScalar(rctx) @@ -5902,19 +6096,20 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -5923,6 +6118,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -5937,20 +6133,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -5962,23 +6160,25 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C res := resTmp.(*introspection.Schema) rctx.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) -} - -func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() +} + +func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "Rectangle", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Length, nil @@ -5993,20 +6193,22 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql } func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Rectangle", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Width, nil @@ -6021,20 +6223,22 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. } func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Rectangle", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -6049,20 +6253,22 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C } func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test1, nil @@ -6077,20 +6283,22 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col } func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test2, nil @@ -6105,20 +6313,22 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col } func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test3, nil @@ -6136,20 +6346,22 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col } func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test4, nil @@ -6167,20 +6379,22 @@ func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.Col } func (ec *executionContext) _Subscription_updated(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().Updated(rctx) @@ -6208,20 +6422,22 @@ func (ec *executionContext) _Subscription_updated(ctx context.Context, field gra } func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().InitPayload(rctx) @@ -6249,19 +6465,20 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field } func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_directiveArg_args(ctx, rawArgs) @@ -6270,6 +6487,7 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel return nil } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveArg(rctx, args["arg"].(string)) @@ -6294,19 +6512,20 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel } func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_directiveNullableArg_args(ctx, rawArgs) @@ -6315,6 +6534,7 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte return nil } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -6339,20 +6559,22 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte } func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6403,20 +6625,22 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f } func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6461,20 +6685,22 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -6492,20 +6718,22 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _User_friends(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Friends(rctx, obj) @@ -6523,20 +6751,22 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil @@ -6554,20 +6784,22 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Updated, nil @@ -6582,20 +6814,22 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col } func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCase, nil @@ -6613,20 +6847,22 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field } func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCaseOld, nil @@ -6638,25 +6874,26 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field } return graphql.Null } - res := resTmp.(string) - rctx.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() + res := resTmp.(string) + rctx.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_ValidType_validInputKeywords_args(ctx, rawArgs) @@ -6665,6 +6902,7 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidInputKeywords, nil @@ -6682,19 +6920,20 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f } func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_ValidType_validArgs_args(ctx, rawArgs) @@ -6703,6 +6942,7 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidArgs, nil @@ -6720,20 +6960,22 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap } func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "WrappedStruct", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -6751,20 +6993,22 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph } func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "XXIt", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -6782,20 +7026,22 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.CollectedField, obj *XxIt) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "XxIt", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -6813,20 +7059,22 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -6844,20 +7092,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -6872,20 +7122,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -6903,20 +7155,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -6934,20 +7188,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -6965,20 +7221,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -6993,20 +7251,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -7024,20 +7284,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7052,20 +7314,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -7083,20 +7347,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7111,20 +7377,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -7142,20 +7410,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -7173,20 +7443,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -7204,20 +7476,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7229,23 +7503,25 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel res := resTmp.(*string) rctx.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -7263,20 +7539,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7291,20 +7569,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -7322,20 +7602,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -7350,20 +7632,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -7381,20 +7665,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -7412,20 +7698,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -7440,20 +7728,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -7468,20 +7758,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -7499,20 +7791,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -7530,20 +7824,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -7558,20 +7854,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -7586,19 +7884,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -7607,6 +7906,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -7621,20 +7921,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -7649,20 +7951,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -7677,19 +7981,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -7698,6 +8003,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -7712,20 +8018,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -7740,20 +8048,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -7768,20 +8078,22 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.CollectedField, obj *AsdfIt) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "asdfIt", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -7799,20 +8111,22 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec } func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.CollectedField, obj *IIt) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "iIt", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil diff --git a/example/chat/generated.go b/example/chat/generated.go index 054f0d957a5..028127920e0 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -450,20 +450,22 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as // region **************************** field.gotpl ***************************** func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Chatroom", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -484,20 +486,22 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co } func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Chatroom", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Messages, nil @@ -518,20 +522,22 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq } func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -552,20 +558,22 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -586,20 +594,22 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col } func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedBy, nil @@ -620,20 +630,22 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq } func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil @@ -654,19 +666,20 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq } func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_post_args(ctx, rawArgs) @@ -675,6 +688,7 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().Post(rctx, args["text"].(string), args["username"].(string), args["roomName"].(string)) @@ -695,19 +709,20 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co } func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_room_args(ctx, rawArgs) @@ -716,6 +731,7 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Room(rctx, args["name"].(string)) @@ -733,19 +749,20 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -754,6 +771,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -771,20 +789,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -802,19 +822,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() rctx := &graphql.ResolverContext{ Object: "Subscription", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_messageAdded_args(ctx, rawArgs) @@ -823,6 +844,7 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel return nil } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().MessageAdded(rctx, args["roomName"].(string)) @@ -853,20 +875,22 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -887,20 +911,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -918,20 +944,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -952,20 +980,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -986,20 +1016,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1020,20 +1052,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1051,20 +1085,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1085,20 +1121,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1116,21 +1154,23 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) @@ -1150,20 +1190,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1181,20 +1223,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1215,20 +1259,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1249,20 +1295,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1283,20 +1331,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1314,20 +1364,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1348,20 +1400,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1379,20 +1433,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1413,20 +1469,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1444,20 +1502,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1478,20 +1538,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1512,20 +1574,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1543,20 +1607,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1574,20 +1640,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1608,20 +1676,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1642,20 +1712,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1673,20 +1745,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1704,19 +1778,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1725,6 +1800,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1742,20 +1818,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1773,20 +1851,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1804,19 +1884,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1825,6 +1906,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1842,20 +1924,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1873,20 +1957,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/config/generated.go b/example/config/generated.go index 6942ac8865f..a5d195c1de0 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -324,19 +324,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_createTodo_args(ctx, rawArgs) @@ -345,6 +346,7 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateTodo(rctx, args["input"].(NewTodo)) @@ -365,20 +367,22 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap } func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Todos(rctx) @@ -399,19 +403,20 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -420,6 +425,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -437,20 +443,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -468,20 +476,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Todo().ID(rctx, obj) @@ -502,20 +512,22 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DatabaseID, nil @@ -536,20 +548,22 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -570,20 +584,22 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Done, nil @@ -604,20 +620,22 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -638,20 +656,22 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -672,20 +692,22 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FullName(), nil @@ -706,20 +728,22 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -740,20 +764,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -771,20 +797,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -805,20 +833,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -839,20 +869,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -873,20 +905,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -904,20 +938,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -938,20 +974,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -969,21 +1007,23 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) @@ -1003,20 +1043,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1034,20 +1076,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1068,20 +1112,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1102,20 +1148,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1136,20 +1184,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1167,20 +1217,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1201,20 +1253,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1232,20 +1286,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1266,20 +1322,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1297,20 +1355,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1331,20 +1391,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1365,20 +1427,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1396,20 +1460,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1427,20 +1493,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1461,20 +1529,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1495,20 +1565,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1526,20 +1598,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1557,19 +1631,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1578,6 +1653,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1595,20 +1671,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1626,20 +1704,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1657,19 +1737,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1678,6 +1759,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1695,20 +1777,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1726,20 +1810,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index c8cfb87a7e6..9edf2bb8447 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -386,20 +386,22 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -420,20 +422,22 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Address_street(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Street, nil @@ -454,20 +458,22 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C } func (ec *executionContext) _Address_country(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Country, nil @@ -488,20 +494,22 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. } func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -522,20 +530,22 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -556,20 +566,22 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co } func (ec *executionContext) _Customer_address(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Address(rctx, obj) @@ -587,20 +599,22 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql } func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Orders(rctx, obj) @@ -618,20 +632,22 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. } func (ec *executionContext) _Item_name(ctx context.Context, field graphql.CollectedField, obj *Item) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Item", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -652,20 +668,22 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Order_id(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -686,20 +704,22 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Order_date(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Date, nil @@ -720,20 +740,22 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Amount, nil @@ -754,20 +776,22 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col } func (ec *executionContext) _Order_items(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Order().Items(rctx, obj) @@ -785,20 +809,22 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_customers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Customers(rctx) @@ -816,19 +842,20 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. } func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_torture1d_args(ctx, rawArgs) @@ -837,6 +864,7 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture1d(rctx, args["customerIds"].([]int)) @@ -854,19 +882,20 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. } func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_torture2d_args(ctx, rawArgs) @@ -875,6 +904,7 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture2d(rctx, args["customerIds"].([][]int)) @@ -892,19 +922,20 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -913,6 +944,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -930,20 +962,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -961,20 +995,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -995,20 +1031,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1026,21 +1064,23 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) @@ -1060,20 +1100,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1094,20 +1136,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1128,20 +1172,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1159,20 +1205,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1193,20 +1241,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1224,20 +1274,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1258,20 +1310,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1289,20 +1343,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1323,20 +1379,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1357,20 +1415,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1391,20 +1451,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1422,20 +1484,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1456,20 +1520,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1487,20 +1553,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1521,20 +1589,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1552,20 +1622,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1586,20 +1658,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1620,20 +1694,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1651,20 +1727,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1682,20 +1760,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1716,20 +1796,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1750,20 +1832,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1781,20 +1865,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1812,19 +1898,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1833,6 +1920,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1850,20 +1938,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1881,20 +1971,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1912,19 +2004,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1933,6 +2026,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1950,20 +2044,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1981,20 +2077,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 7deaac07650..508239c88c0 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -369,20 +369,22 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "File", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -403,20 +405,22 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _File_name(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "File", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -437,20 +441,22 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _File_content(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "File", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Content, nil @@ -471,19 +477,20 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col } func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_singleUpload_args(ctx, rawArgs) @@ -492,6 +499,7 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUpload(rctx, args["file"].(graphql.Upload)) @@ -512,19 +520,20 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr } func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_singleUploadWithPayload_args(ctx, rawArgs) @@ -533,6 +542,7 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUploadWithPayload(rctx, args["req"].(model.UploadFile)) @@ -553,19 +563,20 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex } func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_multipleUpload_args(ctx, rawArgs) @@ -574,6 +585,7 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUpload(rctx, args["files"].([]*graphql.Upload)) @@ -594,19 +606,20 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field } func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_multipleUploadWithPayload_args(ctx, rawArgs) @@ -615,6 +628,7 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUploadWithPayload(rctx, args["req"].([]*model.UploadFile)) @@ -635,20 +649,22 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont } func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Empty(rctx) @@ -669,19 +685,20 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -690,6 +707,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -707,20 +725,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -738,20 +758,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -772,20 +794,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -803,20 +827,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -837,20 +863,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -871,20 +899,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -905,20 +935,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -936,20 +968,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -970,20 +1004,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1001,20 +1037,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1035,21 +1073,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) @@ -1066,20 +1106,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1100,20 +1142,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1134,20 +1178,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1168,20 +1214,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1199,20 +1247,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1233,20 +1283,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1264,20 +1316,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1298,20 +1352,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1329,20 +1385,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1363,20 +1421,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1397,20 +1457,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1428,20 +1490,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1459,20 +1523,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1493,20 +1559,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1527,20 +1595,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1558,20 +1628,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1589,19 +1661,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1610,6 +1683,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1627,20 +1701,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1658,20 +1734,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1689,19 +1767,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1710,6 +1789,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1727,20 +1807,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1758,20 +1840,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/scalars/generated.go b/example/scalars/generated.go index be6f2d7011f..9c78136c4de 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -357,20 +357,22 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -391,20 +393,22 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Address_location(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Location, nil @@ -422,19 +426,20 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_user_args(ctx, rawArgs) @@ -443,6 +448,7 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(external.ObjectID)) @@ -460,19 +466,20 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_search_args(ctx, rawArgs) @@ -481,6 +488,7 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["input"].(*model.SearchArgs)) @@ -501,19 +509,20 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -522,6 +531,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -539,20 +549,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -570,20 +582,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -604,20 +618,22 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -638,20 +654,22 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil @@ -669,20 +687,22 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsBanned, nil @@ -703,20 +723,22 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co } func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().PrimitiveResolver(rctx, obj) @@ -737,20 +759,22 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g } func (ec *executionContext) _User_customResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().CustomResolver(rctx, obj) @@ -771,20 +795,22 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap } func (ec *executionContext) _User_address(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Address, nil @@ -802,20 +828,22 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_tier(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Tier, nil @@ -833,20 +861,22 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -867,20 +897,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -898,20 +930,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -932,20 +966,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -966,20 +1002,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1000,21 +1038,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) @@ -1031,20 +1071,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1065,20 +1107,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1096,20 +1140,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1130,20 +1176,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1161,20 +1209,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1195,20 +1245,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1229,20 +1281,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1263,20 +1317,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1294,20 +1350,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1328,20 +1386,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1359,20 +1419,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1393,20 +1455,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1424,20 +1488,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1458,20 +1524,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1492,20 +1560,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1523,20 +1593,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1554,20 +1626,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1588,20 +1662,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1622,20 +1698,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1653,20 +1731,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1684,19 +1764,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1705,6 +1786,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1722,20 +1804,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1753,20 +1837,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1784,19 +1870,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1805,6 +1892,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1822,20 +1910,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1853,20 +1943,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/selection/generated.go b/example/selection/generated.go index 7699270ad4a..ad1e4e88af6 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -275,20 +275,22 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Reaction, nil @@ -309,20 +311,22 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co } func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -343,20 +347,22 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -374,20 +380,22 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C } func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -405,20 +413,22 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C } func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Message, nil @@ -439,20 +449,22 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col } func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -473,20 +485,22 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -504,20 +518,22 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C } func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -535,20 +551,22 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Events(rctx) @@ -566,19 +584,20 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -587,6 +606,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -604,20 +624,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -635,20 +657,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -669,20 +693,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -700,20 +726,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -734,20 +762,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -768,20 +798,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -802,20 +834,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -833,20 +867,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -867,20 +903,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -898,20 +936,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -932,20 +972,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -963,20 +1005,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -997,20 +1041,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1028,23 +1074,25 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col res := resTmp.(*introspection.Type) rctx.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1065,20 +1113,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1096,20 +1146,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1130,20 +1182,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1161,20 +1215,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1195,20 +1251,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1226,20 +1284,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1260,20 +1320,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1294,20 +1356,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1325,20 +1389,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1356,20 +1422,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1390,20 +1458,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1424,20 +1494,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1455,20 +1527,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1486,19 +1560,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1507,6 +1582,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1524,20 +1600,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1555,20 +1633,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1586,19 +1666,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1607,6 +1688,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1624,20 +1706,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1655,20 +1739,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 20913590230..16880c51e42 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -939,20 +939,22 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -973,20 +975,22 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1007,20 +1011,22 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().Friends(rctx, obj) @@ -1038,19 +1044,20 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co } func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Droid_friendsConnection_args(ctx, rawArgs) @@ -1059,6 +1066,7 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1079,20 +1087,22 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field } func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1113,20 +1123,22 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. } func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PrimaryFunction, nil @@ -1144,20 +1156,22 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr } func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount(), nil @@ -1178,20 +1192,22 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f } func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Edges(rctx, obj) @@ -1209,20 +1225,22 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field } func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Friends(rctx, obj) @@ -1240,20 +1258,22 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel } func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo(), nil @@ -1274,20 +1294,22 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie } func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "FriendsEdge", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil @@ -1308,20 +1330,22 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph } func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "FriendsEdge", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil @@ -1339,20 +1363,22 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql } func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -1373,20 +1399,22 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1407,19 +1435,20 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Human_height_args(ctx, rawArgs) @@ -1428,6 +1457,7 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Height(args["unit"].(models.LengthUnit)), nil @@ -1448,20 +1478,22 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col } func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Mass, nil @@ -1479,20 +1511,22 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Friends(rctx, obj) @@ -1510,19 +1544,20 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co } func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Human_friendsConnection_args(ctx, rawArgs) @@ -1531,6 +1566,7 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1551,20 +1587,22 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field } func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1585,21 +1623,23 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. } func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Starships(rctx, obj) }) @@ -1616,19 +1656,20 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. } func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_createReview_args(ctx, rawArgs) @@ -1637,6 +1678,7 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateReview(rctx, args["episode"].(models.Episode), args["review"].(models.Review)) @@ -1654,20 +1696,22 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr } func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "PageInfo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.StartCursor, nil @@ -1688,20 +1732,22 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra } func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "PageInfo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EndCursor, nil @@ -1722,20 +1768,22 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph } func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "PageInfo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.HasNextPage, nil @@ -1756,19 +1804,20 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra } func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_hero_args(ctx, rawArgs) @@ -1777,6 +1826,7 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Hero(rctx, args["episode"].(*models.Episode)) @@ -1794,19 +1844,20 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_reviews_args(ctx, rawArgs) @@ -1815,6 +1866,7 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Reviews(rctx, args["episode"].(models.Episode), args["since"].(*time.Time)) @@ -1835,19 +1887,20 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_search_args(ctx, rawArgs) @@ -1856,6 +1909,7 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["text"].(string)) @@ -1876,19 +1930,20 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_character_args(ctx, rawArgs) @@ -1897,6 +1952,7 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Character(rctx, args["id"].(string)) @@ -1914,19 +1970,20 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. } func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_droid_args(ctx, rawArgs) @@ -1935,6 +1992,7 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Droid(rctx, args["id"].(string)) @@ -1952,19 +2010,20 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_human_args(ctx, rawArgs) @@ -1973,6 +2032,7 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Human(rctx, args["id"].(string)) @@ -1990,19 +2050,20 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_starship_args(ctx, rawArgs) @@ -2011,6 +2072,7 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Starship(rctx, args["id"].(string)) @@ -2028,19 +2090,20 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -2049,6 +2112,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -2066,20 +2130,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -2097,20 +2163,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Review", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Stars, nil @@ -2131,20 +2199,22 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col } func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Review", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Commentary, nil @@ -2162,20 +2232,22 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq } func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Review", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Time, nil @@ -2193,20 +2265,22 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2227,20 +2301,22 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2261,19 +2337,20 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co } func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Starship_length_args(ctx, rawArgs) @@ -2282,6 +2359,7 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Starship().Length(rctx, obj, args["unit"].(*models.LengthUnit)) @@ -2302,20 +2380,22 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. } func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.History, nil @@ -2336,20 +2416,22 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2370,20 +2452,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2401,20 +2485,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -2435,20 +2521,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2469,20 +2557,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2503,20 +2593,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2534,20 +2626,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2568,20 +2662,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2599,20 +2695,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2633,20 +2731,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2664,20 +2764,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2698,20 +2800,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -2732,20 +2836,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2766,20 +2872,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2797,20 +2905,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2831,20 +2941,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2862,20 +2974,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -2896,20 +3010,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -2927,20 +3043,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -2961,20 +3079,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -2995,20 +3115,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -3026,20 +3148,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -3057,20 +3181,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -3091,20 +3217,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -3125,20 +3253,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -3156,20 +3286,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -3187,19 +3319,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -3208,6 +3341,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -3225,20 +3359,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -3256,20 +3392,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -3287,19 +3425,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -3308,6 +3447,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -3325,20 +3465,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -3356,20 +3498,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/todo/generated.go b/example/todo/generated.go index bdcd89b45fa..57fc9dc6fa4 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -498,19 +498,20 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyMutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_createTodo_args(ctx, rawArgs) @@ -519,6 +520,7 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) @@ -536,19 +538,20 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyMutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_updateTodo_args(ctx, rawArgs) @@ -557,6 +560,7 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{})) @@ -571,19 +575,20 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery_todo_args(ctx, rawArgs) @@ -592,6 +597,7 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int)) @@ -606,20 +612,22 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().LastTodo(rctx) @@ -634,20 +642,22 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) @@ -665,19 +675,20 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery___type_args(ctx, rawArgs) @@ -686,6 +697,7 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -700,20 +712,22 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -728,20 +742,22 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -759,20 +775,22 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -790,20 +808,22 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -845,20 +865,22 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -876,20 +898,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -904,20 +928,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -935,20 +961,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -966,20 +994,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -997,20 +1027,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1025,20 +1057,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1056,20 +1090,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1084,20 +1120,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1115,21 +1153,23 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) @@ -1143,20 +1183,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1174,20 +1216,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1205,20 +1249,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1236,20 +1282,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1264,20 +1312,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1295,20 +1345,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1323,20 +1375,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1354,20 +1408,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1382,20 +1438,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1413,20 +1471,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1444,20 +1504,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1472,20 +1534,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1500,20 +1564,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1531,20 +1597,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1562,20 +1630,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1590,20 +1660,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1618,19 +1690,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1639,6 +1712,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1653,20 +1727,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1681,20 +1757,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1709,19 +1787,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1730,6 +1809,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1744,20 +1824,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1772,20 +1854,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 25b421ffff5..90f8337cf93 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -379,19 +379,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyMutation", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_createTodo_args(ctx, rawArgs) @@ -400,6 +401,7 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) @@ -420,20 +422,22 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) @@ -454,19 +458,20 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery_todo_args(ctx, rawArgs) @@ -475,6 +480,7 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(string)) @@ -492,19 +498,20 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery___type_args(ctx, rawArgs) @@ -513,6 +520,7 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -530,20 +538,22 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -561,20 +571,22 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -595,20 +607,22 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -629,20 +643,22 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.State, nil @@ -663,20 +679,22 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() 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 @@ -717,20 +735,22 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -751,20 +771,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -782,20 +804,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -816,20 +840,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -850,20 +876,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -884,20 +912,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -915,20 +945,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -949,20 +981,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -980,20 +1014,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1014,20 +1050,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1045,21 +1083,23 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) @@ -1079,20 +1119,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1113,20 +1155,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1147,20 +1191,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1178,20 +1224,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1212,20 +1260,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1243,20 +1293,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1277,20 +1329,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1308,20 +1362,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1342,20 +1398,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1376,20 +1434,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1407,20 +1467,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1438,20 +1500,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1472,20 +1536,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1506,20 +1572,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1537,20 +1605,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1568,19 +1638,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1589,6 +1660,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1606,20 +1678,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1637,20 +1711,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1668,19 +1744,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1689,6 +1766,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1706,20 +1784,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1737,20 +1817,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil diff --git a/graphql/context_resolver.go b/graphql/context_resolver.go index 01e35681fee..eb963ef840e 100644 --- a/graphql/context_resolver.go +++ b/graphql/context_resolver.go @@ -2,6 +2,7 @@ package graphql import ( "context" + "time" ) type key string @@ -22,6 +23,20 @@ type ResolverContext struct { Result interface{} // IsMethod indicates if the resolver is a method IsMethod bool + + // Stats collected while executing this field + Stats FieldStats +} + +type FieldStats struct { + // When field execution started + Started time.Time + + // When argument marshaling finished + ArgumentsCompleted time.Time + + // When the field completed running all middleware. Not available inside field middleware! + Completed time.Time } func (r *ResolverContext) Path() []interface{} { diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 5e6d1211edf..d3a10789edc 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -49,8 +49,6 @@ func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res panic("missing tracing extension") } - start := graphql.Now() - defer func() { td.mu.Lock() defer td.mu.Unlock() @@ -63,8 +61,8 @@ func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res ParentType: fc.Object, FieldName: fc.Field.Name, ReturnType: fc.Field.Definition.Type.String(), - StartOffset: start.Sub(rc.Stats.OperationStart), - Duration: end.Sub(start), + StartOffset: fc.Stats.Started.Sub(rc.Stats.OperationStart), + Duration: end.Sub(fc.Stats.Started), }) }() diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index 8f7ebaf0997..c4cebcbac00 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -62,6 +62,9 @@ func New() *TestServer { Definition: schema.Types["Query"].Fields.ForName("name"), }, }, + Stats: graphql.FieldStats{ + Started: graphql.Now(), + }, }) res, err := graphql.GetOperationContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil diff --git a/integration/generated.go b/integration/generated.go index 44471dc2c8b..b63592e5189 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -417,20 +417,22 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Element", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Child(rctx, obj) @@ -451,20 +453,22 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co } func (ec *executionContext) _Element_error(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Element", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Error(rctx, obj) @@ -485,20 +489,22 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co } func (ec *executionContext) _Element_mismatched(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Element", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Mismatched(rctx, obj) @@ -516,20 +522,22 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph } func (ec *executionContext) _Query_path(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Path(rctx) @@ -547,19 +555,20 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_date(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_date_args(ctx, rawArgs) @@ -568,6 +577,7 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Date(rctx, args["filter"].(models.DateFilter)) @@ -588,20 +598,22 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Viewer(rctx) @@ -619,20 +631,22 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().JSONEncoding(rctx) @@ -653,19 +667,20 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph } func (ec *executionContext) _Query_error(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_error_args(ctx, rawArgs) @@ -674,6 +689,7 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Error(rctx, args["type"].(*models.ErrorType)) @@ -694,19 +710,20 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_complexity_args(ctx, rawArgs) @@ -715,6 +732,7 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Complexity(rctx, args["value"].(int)) @@ -735,19 +753,20 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -756,6 +775,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -773,20 +793,22 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -804,20 +826,22 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -838,20 +862,22 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _User_likes(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Likes(rctx, obj) @@ -872,20 +898,22 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.CollectedField, obj *models.Viewer) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "Viewer", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -903,20 +931,22 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -937,20 +967,22 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -968,20 +1000,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -1002,20 +1036,22 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1036,20 +1072,22 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1070,21 +1108,23 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) @@ -1101,20 +1141,22 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1135,20 +1177,22 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1166,20 +1210,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1200,20 +1246,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1231,20 +1279,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1265,20 +1315,22 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1299,20 +1351,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1333,20 +1387,22 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1364,20 +1420,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1398,20 +1456,22 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1429,20 +1489,22 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1463,20 +1525,22 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, Args: nil, IsMethod: false, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1494,20 +1558,22 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1528,20 +1594,22 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1562,20 +1630,22 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1593,20 +1663,22 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1624,20 +1696,22 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1658,20 +1732,22 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1692,20 +1768,22 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1723,20 +1801,22 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1754,19 +1834,20 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1775,6 +1856,7 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1792,20 +1874,22 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1823,20 +1907,22 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1854,19 +1940,20 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1875,6 +1962,7 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } rctx.Args = args + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1892,20 +1980,22 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1923,20 +2013,22 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, Args: nil, IsMethod: true, + Stats: graphql.FieldStats{Started: graphql.Now()}, } + defer func() { + rctx.Stats.Completed = graphql.Now() + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() ctx = graphql.WithResolverContext(ctx, rctx) + rctx.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil From 2898a622b48dd484e2c2365b9655f3b068ba524d Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Nov 2019 00:23:06 +1100 Subject: [PATCH 33/53] rename ResolverContext to FieldContext --- codegen/directives.gotpl | 4 +- codegen/field.gotpl | 14 +- codegen/generate.go | 2 +- codegen/object.gotpl | 6 +- codegen/testserver/generated.go | 1908 +++++++++-------- codegen/testserver/middleware_test.go | 2 +- codegen/type.gotpl | 9 +- example/chat/generated.go | 558 ++--- example/config/generated.go | 557 ++--- example/dataloader/generated.go | 635 +++--- example/fileupload/generated.go | 551 ++--- example/scalars/generated.go | 580 ++--- example/selection/generated.go | 538 ++--- example/selection/selection.go | 2 +- example/starwars/generated/exec.go | 930 ++++---- example/starwars/server/server.go | 2 +- example/todo/generated.go | 547 ++--- example/type-system-extension/directive.go | 12 +- example/type-system-extension/generated.go | 529 ++--- .../{context_resolver.go => context_field.go} | 20 +- ...resolver_test.go => context_field_test.go} | 10 +- graphql/context_operation.go | 4 +- graphql/context_response.go | 4 +- graphql/context_response_test.go | 16 +- graphql/error.go | 4 +- graphql/handler/apollotracing/tracer.go | 2 +- graphql/handler/testserver/testserver.go | 2 +- integration/generated.go | 582 ++--- integration/server/server.go | 2 +- 29 files changed, 4076 insertions(+), 3956 deletions(-) rename graphql/{context_resolver.go => context_field.go} (77%) rename graphql/{context_resolver_test.go => context_field_test.go} (62%) diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index bdfb5aa2f77..e6d2455f6c8 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -115,8 +115,8 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as {{ if .Directives.LocationDirectives "FIELD" }} func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { {{- if .Directives.LocationDirectives "FIELD" }} - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Directives { + fc := graphql.GetFieldContext(ctx) + for _, d := range fc.Field.Directives { switch d.Name { {{- range $directive := .Directives.LocationDirectives "FIELD" }} case "{{$directive.Name}}": diff --git a/codegen/field.gotpl b/codegen/field.gotpl index ea90d0ff84e..431028e097d 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -5,7 +5,7 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- if $object.Stream }} {{- $null = "nil" }} {{- end }} - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: {{$object.Name|quote}}, Field: field, Args: nil, @@ -13,13 +13,13 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func () { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = {{ $null }} } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) {{- if $field.Args }} rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.{{ $field.ArgsFunc }}(ctx,rawArgs) @@ -27,9 +27,9 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex ec.Error(ctx, err) return {{ $null }} } - rctx.Args = args + fc.Args = args {{- end }} - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Stats.ArgumentsCompleted = graphql.Now() {{- if $.Directives.LocationDirectives "FIELD" }} resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { {{ template "field" $field }} @@ -45,7 +45,7 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- end }} if resTmp == nil { {{- if $field.TypeReference.GQL.NonNull }} - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } {{- end }} @@ -67,7 +67,7 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex } {{- else }} res := resTmp.({{$field.TypeReference.GO | ref}}) - rctx.Result = res + fc.Result = res return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res) {{- end }} } diff --git a/codegen/generate.go b/codegen/generate.go index eafa3f87434..a32e329e60c 100644 --- a/codegen/generate.go +++ b/codegen/generate.go @@ -10,6 +10,6 @@ func GenerateCode(data *Data) error { Filename: data.Config.Exec.Filename, Data: data, RegionTags: true, - GeneratedHeader: true, + GeneratedHeader: false, }) } diff --git a/codegen/object.gotpl b/codegen/object.gotpl index 84a335989a7..8dfef7c6fa7 100644 --- a/codegen/object.gotpl +++ b/codegen/object.gotpl @@ -5,8 +5,9 @@ var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}} {{- if .Stream }} func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: {{$object.Name|quote}}, + Stats: graphql.FieldStats{Started: graphql.Now()}, }) if len(fields) != 1 { ec.Errorf(ctx, "must subscribe to exactly one stream") @@ -26,8 +27,9 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) {{if $object.Root}} - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: {{$object.Name|quote}}, + Stats: graphql.FieldStats{Started: graphql.Now()}, }) {{end}} diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index f75ac0b9b1b..5eca48f7cd2 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package testserver import ( @@ -2682,8 +2680,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region ************************** directives.gotpl ************************** func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Directives { + fc := graphql.GetFieldContext(ctx) + for _, d := range fc.Field.Directives { switch d.Name { case "logged": rawArgs := d.ArgumentMap(ec.Variables) @@ -2714,7 +2712,7 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "A", Field: field, Args: nil, @@ -2722,32 +2720,32 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.CollectedField, obj *AIt) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "AIt", Field: field, Args: nil, @@ -2755,32 +2753,32 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.CollectedField, obj *AbIt) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "AbIt", Field: field, Args: nil, @@ -2788,32 +2786,32 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Autobind", Field: field, Args: nil, @@ -2821,32 +2819,32 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Autobind", Field: field, Args: nil, @@ -2854,32 +2852,32 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int32, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int32) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int32(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Autobind", Field: field, Args: nil, @@ -2887,32 +2885,32 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int64, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int64) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int64(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Autobind", Field: field, Args: nil, @@ -2920,32 +2918,32 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdStr, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Autobind", Field: field, Args: nil, @@ -2953,32 +2951,32 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdInt, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNID2int(ctx, field.Selections, res) } func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedField, obj *B) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "B", Field: field, Args: nil, @@ -2986,32 +2984,32 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Circle", Field: field, Args: nil, @@ -3019,14 +3017,14 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Radius, nil @@ -3036,12 +3034,12 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Circle", Field: field, Args: nil, @@ -3049,14 +3047,14 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -3066,12 +3064,12 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Content_Post", Field: field, Args: nil, @@ -3079,14 +3077,14 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3096,12 +3094,12 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Content_User", Field: field, Args: nil, @@ -3109,14 +3107,14 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3126,12 +3124,12 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, field graphql.CollectedField, obj *EmbeddedDefaultScalar) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "EmbeddedDefaultScalar", Field: field, Args: nil, @@ -3139,14 +3137,14 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil @@ -3156,12 +3154,12 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalODefaultScalarImplementation2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "EmbeddedPointer", Field: field, Args: nil, @@ -3169,14 +3167,14 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3186,12 +3184,12 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "EmbeddedPointer", Field: field, Args: nil, @@ -3199,14 +3197,14 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Title, nil @@ -3216,12 +3214,12 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_id(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Error", Field: field, Args: nil, @@ -3229,32 +3227,32 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Error", Field: field, Args: nil, @@ -3262,14 +3260,14 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnNonRequiredField() @@ -3279,12 +3277,12 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Error", Field: field, Args: nil, @@ -3292,32 +3290,32 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnRequiredField() }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Error", Field: field, Args: nil, @@ -3325,32 +3323,32 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NilOnRequiredField(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalNString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Errors", Field: field, Args: nil, @@ -3358,32 +3356,32 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().A(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) - rctx.Result = res + fc.Result = res return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Errors", Field: field, Args: nil, @@ -3391,32 +3389,32 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().B(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) - rctx.Result = res + fc.Result = res return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Errors", Field: field, Args: nil, @@ -3424,32 +3422,32 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().C(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) - rctx.Result = res + fc.Result = res return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Errors", Field: field, Args: nil, @@ -3457,32 +3455,32 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().D(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) - rctx.Result = res + fc.Result = res return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Errors", Field: field, Args: nil, @@ -3490,32 +3488,32 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().E(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Error) - rctx.Result = res + fc.Result = res return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field graphql.CollectedField, obj *ForcedResolver) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ForcedResolver", Field: field, Args: nil, @@ -3523,14 +3521,14 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ForcedResolver().Field(rctx, obj) @@ -3540,12 +3538,12 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra return graphql.Null } res := resTmp.(*Circle) - rctx.Result = res + fc.Result = res return ec.marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐCircle(ctx, field.Selections, res) } func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.CollectedField, obj *InnerObject) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "InnerObject", Field: field, Args: nil, @@ -3553,32 +3551,32 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field graphql.CollectedField, obj *invalid_packagename.InvalidIdentifier) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "InvalidIdentifier", Field: field, Args: nil, @@ -3586,32 +3584,32 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedField, obj *introspection1.It) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "It", Field: field, Args: nil, @@ -3619,32 +3617,32 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.CollectedField, obj *LoopA) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "LoopA", Field: field, Args: nil, @@ -3652,32 +3650,32 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.B, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*LoopB) - rctx.Result = res + fc.Result = res return ec.marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopB(ctx, field.Selections, res) } func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.CollectedField, obj *LoopB) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "LoopB", Field: field, Args: nil, @@ -3685,32 +3683,32 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.A, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*LoopA) - rctx.Result = res + fc.Result = res return ec.marshalNLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopA(ctx, field.Selections, res) } func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Map", Field: field, Args: nil, @@ -3718,32 +3716,32 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MapStringInterfaceType", Field: field, Args: nil, @@ -3751,14 +3749,14 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["a"].(type) { @@ -3777,12 +3775,12 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MapStringInterfaceType", Field: field, Args: nil, @@ -3790,14 +3788,14 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["b"].(type) { @@ -3816,12 +3814,12 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field return graphql.Null } res := resTmp.(*int) - rctx.Result = res + fc.Result = res return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ModelMethods", Field: field, Args: nil, @@ -3829,32 +3827,32 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ModelMethods().ResolverField(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ModelMethods", Field: field, Args: nil, @@ -3862,32 +3860,32 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NoContext(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ModelMethods", Field: field, Args: nil, @@ -3895,32 +3893,32 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.WithContext(ctx), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ObjectDirectives", Field: field, Args: nil, @@ -3928,14 +3926,14 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -3974,18 +3972,18 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ObjectDirectives", Field: field, Args: nil, @@ -3993,14 +3991,14 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4030,12 +4028,12 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectivesWithCustomGoModel) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ObjectDirectivesWithCustomGoModel", Field: field, Args: nil, @@ -4043,14 +4041,14 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4080,12 +4078,12 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphql.CollectedField, obj *OuterObject) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "OuterObject", Field: field, Args: nil, @@ -4093,32 +4091,32 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Inner, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*InnerObject) - rctx.Result = res + fc.Result = res return ec.marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerObject(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "OverlappingFields", Field: field, Args: nil, @@ -4126,32 +4124,32 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "OverlappingFields", Field: field, Args: nil, @@ -4159,32 +4157,32 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "OverlappingFields", Field: field, Args: nil, @@ -4192,32 +4190,32 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "OverlappingFields", Field: field, Args: nil, @@ -4225,32 +4223,32 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "OverlappingFields", Field: field, Args: nil, @@ -4258,32 +4256,32 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Panics", Field: field, Args: nil, @@ -4291,32 +4289,32 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]MarshalPanic) - rctx.Result = res + fc.Result = res return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, field.Selections, res) } func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Panics", Field: field, Args: nil, @@ -4324,39 +4322,39 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Panics_fieldFuncMarshal_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FieldFuncMarshal(ctx, args["u"].([]MarshalPanic)), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]MarshalPanic) - rctx.Result = res + fc.Result = res return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, field.Selections, res) } func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Panics", Field: field, Args: nil, @@ -4364,39 +4362,39 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Panics_argUnmarshal_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, args["u"].([]MarshalPanic)) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Primitive", Field: field, Args: nil, @@ -4404,32 +4402,32 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Primitive().Value(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Primitive", Field: field, Args: nil, @@ -4437,32 +4435,32 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Squared(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "PrimitiveString", Field: field, Args: nil, @@ -4470,32 +4468,32 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Value(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "PrimitiveString", Field: field, Args: nil, @@ -4503,32 +4501,32 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Doubled(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "PrimitiveString", Field: field, Args: nil, @@ -4536,32 +4534,32 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Len(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4569,14 +4567,14 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InvalidIdentifier(rctx) @@ -4586,12 +4584,12 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field return graphql.Null } res := resTmp.(*invalid_packagename.InvalidIdentifier) - rctx.Result = res + fc.Result = res return ec.marshalOInvalidIdentifier2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋinvalidᚑpackagenameᚐInvalidIdentifier(ctx, field.Selections, res) } func (ec *executionContext) _Query_collision(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4599,14 +4597,14 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Collision(rctx) @@ -4616,12 +4614,12 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. return graphql.Null } res := resTmp.(*introspection1.It) - rctx.Result = res + fc.Result = res return ec.marshalOIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋintrospectionᚐIt(ctx, field.Selections, res) } func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4629,21 +4627,21 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapInput_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapInput(rctx, args["input"].(map[string]interface{})) @@ -4653,12 +4651,12 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*bool) - rctx.Result = res + fc.Result = res return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4666,21 +4664,21 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_recursive_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Recursive(rctx, args["input"].(*RecursiveInputSlice)) @@ -4690,12 +4688,12 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. return graphql.Null } res := resTmp.(*bool) - rctx.Result = res + fc.Result = res return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4703,21 +4701,21 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_nestedInputs_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedInputs(rctx, args["input"].([][]*OuterInput)) @@ -4727,12 +4725,12 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph return graphql.Null } res := resTmp.(*bool) - rctx.Result = res + fc.Result = res return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4740,14 +4738,14 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedOutputs(rctx) @@ -4757,12 +4755,12 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap return graphql.Null } res := resTmp.([][]*OuterObject) - rctx.Result = res + fc.Result = res return ec.marshalOOuterObject2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterObject(ctx, field.Selections, res) } func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4770,14 +4768,14 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ModelMethods(rctx) @@ -4787,12 +4785,12 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph return graphql.Null } res := resTmp.(*ModelMethods) - rctx.Result = res + fc.Result = res return ec.marshalOModelMethods2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐModelMethods(ctx, field.Selections, res) } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4800,39 +4798,39 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_user_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(int)) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*User) - rctx.Result = res + fc.Result = res return ec.marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4840,21 +4838,21 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_nullableArg_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NullableArg(rctx, args["arg"].(*int)) @@ -4864,12 +4862,12 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4877,39 +4875,39 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_inputSlice_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InputSlice(rctx, args["arg"].([]string)) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4917,32 +4915,32 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ShapeUnion(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(ShapeUnion) - rctx.Result = res + fc.Result = res return ec.marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShapeUnion(ctx, field.Selections, res) } func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4950,14 +4948,14 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Autobind(rctx) @@ -4967,12 +4965,12 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*Autobind) - rctx.Result = res + fc.Result = res return ec.marshalOAutobind2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐAutobind(ctx, field.Selections, res) } func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -4980,32 +4978,32 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DeprecatedField(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5013,14 +5011,14 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Overlapping(rctx) @@ -5030,12 +5028,12 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq return graphql.Null } res := resTmp.(*OverlappingFields) - rctx.Result = res + fc.Result = res return ec.marshalOOverlappingFields2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOverlappingFields(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5043,21 +5041,21 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveArg_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveArg(rctx, args["arg"].(string)) @@ -5067,12 +5065,12 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5080,21 +5078,21 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveNullableArg_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -5104,12 +5102,12 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5117,21 +5115,21 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInputNullable_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputNullable(rctx, args["arg"].(*InputDirectives)) @@ -5141,12 +5139,12 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5154,21 +5152,21 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInput_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInput(rctx, args["arg"].(InputDirectives)) @@ -5178,12 +5176,12 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5191,21 +5189,21 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInputType_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputType(rctx, args["arg"].(InnerInput)) @@ -5215,12 +5213,12 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5228,14 +5226,14 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObject(rctx) @@ -5245,12 +5243,12 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr return graphql.Null } res := resTmp.(*ObjectDirectives) - rctx.Result = res + fc.Result = res return ec.marshalOObjectDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐObjectDirectives(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5258,14 +5256,14 @@ func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObjectWithCustomGoModel(rctx) @@ -5275,12 +5273,12 @@ func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context. return graphql.Null } res := resTmp.(*ObjectDirectivesWithCustomGoModel) - rctx.Result = res + fc.Result = res return ec.marshalOObjectDirectivesWithCustomGoModel2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐObjectDirectivesWithCustomGoModel(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5288,21 +5286,21 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveFieldDef_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5337,18 +5335,18 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5356,14 +5354,14 @@ func (ec *executionContext) _Query_directiveField(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveField(rctx) @@ -5373,12 +5371,12 @@ func (ec *executionContext) _Query_directiveField(ctx context.Context, field gra return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5386,14 +5384,14 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5429,12 +5427,12 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5442,14 +5440,14 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5479,12 +5477,12 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5492,14 +5490,14 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Shapes(rctx) @@ -5509,12 +5507,12 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.([]Shape) - rctx.Result = res + fc.Result = res return ec.marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) } func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5522,14 +5520,14 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5559,12 +5557,12 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(Shape) - rctx.Result = res + fc.Result = res return ec.marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) } func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5572,21 +5570,21 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapStringInterface_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapStringInterface(rctx, args["in"].(map[string]interface{})) @@ -5596,12 +5594,12 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field return graphql.Null } res := resTmp.(map[string]interface{}) - rctx.Result = res + fc.Result = res return ec.marshalOMapStringInterfaceType2map(ctx, field.Selections, res) } func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5609,21 +5607,21 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapNestedStringInterface_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapNestedStringInterface(rctx, args["in"].(*NestedMapInput)) @@ -5633,12 +5631,12 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, return graphql.Null } res := resTmp.(map[string]interface{}) - rctx.Result = res + fc.Result = res return ec.marshalOMapStringInterfaceType2map(ctx, field.Selections, res) } func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5646,14 +5644,14 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ErrorBubble(rctx) @@ -5663,12 +5661,12 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq return graphql.Null } res := resTmp.(*Error) - rctx.Result = res + fc.Result = res return ec.marshalOError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5676,14 +5674,14 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Errors(rctx) @@ -5693,12 +5691,12 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*Errors) - rctx.Result = res + fc.Result = res return ec.marshalOErrors2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrors(ctx, field.Selections, res) } func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5706,32 +5704,32 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Valid(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5739,14 +5737,14 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Panics(rctx) @@ -5756,12 +5754,12 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*Panics) - rctx.Result = res + fc.Result = res return ec.marshalOPanics2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPanics(ctx, field.Selections, res) } func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5769,32 +5767,32 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveObject(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]Primitive) - rctx.Result = res + fc.Result = res return ec.marshalNPrimitive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitive(ctx, field.Selections, res) } func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5802,32 +5800,32 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveStringObject(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]PrimitiveString) - rctx.Result = res + fc.Result = res return ec.marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitiveString(ctx, field.Selections, res) } func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5835,39 +5833,39 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_defaultScalar_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DefaultScalar(rctx, args["arg"].(string)) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNDefaultScalarImplementation2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5875,14 +5873,14 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Slices(rctx) @@ -5892,12 +5890,12 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*Slices) - rctx.Result = res + fc.Result = res return ec.marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSlices(ctx, field.Selections, res) } func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5905,32 +5903,32 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ScalarSlice(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]byte) - rctx.Result = res + fc.Result = res return ec.marshalNBytes2ᚕbyte(ctx, field.Selections, res) } func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5938,39 +5936,39 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_fallback_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Fallback(rctx, args["arg"].(FallbackToStringEncoding)) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(FallbackToStringEncoding) - rctx.Result = res + fc.Result = res return ec.marshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, field.Selections, res) } func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -5978,14 +5976,14 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().OptionalUnion(rctx) @@ -5995,12 +5993,12 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap return graphql.Null } res := resTmp.(TestUnion) - rctx.Result = res + fc.Result = res return ec.marshalOTestUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐTestUnion(ctx, field.Selections, res) } func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -6008,14 +6006,14 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ValidType(rctx) @@ -6025,12 +6023,12 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. return graphql.Null } res := resTmp.(*ValidType) - rctx.Result = res + fc.Result = res return ec.marshalOValidType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidType(ctx, field.Selections, res) } func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -6038,32 +6036,32 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedStruct(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*WrappedStruct) - rctx.Result = res + fc.Result = res return ec.marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx, field.Selections, res) } func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -6071,32 +6069,32 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedScalar(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(WrappedScalar) - rctx.Result = res + fc.Result = res return ec.marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -6104,21 +6102,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -6128,12 +6126,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -6141,14 +6139,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -6158,12 +6156,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Rectangle", Field: field, Args: nil, @@ -6171,14 +6169,14 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Length, nil @@ -6188,12 +6186,12 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Rectangle", Field: field, Args: nil, @@ -6201,14 +6199,14 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Width, nil @@ -6218,12 +6216,12 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Rectangle", Field: field, Args: nil, @@ -6231,14 +6229,14 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -6248,12 +6246,12 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Slices", Field: field, Args: nil, @@ -6261,14 +6259,14 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test1, nil @@ -6278,12 +6276,12 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.([]*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚕᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Slices", Field: field, Args: nil, @@ -6291,14 +6289,14 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test2, nil @@ -6308,12 +6306,12 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Slices", Field: field, Args: nil, @@ -6321,32 +6319,32 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test3, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*string) - rctx.Result = res + fc.Result = res return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Slices", Field: field, Args: nil, @@ -6354,32 +6352,32 @@ func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test4, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalNString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Subscription_updated(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -6387,21 +6385,21 @@ func (ec *executionContext) _Subscription_updated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().Updated(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return nil @@ -6422,7 +6420,7 @@ func (ec *executionContext) _Subscription_updated(ctx context.Context, field gra } func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -6430,21 +6428,21 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().InitPayload(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return nil @@ -6465,7 +6463,7 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field } func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -6473,21 +6471,21 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_directiveArg_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return nil } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveArg(rctx, args["arg"].(string)) @@ -6512,7 +6510,7 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel } func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -6520,21 +6518,21 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_directiveNullableArg_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return nil } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -6559,7 +6557,7 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte } func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -6567,14 +6565,14 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6625,7 +6623,7 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f } func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -6633,14 +6631,14 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6685,7 +6683,7 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -6693,32 +6691,32 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _User_friends(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -6726,32 +6724,32 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Friends(rctx, obj) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*User) - rctx.Result = res + fc.Result = res return ec.marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -6759,32 +6757,32 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -6792,14 +6790,14 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Updated, nil @@ -6809,12 +6807,12 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*time.Time) - rctx.Result = res + fc.Result = res return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ValidType", Field: field, Args: nil, @@ -6822,32 +6820,32 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCase, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ValidType", Field: field, Args: nil, @@ -6855,32 +6853,32 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCaseOld, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ValidType", Field: field, Args: nil, @@ -6888,39 +6886,39 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_ValidType_validInputKeywords_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidInputKeywords, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "ValidType", Field: field, Args: nil, @@ -6928,39 +6926,39 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_ValidType_validArgs_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidArgs, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "WrappedStruct", Field: field, Args: nil, @@ -6968,32 +6966,32 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "XXIt", Field: field, Args: nil, @@ -7001,32 +6999,32 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.CollectedField, obj *XxIt) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "XxIt", Field: field, Args: nil, @@ -7034,32 +7032,32 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -7067,32 +7065,32 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -7100,14 +7098,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7117,12 +7115,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -7130,32 +7128,32 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -7163,32 +7161,32 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -7196,32 +7194,32 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -7229,14 +7227,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7246,12 +7244,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -7259,32 +7257,32 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -7292,14 +7290,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7309,12 +7307,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -7322,32 +7320,32 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -7355,14 +7353,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7372,12 +7370,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -7385,32 +7383,32 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -7418,32 +7416,32 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -7451,32 +7449,32 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -7484,14 +7482,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7501,12 +7499,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -7514,32 +7512,32 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -7547,14 +7545,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7564,12 +7562,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -7577,32 +7575,32 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -7610,14 +7608,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -7627,12 +7625,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -7640,32 +7638,32 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -7673,32 +7671,32 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -7706,14 +7704,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -7723,12 +7721,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -7736,14 +7734,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -7753,12 +7751,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -7766,32 +7764,32 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7799,32 +7797,32 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7832,14 +7830,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -7849,12 +7847,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7862,14 +7860,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -7879,12 +7877,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7892,21 +7890,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -7916,12 +7914,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7929,14 +7927,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -7946,12 +7944,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7959,14 +7957,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -7976,12 +7974,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -7989,21 +7987,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -8013,12 +8011,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -8026,14 +8024,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -8043,12 +8041,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -8056,14 +8054,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -8073,12 +8071,12 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.CollectedField, obj *AsdfIt) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "asdfIt", Field: field, Args: nil, @@ -8086,32 +8084,32 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.CollectedField, obj *IIt) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "iIt", Field: field, Args: nil, @@ -8119,27 +8117,27 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } @@ -9588,8 +9586,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -10193,8 +10192,9 @@ var subscriptionImplementors = []string{"Subscription"} func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Subscription", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) if len(fields) != 1 { ec.Errorf(ctx, "must subscribe to exactly one stream") @@ -10696,7 +10696,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10710,7 +10710,7 @@ func (ec *executionContext) unmarshalNBytes2ᚕbyte(ctx context.Context, v inter func (ec *executionContext) marshalNBytes2ᚕbyte(ctx context.Context, sel ast.SelectionSet, v []byte) graphql.Marshaler { res := MarshalBytes(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10724,7 +10724,7 @@ func (ec *executionContext) unmarshalNDefaultScalarImplementation2string(ctx con func (ec *executionContext) marshalNDefaultScalarImplementation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10737,7 +10737,7 @@ func (ec *executionContext) marshalNError2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx context.Context, sel ast.SelectionSet, v *Error) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -10753,7 +10753,7 @@ func (ec *executionContext) unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99 func (ec *executionContext) marshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx context.Context, sel ast.SelectionSet, v FallbackToStringEncoding) graphql.Marshaler { res := graphql.MarshalString(string(v)) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10767,7 +10767,7 @@ func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalIntID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10781,7 +10781,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10818,7 +10818,7 @@ func (ec *executionContext) marshalNInnerObject2githubᚗcomᚋ99designsᚋgqlge func (ec *executionContext) marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerObject(ctx context.Context, sel ast.SelectionSet, v *InnerObject) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -10837,7 +10837,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10851,7 +10851,7 @@ func (ec *executionContext) unmarshalNInt2int32(ctx context.Context, v interface func (ec *executionContext) marshalNInt2int32(ctx context.Context, sel ast.SelectionSet, v int32) graphql.Marshaler { res := graphql.MarshalInt32(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10865,7 +10865,7 @@ func (ec *executionContext) unmarshalNInt2int64(ctx context.Context, v interface func (ec *executionContext) marshalNInt2int64(ctx context.Context, sel ast.SelectionSet, v int64) graphql.Marshaler { res := graphql.MarshalInt64(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -10878,7 +10878,7 @@ func (ec *executionContext) marshalNLoopA2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) marshalNLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopA(ctx context.Context, sel ast.SelectionSet, v *LoopA) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -10892,7 +10892,7 @@ func (ec *executionContext) marshalNLoopB2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopB(ctx context.Context, sel ast.SelectionSet, v *LoopB) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -10951,11 +10951,12 @@ func (ec *executionContext) marshalNPrimitive2ᚕgithubᚗcomᚋ99designsᚋgqlg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -10992,11 +10993,12 @@ func (ec *executionContext) marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designs } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11026,7 +11028,7 @@ func (ec *executionContext) unmarshalNRecursiveInputSlice2githubᚗcomᚋ99desig func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShapeUnion(ctx context.Context, sel ast.SelectionSet, v ShapeUnion) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11041,7 +11043,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11116,7 +11118,7 @@ func (ec *executionContext) unmarshalNString2ᚖstring(ctx context.Context, v in func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11131,7 +11133,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11145,7 +11147,7 @@ func (ec *executionContext) unmarshalNUUID2string(ctx context.Context, v interfa func (ec *executionContext) marshalNUUID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11165,11 +11167,12 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11195,7 +11198,7 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx context.Context, sel ast.SelectionSet, v *User) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11211,7 +11214,7 @@ func (ec *executionContext) unmarshalNWrappedScalar2githubᚗcomᚋ99designsᚋg func (ec *executionContext) marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx context.Context, sel ast.SelectionSet, v WrappedScalar) graphql.Marshaler { res := graphql.MarshalString(string(v)) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11224,7 +11227,7 @@ func (ec *executionContext) marshalNWrappedStruct2githubᚗcomᚋ99designsᚋgql func (ec *executionContext) marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx context.Context, sel ast.SelectionSet, v *WrappedStruct) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11245,11 +11248,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11280,7 +11284,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11316,11 +11320,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11365,11 +11370,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11406,11 +11412,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11436,7 +11443,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -11451,7 +11458,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -11759,11 +11766,12 @@ func (ec *executionContext) marshalOOuterObject2ᚕᚕᚖgithubᚗcomᚋ99design } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11799,11 +11807,12 @@ func (ec *executionContext) marshalOOuterObject2ᚕᚖgithubᚗcomᚋ99designs } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -11907,11 +11916,12 @@ func (ec *executionContext) marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -12121,11 +12131,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -12161,11 +12172,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -12201,11 +12213,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -12256,11 +12269,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/codegen/testserver/middleware_test.go b/codegen/testserver/middleware_test.go index ebfd0b217b9..13d0ce84e42 100644 --- a/codegen/testserver/middleware_test.go +++ b/codegen/testserver/middleware_test.go @@ -38,7 +38,7 @@ func TestMiddleware(t *testing.T) { return next(context.WithValue(ctx, "path", append(path, 2))) }), handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - areMethods = append(areMethods, graphql.GetResolverContext(ctx).IsMethod) + areMethods = append(areMethods, graphql.GetFieldContext(ctx).IsMethod) return next(ctx) }), ) diff --git a/codegen/type.gotpl b/codegen/type.gotpl index 11425c30f2e..b0274fc16e0 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -50,7 +50,7 @@ {{- if $type.IsNilable }} if v == nil { {{- if $type.GQL.NonNull }} - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } {{- end }} @@ -75,11 +75,12 @@ for i := range v { {{- if not $type.IsScalar }} i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -113,7 +114,7 @@ {{- else if $type.GQL.NonNull }} res := {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}(v){{else}}v{{- end }}) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } diff --git a/example/chat/generated.go b/example/chat/generated.go index 028127920e0..87928f53f1f 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package chat import ( @@ -450,7 +448,7 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as // region **************************** field.gotpl ***************************** func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Chatroom", Field: field, Args: nil, @@ -458,14 +456,14 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -475,18 +473,18 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Chatroom", Field: field, Args: nil, @@ -494,14 +492,14 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Messages, nil @@ -511,18 +509,18 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]Message) - rctx.Result = res + fc.Result = res return ec.marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) } func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Message", Field: field, Args: nil, @@ -530,14 +528,14 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -547,18 +545,18 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Message", Field: field, Args: nil, @@ -566,14 +564,14 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -583,18 +581,18 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Message", Field: field, Args: nil, @@ -602,14 +600,14 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedBy, nil @@ -619,18 +617,18 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Message", Field: field, Args: nil, @@ -638,14 +636,14 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil @@ -655,18 +653,18 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -674,21 +672,21 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_post_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().Post(rctx, args["text"].(string), args["username"].(string), args["roomName"].(string)) @@ -698,18 +696,18 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Message) - rctx.Result = res + fc.Result = res return ec.marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) } func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -717,21 +715,21 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_room_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Room(rctx, args["name"].(string)) @@ -744,12 +742,12 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle return graphql.Null } res := resTmp.(*Chatroom) - rctx.Result = res + fc.Result = res return ec.marshalOChatroom2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐChatroom(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -757,21 +755,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -784,12 +782,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -797,14 +795,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -817,12 +815,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Subscription", Field: field, Args: nil, @@ -830,21 +828,21 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_messageAdded_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return nil } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().MessageAdded(rctx, args["roomName"].(string)) @@ -854,7 +852,7 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel return nil } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return nil @@ -875,7 +873,7 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -883,14 +881,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -900,18 +898,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -919,14 +917,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -939,12 +937,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -952,14 +950,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -969,18 +967,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -988,14 +986,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1005,18 +1003,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1024,14 +1022,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1041,18 +1039,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1060,14 +1058,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1080,12 +1078,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1093,14 +1091,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1110,18 +1108,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1129,14 +1127,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1149,12 +1147,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1162,14 +1160,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1179,18 +1177,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1198,14 +1196,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1218,12 +1216,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1231,14 +1229,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1248,18 +1246,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1267,14 +1265,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1284,18 +1282,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1303,14 +1301,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1320,18 +1318,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1339,14 +1337,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1359,12 +1357,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1372,14 +1370,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1389,18 +1387,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1408,14 +1406,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1428,12 +1426,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1441,14 +1439,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1458,18 +1456,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1477,14 +1475,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1497,12 +1495,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1510,14 +1508,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1527,18 +1525,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1546,14 +1544,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1563,18 +1561,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1582,14 +1580,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1602,12 +1600,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1615,14 +1613,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1635,12 +1633,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1648,14 +1646,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1665,18 +1663,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1684,14 +1682,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1701,18 +1699,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1720,14 +1718,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1740,12 +1738,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1753,14 +1751,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1773,12 +1771,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1786,21 +1784,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1813,12 +1811,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1826,14 +1824,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1846,12 +1844,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1859,14 +1857,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1879,12 +1877,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1892,21 +1890,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1919,12 +1917,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1932,14 +1930,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1952,12 +1950,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1965,14 +1963,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1985,7 +1983,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2080,8 +2078,9 @@ var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2111,8 +2110,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2151,8 +2151,9 @@ var subscriptionImplementors = []string{"Subscription"} func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Subscription", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) if len(fields) != 1 { ec.Errorf(ctx, "must subscribe to exactly one stream") @@ -2419,7 +2420,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2433,7 +2434,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2453,11 +2454,12 @@ func (ec *executionContext) marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2483,7 +2485,7 @@ func (ec *executionContext) marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx context.Context, sel ast.SelectionSet, v *Message) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2498,7 +2500,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2512,7 +2514,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2532,11 +2534,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2567,7 +2570,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2603,11 +2606,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2652,11 +2656,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2693,11 +2698,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2723,7 +2729,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2738,7 +2744,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2814,11 +2820,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2854,11 +2861,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2894,11 +2902,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2949,11 +2958,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/config/generated.go b/example/config/generated.go index a5d195c1de0..dea8fafc91b 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package config import ( @@ -324,7 +322,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -332,21 +330,21 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_createTodo_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateTodo(rctx, args["input"].(NewTodo)) @@ -356,18 +354,18 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -375,14 +373,14 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Todos(rctx) @@ -392,18 +390,18 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*Todo) - rctx.Result = res + fc.Result = res return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -411,21 +409,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -438,12 +436,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -451,14 +449,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -471,12 +469,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -484,14 +482,14 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Todo().ID(rctx, obj) @@ -501,18 +499,18 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -520,14 +518,14 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DatabaseID, nil @@ -537,18 +535,18 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -556,14 +554,14 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -573,18 +571,18 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -592,14 +590,14 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Done, nil @@ -609,18 +607,18 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -628,14 +626,14 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -645,18 +643,18 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*User) - rctx.Result = res + fc.Result = res return ec.marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -664,14 +662,14 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -681,18 +679,18 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -700,14 +698,14 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FullName(), nil @@ -717,18 +715,18 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -736,14 +734,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -753,18 +751,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -772,14 +770,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -792,12 +790,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -805,14 +803,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -822,18 +820,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -841,14 +839,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -858,18 +856,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -877,14 +875,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -894,18 +892,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -913,14 +911,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -933,12 +931,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -946,14 +944,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -963,18 +961,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -982,14 +980,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1002,12 +1000,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1015,14 +1013,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1032,18 +1030,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1051,14 +1049,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1071,12 +1069,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1084,14 +1082,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1101,18 +1099,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1120,14 +1118,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1137,18 +1135,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1156,14 +1154,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1173,18 +1171,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1192,14 +1190,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1212,12 +1210,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1225,14 +1223,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1242,18 +1240,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1261,14 +1259,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1281,12 +1279,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1294,14 +1292,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1311,18 +1309,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1330,14 +1328,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1350,12 +1348,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1363,14 +1361,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1380,18 +1378,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1399,14 +1397,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1416,18 +1414,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1435,14 +1433,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1455,12 +1453,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1468,14 +1466,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1488,12 +1486,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1501,14 +1499,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1518,18 +1516,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1537,14 +1535,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1554,18 +1552,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1573,14 +1571,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1593,12 +1591,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1606,14 +1604,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1626,12 +1624,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1639,21 +1637,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1666,12 +1664,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1679,14 +1677,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1699,12 +1697,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1712,14 +1710,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1732,12 +1730,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1745,21 +1743,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1772,12 +1770,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1785,14 +1783,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1805,12 +1803,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1818,14 +1816,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1838,7 +1836,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -1883,8 +1881,9 @@ var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1914,8 +1913,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2293,7 +2293,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2307,7 +2307,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2321,7 +2321,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2339,7 +2339,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2359,11 +2359,12 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2389,7 +2390,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx context.Context, sel ast.SelectionSet, v *Todo) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2403,7 +2404,7 @@ func (ec *executionContext) marshalNUser2githubᚗcomᚋ99designsᚋgqlgenᚋexa func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐUser(ctx context.Context, sel ast.SelectionSet, v *User) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2424,11 +2425,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2459,7 +2461,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2495,11 +2497,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2544,11 +2547,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2585,11 +2589,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2615,7 +2620,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2630,7 +2635,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2727,11 +2732,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2767,11 +2773,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2807,11 +2814,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2862,11 +2870,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 9edf2bb8447..10500847fc6 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package dataloader import ( @@ -386,7 +384,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Address", Field: field, Args: nil, @@ -394,14 +392,14 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -411,18 +409,18 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Address_street(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Address", Field: field, Args: nil, @@ -430,14 +428,14 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Street, nil @@ -447,18 +445,18 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Address_country(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Address", Field: field, Args: nil, @@ -466,14 +464,14 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Country, nil @@ -483,18 +481,18 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Customer", Field: field, Args: nil, @@ -502,14 +500,14 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -519,18 +517,18 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Customer", Field: field, Args: nil, @@ -538,14 +536,14 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -555,18 +553,18 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Customer_address(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Customer", Field: field, Args: nil, @@ -574,14 +572,14 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Address(rctx, obj) @@ -594,12 +592,12 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*Address) - rctx.Result = res + fc.Result = res return ec.marshalOAddress2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐAddress(ctx, field.Selections, res) } func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Customer", Field: field, Args: nil, @@ -607,14 +605,14 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Orders(rctx, obj) @@ -627,12 +625,12 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. return graphql.Null } res := resTmp.([]*Order) - rctx.Result = res + fc.Result = res return ec.marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐOrder(ctx, field.Selections, res) } func (ec *executionContext) _Item_name(ctx context.Context, field graphql.CollectedField, obj *Item) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Item", Field: field, Args: nil, @@ -640,14 +638,14 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -657,18 +655,18 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Order_id(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Order", Field: field, Args: nil, @@ -676,14 +674,14 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -693,18 +691,18 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Order_date(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Order", Field: field, Args: nil, @@ -712,14 +710,14 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Date, nil @@ -729,18 +727,18 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Order", Field: field, Args: nil, @@ -748,14 +746,14 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Amount, nil @@ -765,18 +763,18 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalNFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Order_items(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Order", Field: field, Args: nil, @@ -784,14 +782,14 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Order().Items(rctx, obj) @@ -804,12 +802,12 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.([]*Item) - rctx.Result = res + fc.Result = res return ec.marshalOItem2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐItem(ctx, field.Selections, res) } func (ec *executionContext) _Query_customers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -817,14 +815,14 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Customers(rctx) @@ -837,12 +835,12 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. return graphql.Null } res := resTmp.([]*Customer) - rctx.Result = res + fc.Result = res return ec.marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -850,21 +848,21 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_torture1d_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture1d(rctx, args["customerIds"].([]int)) @@ -877,12 +875,12 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. return graphql.Null } res := resTmp.([]*Customer) - rctx.Result = res + fc.Result = res return ec.marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -890,21 +888,21 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_torture2d_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture2d(rctx, args["customerIds"].([][]int)) @@ -917,12 +915,12 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. return graphql.Null } res := resTmp.([][]*Customer) - rctx.Result = res + fc.Result = res return ec.marshalOCustomer2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -930,21 +928,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -957,12 +955,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -970,14 +968,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -990,12 +988,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -1003,14 +1001,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1020,18 +1018,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -1039,14 +1037,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1059,12 +1057,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -1072,14 +1070,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -1089,18 +1087,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -1108,14 +1106,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1125,18 +1123,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1144,14 +1142,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1161,18 +1159,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1180,14 +1178,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1200,12 +1198,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1213,14 +1211,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1230,18 +1228,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1249,14 +1247,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1269,12 +1267,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1282,14 +1280,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1299,18 +1297,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1318,14 +1316,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1338,12 +1336,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1351,14 +1349,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1368,18 +1366,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1387,14 +1385,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1404,18 +1402,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1423,14 +1421,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1440,18 +1438,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1459,14 +1457,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1479,12 +1477,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1492,14 +1490,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1509,18 +1507,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1528,14 +1526,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1548,12 +1546,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1561,14 +1559,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1578,18 +1576,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1597,14 +1595,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1617,12 +1615,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1630,14 +1628,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1647,18 +1645,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1666,14 +1664,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1683,18 +1681,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1702,14 +1700,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1722,12 +1720,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1735,14 +1733,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1755,12 +1753,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1768,14 +1766,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1785,18 +1783,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1804,14 +1802,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1821,18 +1819,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1840,14 +1838,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1860,12 +1858,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1873,14 +1871,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1893,12 +1891,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1906,21 +1904,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1933,12 +1931,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1946,14 +1944,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1966,12 +1964,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1979,14 +1977,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1999,12 +1997,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -2012,21 +2010,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -2039,12 +2037,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -2052,14 +2050,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2072,12 +2070,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -2085,14 +2083,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2105,7 +2103,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2292,8 +2290,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2602,7 +2601,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2615,7 +2614,7 @@ func (ec *executionContext) marshalNCustomer2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNCustomer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx context.Context, sel ast.SelectionSet, v *Customer) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2630,7 +2629,7 @@ func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v inter func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { res := graphql.MarshalFloat(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2644,7 +2643,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2657,7 +2656,7 @@ func (ec *executionContext) marshalNItem2githubᚗcomᚋ99designsᚋgqlgenᚋexa func (ec *executionContext) marshalNItem2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐItem(ctx context.Context, sel ast.SelectionSet, v *Item) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2671,7 +2670,7 @@ func (ec *executionContext) marshalNOrder2githubᚗcomᚋ99designsᚋgqlgenᚋex func (ec *executionContext) marshalNOrder2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐOrder(ctx context.Context, sel ast.SelectionSet, v *Order) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2686,7 +2685,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2700,7 +2699,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2720,11 +2719,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2755,7 +2755,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2791,11 +2791,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2840,11 +2841,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2881,11 +2883,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2911,7 +2914,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2926,7 +2929,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2979,11 +2982,12 @@ func (ec *executionContext) marshalOCustomer2ᚕᚕᚖgithubᚗcomᚋ99designs } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3019,11 +3023,12 @@ func (ec *executionContext) marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3123,11 +3128,12 @@ func (ec *executionContext) marshalOItem2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3163,11 +3169,12 @@ func (ec *executionContext) marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlge } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3226,11 +3233,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3266,11 +3274,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3306,11 +3315,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3361,11 +3371,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 508239c88c0..221b473e638 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package fileupload import ( @@ -369,7 +367,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "File", Field: field, Args: nil, @@ -377,14 +375,14 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -394,18 +392,18 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _File_name(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "File", Field: field, Args: nil, @@ -413,14 +411,14 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -430,18 +428,18 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _File_content(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "File", Field: field, Args: nil, @@ -449,14 +447,14 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Content, nil @@ -466,18 +464,18 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -485,21 +483,21 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_singleUpload_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUpload(rctx, args["file"].(graphql.Upload)) @@ -509,18 +507,18 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*model.File) - rctx.Result = res + fc.Result = res return ec.marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -528,21 +526,21 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_singleUploadWithPayload_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUploadWithPayload(rctx, args["req"].(model.UploadFile)) @@ -552,18 +550,18 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*model.File) - rctx.Result = res + fc.Result = res return ec.marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -571,21 +569,21 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_multipleUpload_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUpload(rctx, args["files"].([]*graphql.Upload)) @@ -595,18 +593,18 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*model.File) - rctx.Result = res + fc.Result = res return ec.marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -614,21 +612,21 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_multipleUploadWithPayload_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUploadWithPayload(rctx, args["req"].([]*model.UploadFile)) @@ -638,18 +636,18 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*model.File) - rctx.Result = res + fc.Result = res return ec.marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -657,14 +655,14 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Empty(rctx) @@ -674,18 +672,18 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -693,21 +691,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -720,12 +718,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -733,14 +731,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -753,12 +751,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -766,14 +764,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -783,18 +781,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -802,14 +800,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -822,12 +820,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -835,14 +833,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -852,18 +850,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -871,14 +869,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -888,18 +886,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -907,14 +905,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -924,18 +922,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -943,14 +941,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -963,12 +961,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -976,14 +974,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -993,18 +991,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1012,14 +1010,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1032,12 +1030,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1045,14 +1043,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1062,18 +1060,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1081,14 +1079,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1101,12 +1099,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1114,14 +1112,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1131,18 +1129,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1150,14 +1148,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1167,18 +1165,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1186,14 +1184,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1203,18 +1201,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1222,14 +1220,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1242,12 +1240,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1255,14 +1253,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1272,18 +1270,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1291,14 +1289,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1311,12 +1309,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1324,14 +1322,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1341,18 +1339,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1360,14 +1358,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1380,12 +1378,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1393,14 +1391,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1410,18 +1408,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1429,14 +1427,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1446,18 +1444,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1465,14 +1463,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1485,12 +1483,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1498,14 +1496,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1518,12 +1516,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1531,14 +1529,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1548,18 +1546,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1567,14 +1565,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1584,18 +1582,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1603,14 +1601,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1623,12 +1621,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1636,14 +1634,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1656,12 +1654,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1669,21 +1667,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1696,12 +1694,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1709,14 +1707,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1729,12 +1727,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1742,14 +1740,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1762,12 +1760,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1775,21 +1773,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1802,12 +1800,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1815,14 +1813,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1835,12 +1833,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1848,14 +1846,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1868,7 +1866,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -1950,8 +1948,9 @@ var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1996,8 +1995,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2287,7 +2287,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2307,11 +2307,12 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2337,7 +2338,7 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx context.Context, sel ast.SelectionSet, v *model.File) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2352,7 +2353,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2366,7 +2367,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2380,7 +2381,7 @@ func (ec *executionContext) unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v graphql.Upload) graphql.Marshaler { res := graphql.MarshalUpload(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2426,7 +2427,7 @@ func (ec *executionContext) unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlge func (ec *executionContext) marshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v *graphql.Upload) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2479,11 +2480,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2514,7 +2516,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2550,11 +2552,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2599,11 +2602,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2640,11 +2644,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2670,7 +2675,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2685,7 +2690,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2750,11 +2755,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2790,11 +2796,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2830,11 +2837,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2885,11 +2893,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 9c78136c4de..4f735596fd3 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package scalars import ( @@ -357,7 +355,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Address", Field: field, Args: nil, @@ -365,14 +363,14 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -382,18 +380,18 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(external.ObjectID) - rctx.Result = res + fc.Result = res return ec.marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, field.Selections, res) } func (ec *executionContext) _Address_location(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Address", Field: field, Args: nil, @@ -401,14 +399,14 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Location, nil @@ -421,12 +419,12 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*model.Point) - rctx.Result = res + fc.Result = res return ec.marshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, field.Selections, res) } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -434,21 +432,21 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_user_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(external.ObjectID)) @@ -461,12 +459,12 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } res := resTmp.(*model.User) - rctx.Result = res + fc.Result = res return ec.marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -474,21 +472,21 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_search_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["input"].(*model.SearchArgs)) @@ -498,18 +496,18 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*model.User) - rctx.Result = res + fc.Result = res return ec.marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -517,21 +515,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -544,12 +542,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -557,14 +555,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -577,12 +575,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -590,14 +588,14 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -607,18 +605,18 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(external.ObjectID) - rctx.Result = res + fc.Result = res return ec.marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, field.Selections, res) } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -626,14 +624,14 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -643,18 +641,18 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -662,14 +660,14 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil @@ -682,12 +680,12 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalOTimestamp2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -695,14 +693,14 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsBanned, nil @@ -712,18 +710,18 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(model.Banned) - rctx.Result = res + fc.Result = res return ec.marshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx, field.Selections, res) } func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -731,14 +729,14 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().PrimitiveResolver(rctx, obj) @@ -748,18 +746,18 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _User_customResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -767,14 +765,14 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().CustomResolver(rctx, obj) @@ -784,18 +782,18 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*model.Point) - rctx.Result = res + fc.Result = res return ec.marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, field.Selections, res) } func (ec *executionContext) _User_address(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -803,14 +801,14 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Address, nil @@ -823,12 +821,12 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(model.Address) - rctx.Result = res + fc.Result = res return ec.marshalOAddress2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐAddress(ctx, field.Selections, res) } func (ec *executionContext) _User_tier(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -836,14 +834,14 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Tier, nil @@ -856,12 +854,12 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec return graphql.Null } res := resTmp.(model.Tier) - rctx.Result = res + fc.Result = res return ec.marshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -869,14 +867,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -886,18 +884,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -905,14 +903,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -925,12 +923,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -938,14 +936,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -955,18 +953,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -974,14 +972,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -991,18 +989,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1010,14 +1008,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1027,18 +1025,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1046,14 +1044,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1066,12 +1064,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1079,14 +1077,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1096,18 +1094,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1115,14 +1113,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1135,12 +1133,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1148,14 +1146,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1165,18 +1163,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1184,14 +1182,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1204,12 +1202,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1217,14 +1215,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1234,18 +1232,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1253,14 +1251,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1270,18 +1268,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1289,14 +1287,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1306,18 +1304,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1325,14 +1323,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1345,12 +1343,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1358,14 +1356,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1375,18 +1373,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1394,14 +1392,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1414,12 +1412,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1427,14 +1425,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1444,18 +1442,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1463,14 +1461,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1483,12 +1481,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1496,14 +1494,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1513,18 +1511,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1532,14 +1530,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1549,18 +1547,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1568,14 +1566,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1588,12 +1586,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1601,14 +1599,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1621,12 +1619,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1634,14 +1632,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1651,18 +1649,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1670,14 +1668,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1687,18 +1685,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1706,14 +1704,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1726,12 +1724,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1739,14 +1737,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1759,12 +1757,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1772,21 +1770,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1799,12 +1797,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1812,14 +1810,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1832,12 +1830,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1845,14 +1843,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1865,12 +1863,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1878,21 +1876,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1905,12 +1903,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1918,14 +1916,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1938,12 +1936,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1951,14 +1949,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1971,7 +1969,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2051,8 +2049,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2433,7 +2432,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2447,7 +2446,7 @@ func (ec *executionContext) unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexa func (ec *executionContext) marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx context.Context, sel ast.SelectionSet, v external.ObjectID) graphql.Marshaler { res := model.MarshalID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2473,7 +2472,7 @@ func (ec *executionContext) unmarshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v *model.Point) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2488,7 +2487,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2508,11 +2507,12 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2538,7 +2538,7 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2559,11 +2559,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2594,7 +2595,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2630,11 +2631,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2679,11 +2681,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2720,11 +2723,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2750,7 +2754,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2765,7 +2769,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2922,11 +2926,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2962,11 +2967,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3002,11 +3008,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3057,11 +3064,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/selection/generated.go b/example/selection/generated.go index ad1e4e88af6..4bdbb5c278d 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package selection import ( @@ -275,7 +273,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Like", Field: field, Args: nil, @@ -283,14 +281,14 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Reaction, nil @@ -300,18 +298,18 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Like", Field: field, Args: nil, @@ -319,14 +317,14 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -336,18 +334,18 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Like", Field: field, Args: nil, @@ -355,14 +353,14 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -375,12 +373,12 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Like", Field: field, Args: nil, @@ -388,14 +386,14 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -408,12 +406,12 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Post", Field: field, Args: nil, @@ -421,14 +419,14 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Message, nil @@ -438,18 +436,18 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Post", Field: field, Args: nil, @@ -457,14 +455,14 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -474,18 +472,18 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Post", Field: field, Args: nil, @@ -493,14 +491,14 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -513,12 +511,12 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Post", Field: field, Args: nil, @@ -526,14 +524,14 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -546,12 +544,12 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -559,14 +557,14 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Events(rctx) @@ -579,12 +577,12 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.([]Event) - rctx.Result = res + fc.Result = res return ec.marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋselectionᚐEvent(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -592,21 +590,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -619,12 +617,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -632,14 +630,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -652,12 +650,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -665,14 +663,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -682,18 +680,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -701,14 +699,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -721,12 +719,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -734,14 +732,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -751,18 +749,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -770,14 +768,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -787,18 +785,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -806,14 +804,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -823,18 +821,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -842,14 +840,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -862,12 +860,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -875,14 +873,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -892,18 +890,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -911,14 +909,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -931,12 +929,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -944,14 +942,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -961,18 +959,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -980,14 +978,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1000,12 +998,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1013,14 +1011,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1030,18 +1028,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1049,14 +1047,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1066,18 +1064,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1085,14 +1083,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1102,18 +1100,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1121,14 +1119,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1141,12 +1139,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1154,14 +1152,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1171,18 +1169,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1190,14 +1188,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1210,12 +1208,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1223,14 +1221,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1240,18 +1238,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1259,14 +1257,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1279,12 +1277,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1292,14 +1290,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1309,18 +1307,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1328,14 +1326,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1345,18 +1343,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1364,14 +1362,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1384,12 +1382,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1397,14 +1395,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1417,12 +1415,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1430,14 +1428,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1447,18 +1445,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1466,14 +1464,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1483,18 +1481,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1502,14 +1500,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1522,12 +1520,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1535,14 +1533,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1555,12 +1553,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1568,21 +1566,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1595,12 +1593,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1608,14 +1606,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1628,12 +1626,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1641,14 +1639,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1661,12 +1659,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1674,21 +1672,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1701,12 +1699,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1714,14 +1712,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1734,12 +1732,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1747,14 +1745,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1767,7 +1765,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -1877,8 +1875,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2165,7 +2164,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2174,7 +2173,7 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se func (ec *executionContext) marshalNEvent2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋselectionᚐEvent(ctx context.Context, sel ast.SelectionSet, v Event) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2189,7 +2188,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2203,7 +2202,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { res := graphql.MarshalTime(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2223,11 +2222,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2258,7 +2258,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2294,11 +2294,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2343,11 +2344,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2384,11 +2386,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2414,7 +2417,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2429,7 +2432,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2471,11 +2474,12 @@ func (ec *executionContext) marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2566,11 +2570,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2606,11 +2611,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2646,11 +2652,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2701,11 +2708,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/selection/selection.go b/example/selection/selection.go index ed6e8995e14..f0b163dd1fc 100644 --- a/example/selection/selection.go +++ b/example/selection/selection.go @@ -23,7 +23,7 @@ func (r *queryResolver) Events(ctx context.Context) ([]Event, error) { var sels []string reqCtx := graphql.GetOperationContext(ctx) - fieldSelections := graphql.GetResolverContext(ctx).Field.Selections + fieldSelections := graphql.GetFieldContext(ctx).Field.Selections for _, sel := range fieldSelections { switch sel := sel.(type) { case *ast.Field: diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 16880c51e42..c24b9bbdf16 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package generated import ( @@ -939,7 +937,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Droid", Field: field, Args: nil, @@ -947,14 +945,14 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -964,18 +962,18 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Droid", Field: field, Args: nil, @@ -983,14 +981,14 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1000,18 +998,18 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Droid", Field: field, Args: nil, @@ -1019,14 +1017,14 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().Friends(rctx, obj) @@ -1039,12 +1037,12 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]models.Character) - rctx.Result = res + fc.Result = res return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Droid", Field: field, Args: nil, @@ -1052,21 +1050,21 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Droid_friendsConnection_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1076,18 +1074,18 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*models.FriendsConnection) - rctx.Result = res + fc.Result = res return ec.marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx, field.Selections, res) } func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Droid", Field: field, Args: nil, @@ -1095,14 +1093,14 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1112,18 +1110,18 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]models.Episode) - rctx.Result = res + fc.Result = res return ec.marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, field.Selections, res) } func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Droid", Field: field, Args: nil, @@ -1131,14 +1129,14 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PrimaryFunction, nil @@ -1151,12 +1149,12 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "FriendsConnection", Field: field, Args: nil, @@ -1164,14 +1162,14 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount(), nil @@ -1181,18 +1179,18 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "FriendsConnection", Field: field, Args: nil, @@ -1200,14 +1198,14 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Edges(rctx, obj) @@ -1220,12 +1218,12 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field return graphql.Null } res := resTmp.([]*models.FriendsEdge) - rctx.Result = res + fc.Result = res return ec.marshalOFriendsEdge2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsEdge(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "FriendsConnection", Field: field, Args: nil, @@ -1233,14 +1231,14 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Friends(rctx, obj) @@ -1253,12 +1251,12 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel return graphql.Null } res := resTmp.([]models.Character) - rctx.Result = res + fc.Result = res return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "FriendsConnection", Field: field, Args: nil, @@ -1266,14 +1264,14 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo(), nil @@ -1283,18 +1281,18 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(models.PageInfo) - rctx.Result = res + fc.Result = res return ec.marshalNPageInfo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "FriendsEdge", Field: field, Args: nil, @@ -1302,14 +1300,14 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil @@ -1319,18 +1317,18 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "FriendsEdge", Field: field, Args: nil, @@ -1338,14 +1336,14 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil @@ -1358,12 +1356,12 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql return graphql.Null } res := resTmp.(models.Character) - rctx.Result = res + fc.Result = res return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1371,14 +1369,14 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -1388,18 +1386,18 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1407,14 +1405,14 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1424,18 +1422,18 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1443,21 +1441,21 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Human_height_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Height(args["unit"].(models.LengthUnit)), nil @@ -1467,18 +1465,18 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalNFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1486,14 +1484,14 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Mass, nil @@ -1506,12 +1504,12 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalOFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1519,14 +1517,14 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Friends(rctx, obj) @@ -1539,12 +1537,12 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]models.Character) - rctx.Result = res + fc.Result = res return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1552,21 +1550,21 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Human_friendsConnection_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1576,18 +1574,18 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*models.FriendsConnection) - rctx.Result = res + fc.Result = res return ec.marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx, field.Selections, res) } func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1595,14 +1593,14 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1612,18 +1610,18 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]models.Episode) - rctx.Result = res + fc.Result = res return ec.marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, field.Selections, res) } func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Human", Field: field, Args: nil, @@ -1631,14 +1629,14 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Starships(rctx, obj) @@ -1651,12 +1649,12 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. return graphql.Null } res := resTmp.([]*models.Starship) - rctx.Result = res + fc.Result = res return ec.marshalOStarship2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Mutation", Field: field, Args: nil, @@ -1664,21 +1662,21 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_createReview_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateReview(rctx, args["episode"].(models.Episode), args["review"].(models.Review)) @@ -1691,12 +1689,12 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr return graphql.Null } res := resTmp.(*models.Review) - rctx.Result = res + fc.Result = res return ec.marshalOReview2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, field.Selections, res) } func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "PageInfo", Field: field, Args: nil, @@ -1704,14 +1702,14 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.StartCursor, nil @@ -1721,18 +1719,18 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "PageInfo", Field: field, Args: nil, @@ -1740,14 +1738,14 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EndCursor, nil @@ -1757,18 +1755,18 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "PageInfo", Field: field, Args: nil, @@ -1776,14 +1774,14 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.HasNextPage, nil @@ -1793,18 +1791,18 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -1812,21 +1810,21 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_hero_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Hero(rctx, args["episode"].(*models.Episode)) @@ -1839,12 +1837,12 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle return graphql.Null } res := resTmp.(models.Character) - rctx.Result = res + fc.Result = res return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -1852,21 +1850,21 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_reviews_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Reviews(rctx, args["episode"].(models.Episode), args["since"].(*time.Time)) @@ -1876,18 +1874,18 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*models.Review) - rctx.Result = res + fc.Result = res return ec.marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, field.Selections, res) } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -1895,21 +1893,21 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_search_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["text"].(string)) @@ -1919,18 +1917,18 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]models.SearchResult) - rctx.Result = res + fc.Result = res return ec.marshalNSearchResult2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐSearchResult(ctx, field.Selections, res) } func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -1938,21 +1936,21 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_character_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Character(rctx, args["id"].(string)) @@ -1965,12 +1963,12 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. return graphql.Null } res := resTmp.(models.Character) - rctx.Result = res + fc.Result = res return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -1978,21 +1976,21 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_droid_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Droid(rctx, args["id"].(string)) @@ -2005,12 +2003,12 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*models.Droid) - rctx.Result = res + fc.Result = res return ec.marshalODroid2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐDroid(ctx, field.Selections, res) } func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -2018,21 +2016,21 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_human_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Human(rctx, args["id"].(string)) @@ -2045,12 +2043,12 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*models.Human) - rctx.Result = res + fc.Result = res return ec.marshalOHuman2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐHuman(ctx, field.Selections, res) } func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -2058,21 +2056,21 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_starship_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Starship(rctx, args["id"].(string)) @@ -2085,12 +2083,12 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*models.Starship) - rctx.Result = res + fc.Result = res return ec.marshalOStarship2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -2098,21 +2096,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -2125,12 +2123,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -2138,14 +2136,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -2158,12 +2156,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Review", Field: field, Args: nil, @@ -2171,14 +2169,14 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Stars, nil @@ -2188,18 +2186,18 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Review", Field: field, Args: nil, @@ -2207,14 +2205,14 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Commentary, nil @@ -2227,12 +2225,12 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Review", Field: field, Args: nil, @@ -2240,14 +2238,14 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Time, nil @@ -2260,12 +2258,12 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(time.Time) - rctx.Result = res + fc.Result = res return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Starship", Field: field, Args: nil, @@ -2273,14 +2271,14 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2290,18 +2288,18 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Starship", Field: field, Args: nil, @@ -2309,14 +2307,14 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2326,18 +2324,18 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Starship", Field: field, Args: nil, @@ -2345,21 +2343,21 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Starship_length_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Starship().Length(rctx, obj, args["unit"].(*models.LengthUnit)) @@ -2369,18 +2367,18 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(float64) - rctx.Result = res + fc.Result = res return ec.marshalNFloat2float64(ctx, field.Selections, res) } func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Starship", Field: field, Args: nil, @@ -2388,14 +2386,14 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.History, nil @@ -2405,18 +2403,18 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([][]int) - rctx.Result = res + fc.Result = res return ec.marshalNInt2ᚕᚕint(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -2424,14 +2422,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2441,18 +2439,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -2460,14 +2458,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2480,12 +2478,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -2493,14 +2491,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -2510,18 +2508,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -2529,14 +2527,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2546,18 +2544,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -2565,14 +2563,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2582,18 +2580,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -2601,14 +2599,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2621,12 +2619,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -2634,14 +2632,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2651,18 +2649,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -2670,14 +2668,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2690,12 +2688,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -2703,14 +2701,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2720,18 +2718,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -2739,14 +2737,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2759,12 +2757,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -2772,14 +2770,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2789,18 +2787,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -2808,14 +2806,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -2825,18 +2823,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -2844,14 +2842,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2861,18 +2859,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -2880,14 +2878,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2900,12 +2898,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -2913,14 +2911,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2930,18 +2928,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -2949,14 +2947,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2969,12 +2967,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -2982,14 +2980,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -2999,18 +2997,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -3018,14 +3016,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -3038,12 +3036,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -3051,14 +3049,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -3068,18 +3066,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -3087,14 +3085,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -3104,18 +3102,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -3123,14 +3121,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -3143,12 +3141,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -3156,14 +3154,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -3176,12 +3174,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -3189,14 +3187,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -3206,18 +3204,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3225,14 +3223,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -3242,18 +3240,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3261,14 +3259,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -3281,12 +3279,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3294,14 +3292,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -3314,12 +3312,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3327,21 +3325,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -3354,12 +3352,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3367,14 +3365,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -3387,12 +3385,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3400,14 +3398,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -3420,12 +3418,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3433,21 +3431,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -3460,12 +3458,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3473,14 +3471,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -3493,12 +3491,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -3506,14 +3504,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -3526,7 +3524,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -3842,8 +3840,9 @@ var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -3907,8 +3906,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -4349,7 +4349,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4358,7 +4358,7 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se func (ec *executionContext) marshalNCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx context.Context, sel ast.SelectionSet, v models.Character) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4404,11 +4404,12 @@ func (ec *executionContext) marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4439,7 +4440,7 @@ func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v inter func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { res := graphql.MarshalFloat(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4452,7 +4453,7 @@ func (ec *executionContext) marshalNFriendsConnection2githubᚗcomᚋ99designs func (ec *executionContext) marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx context.Context, sel ast.SelectionSet, v *models.FriendsConnection) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4466,7 +4467,7 @@ func (ec *executionContext) marshalNFriendsEdge2githubᚗcomᚋ99designsᚋgqlge func (ec *executionContext) marshalNFriendsEdge2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsEdge(ctx context.Context, sel ast.SelectionSet, v *models.FriendsEdge) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4481,7 +4482,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4495,7 +4496,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4577,11 +4578,12 @@ func (ec *executionContext) marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4607,7 +4609,7 @@ func (ec *executionContext) marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg func (ec *executionContext) marshalNReview2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx context.Context, sel ast.SelectionSet, v *models.Review) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4621,7 +4623,7 @@ func (ec *executionContext) unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgql func (ec *executionContext) marshalNSearchResult2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐSearchResult(ctx context.Context, sel ast.SelectionSet, v models.SearchResult) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4638,11 +4640,12 @@ func (ec *executionContext) marshalNSearchResult2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4672,7 +4675,7 @@ func (ec *executionContext) marshalNStarship2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNStarship2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx context.Context, sel ast.SelectionSet, v *models.Starship) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4687,7 +4690,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4707,11 +4710,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4742,7 +4746,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4778,11 +4782,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4827,11 +4832,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4868,11 +4874,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -4898,7 +4905,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -4913,7 +4920,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -4962,11 +4969,12 @@ func (ec *executionContext) marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -5045,11 +5053,12 @@ func (ec *executionContext) marshalOFriendsEdge2ᚕᚖgithubᚗcomᚋ99designs } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -5181,11 +5190,12 @@ func (ec *executionContext) marshalOStarship2ᚕᚖgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -5274,11 +5284,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -5314,11 +5325,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -5354,11 +5366,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -5409,11 +5422,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/starwars/server/server.go b/example/starwars/server/server.go index 13734ceff74..73c7bebca30 100644 --- a/example/starwars/server/server.go +++ b/example/starwars/server/server.go @@ -18,7 +18,7 @@ func main() { http.Handle("/", playground.Handler("Starwars", "/query")) http.Handle("/query", handler.GraphQL(generated.NewExecutableSchema(starwars.NewResolver()), handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) fmt.Println("Entered", rc.Object, rc.Field.Name) res, err = next(ctx) fmt.Println("Left", rc.Object, rc.Field.Name, "=>", res, err) diff --git a/example/todo/generated.go b/example/todo/generated.go index 57fc9dc6fa4..b59f468dc56 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package todo import ( @@ -466,8 +464,8 @@ func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.Op } func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Directives { + fc := graphql.GetFieldContext(ctx) + for _, d := range fc.Field.Directives { switch d.Name { case "user": rawArgs := d.ArgumentMap(ec.Variables) @@ -498,7 +496,7 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyMutation", Field: field, Args: nil, @@ -506,39 +504,39 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_createTodo_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyMutation", Field: field, Args: nil, @@ -546,21 +544,21 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_updateTodo_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{})) @@ -570,12 +568,12 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -583,21 +581,21 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery_todo_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int)) @@ -607,12 +605,12 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -620,14 +618,14 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().LastTodo(rctx) @@ -637,12 +635,12 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -650,32 +648,32 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*Todo) - rctx.Result = res + fc.Result = res return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -683,21 +681,21 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -707,12 +705,12 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -720,14 +718,14 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -737,12 +735,12 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -750,32 +748,32 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) - rctx.Result = res + fc.Result = res return ec.marshalNID2int(ctx, field.Selections, res) } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -783,32 +781,32 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -816,14 +814,14 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -854,18 +852,18 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -873,32 +871,32 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -906,14 +904,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -923,12 +921,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -936,32 +934,32 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -969,32 +967,32 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1002,32 +1000,32 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1035,14 +1033,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1052,12 +1050,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1065,32 +1063,32 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1098,14 +1096,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1115,12 +1113,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1128,32 +1126,32 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1161,14 +1159,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1178,12 +1176,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1191,32 +1189,32 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1224,32 +1222,32 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1257,32 +1255,32 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1290,14 +1288,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1307,12 +1305,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1320,32 +1318,32 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1353,14 +1351,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1370,12 +1368,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1383,32 +1381,32 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1416,14 +1414,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1433,12 +1431,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1446,32 +1444,32 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1479,32 +1477,32 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1512,14 +1510,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1529,12 +1527,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1542,14 +1540,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1559,12 +1557,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1572,32 +1570,32 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1605,32 +1603,32 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1638,14 +1636,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1655,12 +1653,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1668,14 +1666,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1685,12 +1683,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1698,21 +1696,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1722,12 +1720,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1735,14 +1733,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1752,12 +1750,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1765,14 +1763,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1782,12 +1780,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1795,21 +1793,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1819,12 +1817,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1832,14 +1830,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1849,12 +1847,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1862,14 +1860,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1879,7 +1877,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -1924,8 +1922,9 @@ var myMutationImplementors = []string{"MyMutation"} func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, myMutationImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyMutation", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1957,8 +1956,9 @@ var myQueryImplementors = []string{"MyQuery"} func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, myQueryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyQuery", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2307,7 +2307,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2321,7 +2321,7 @@ func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalIntID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2337,14 +2337,14 @@ func (ec *executionContext) unmarshalNMap2map(ctx context.Context, v interface{} func (ec *executionContext) marshalNMap2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := graphql.MarshalMap(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2367,7 +2367,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2387,11 +2387,12 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2417,7 +2418,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx context.Context, sel ast.SelectionSet, v *Todo) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2442,11 +2443,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2477,7 +2479,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2513,11 +2515,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2562,11 +2565,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2603,11 +2607,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2633,7 +2638,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2648,7 +2653,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2724,11 +2729,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2764,11 +2770,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2804,11 +2811,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2859,11 +2867,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/example/type-system-extension/directive.go b/example/type-system-extension/directive.go index 8b49e929ecd..2b3ff918cec 100644 --- a/example/type-system-extension/directive.go +++ b/example/type-system-extension/directive.go @@ -8,37 +8,37 @@ import ( ) func EnumLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) log.Printf("enum logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj) return next(ctx) } func FieldLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) log.Printf("field logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj) return next(ctx) } func InputLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) log.Printf("input object logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj) return next(ctx) } func ObjectLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) log.Printf("object logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj) return next(ctx) } func ScalarLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) log.Printf("scalar logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj) return next(ctx) } func UnionLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetResolverContext(ctx) + rc := graphql.GetFieldContext(ctx) log.Printf("union logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj) return next(ctx) } diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 90f8337cf93..b8dde8dfc0c 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package type_system_extension import ( @@ -379,7 +377,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyMutation", Field: field, Args: nil, @@ -387,21 +385,21 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_createTodo_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) @@ -411,18 +409,18 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -430,14 +428,14 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) @@ -447,18 +445,18 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]*Todo) - rctx.Result = res + fc.Result = res return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -466,21 +464,21 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery_todo_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(string)) @@ -493,12 +491,12 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*Todo) - rctx.Result = res + fc.Result = res return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -506,21 +504,21 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -533,12 +531,12 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "MyQuery", Field: field, Args: nil, @@ -546,14 +544,14 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -566,12 +564,12 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -579,14 +577,14 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -596,18 +594,18 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNID2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -615,14 +613,14 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -632,18 +630,18 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -651,14 +649,14 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.State, nil @@ -668,18 +666,18 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(State) - rctx.Result = res + fc.Result = res return ec.marshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx, field.Selections, res) } func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Todo", Field: field, Args: nil, @@ -687,14 +685,14 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() 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 @@ -724,18 +722,18 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -743,14 +741,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -760,18 +758,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -779,14 +777,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -799,12 +797,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -812,14 +810,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -829,18 +827,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -848,14 +846,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -865,18 +863,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -884,14 +882,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -901,18 +899,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -920,14 +918,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -940,12 +938,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -953,14 +951,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -970,18 +968,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -989,14 +987,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1009,12 +1007,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1022,14 +1020,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1039,18 +1037,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1058,14 +1056,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1078,12 +1076,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1091,14 +1089,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1108,18 +1106,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1127,14 +1125,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1144,18 +1142,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1163,14 +1161,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1180,18 +1178,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1199,14 +1197,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1219,12 +1217,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1232,14 +1230,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1249,18 +1247,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1268,14 +1266,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1288,12 +1286,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1301,14 +1299,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1318,18 +1316,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1337,14 +1335,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1357,12 +1355,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1370,14 +1368,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1387,18 +1385,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1406,14 +1404,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1423,18 +1421,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1442,14 +1440,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1462,12 +1460,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1475,14 +1473,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1495,12 +1493,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1508,14 +1506,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1525,18 +1523,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1544,14 +1542,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1561,18 +1559,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1580,14 +1578,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1600,12 +1598,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1613,14 +1611,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1633,12 +1631,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1646,21 +1644,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1673,12 +1671,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1686,14 +1684,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1706,12 +1704,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1719,14 +1717,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1739,12 +1737,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1752,21 +1750,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1779,12 +1777,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1792,14 +1790,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1812,12 +1810,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1825,14 +1823,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1845,7 +1843,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -1910,8 +1908,9 @@ var myMutationImplementors = []string{"MyMutation"} func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, myMutationImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyMutation", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1941,8 +1940,9 @@ var myQueryImplementors = []string{"MyQuery"} func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, myQueryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyQuery", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2285,7 +2285,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2299,7 +2299,7 @@ func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalID(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2322,7 +2322,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2342,11 +2342,12 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2372,7 +2373,7 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx context.Context, sel ast.SelectionSet, v *Todo) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2397,11 +2398,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2432,7 +2434,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2468,11 +2470,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2517,11 +2520,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2558,11 +2562,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2588,7 +2593,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2603,7 +2608,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2679,11 +2684,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2719,11 +2725,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2759,11 +2766,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2814,11 +2822,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/graphql/context_resolver.go b/graphql/context_field.go similarity index 77% rename from graphql/context_resolver.go rename to graphql/context_field.go index eb963ef840e..5471adfaccd 100644 --- a/graphql/context_resolver.go +++ b/graphql/context_field.go @@ -9,8 +9,11 @@ type key string const resolverCtx key = "resolver_context" -type ResolverContext struct { - Parent *ResolverContext +// Deprecated: Use FieldContext instead +type ResolverContext = FieldContext + +type FieldContext struct { + Parent *FieldContext // The name of the type this field belongs to Object string // These are the args after processing, they can be mutated in middleware to change what the resolver will get. @@ -39,7 +42,7 @@ type FieldStats struct { Completed time.Time } -func (r *ResolverContext) Path() []interface{} { +func (r *FieldContext) Path() []interface{} { var path []interface{} for it := r; it != nil; it = it.Parent { if it.Index != nil { @@ -58,15 +61,20 @@ func (r *ResolverContext) Path() []interface{} { return path } +// Deprecated: Use GetFieldContext instead func GetResolverContext(ctx context.Context) *ResolverContext { - if val, ok := ctx.Value(resolverCtx).(*ResolverContext); ok { + return GetFieldContext(ctx) +} + +func GetFieldContext(ctx context.Context) *FieldContext { + if val, ok := ctx.Value(resolverCtx).(*FieldContext); ok { return val } return nil } -func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context { - rc.Parent = GetResolverContext(ctx) +func WithFieldContext(ctx context.Context, rc *FieldContext) context.Context { + rc.Parent = GetFieldContext(ctx) return context.WithValue(ctx, resolverCtx, rc) } diff --git a/graphql/context_resolver_test.go b/graphql/context_field_test.go similarity index 62% rename from graphql/context_resolver_test.go rename to graphql/context_field_test.go index de59bc505d1..05e6cd1a741 100644 --- a/graphql/context_resolver_test.go +++ b/graphql/context_field_test.go @@ -9,10 +9,10 @@ import ( ) func TestGetResolverContext(t *testing.T) { - require.Nil(t, GetResolverContext(context.Background())) + require.Nil(t, GetFieldContext(context.Background())) - rc := &ResolverContext{} - require.Equal(t, rc, GetResolverContext(WithResolverContext(context.Background(), rc))) + rc := &FieldContext{} + require.Equal(t, rc, GetFieldContext(WithFieldContext(context.Background(), rc))) } func testContext(sel ast.SelectionSet) context.Context { @@ -22,12 +22,12 @@ func testContext(sel ast.SelectionSet) context.Context { rqCtx := &OperationContext{} ctx = WithOperationContext(ctx, rqCtx) - root := &ResolverContext{ + root := &FieldContext{ Field: CollectedField{ Selections: sel, }, } - ctx = WithResolverContext(ctx, root) + ctx = WithFieldContext(ctx, root) return ctx } diff --git a/graphql/context_operation.go b/graphql/context_operation.go index daf077a3cba..8d6142ec3ff 100644 --- a/graphql/context_operation.go +++ b/graphql/context_operation.go @@ -64,14 +64,14 @@ func WithOperationContext(ctx context.Context, rc *OperationContext) context.Con // This is just a convenient wrapper method for CollectFields func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField { - resctx := GetResolverContext(ctx) + resctx := GetFieldContext(ctx) return CollectFields(GetOperationContext(ctx), resctx.Field.Selections, satisfies) } // CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context. // The slice will contain the unique set of all field names requested regardless of fragment type conditions. func CollectAllFields(ctx context.Context) []string { - resctx := GetResolverContext(ctx) + resctx := GetFieldContext(ctx) collected := CollectFields(GetOperationContext(ctx), resctx.Field.Selections, nil) uniq := make([]string, 0, len(collected)) Next: diff --git a/graphql/context_response.go b/graphql/context_response.go index e88e2b6c1b2..4031752b871 100644 --- a/graphql/context_response.go +++ b/graphql/context_response.go @@ -62,7 +62,7 @@ func Recover(ctx context.Context, err interface{}) (userMessage error) { } // HasFieldError returns true if the given field has already errored -func HasFieldError(ctx context.Context, rctx *ResolverContext) bool { +func HasFieldError(ctx context.Context, rctx *FieldContext) bool { c := getResponseContext(ctx) c.errorsMu.Lock() @@ -78,7 +78,7 @@ func HasFieldError(ctx context.Context, rctx *ResolverContext) bool { } // GetFieldErrors returns a list of errors that occurred in the given field -func GetFieldErrors(ctx context.Context, rctx *ResolverContext) gqlerror.List { +func GetFieldErrors(ctx context.Context, rctx *FieldContext) gqlerror.List { c := getResponseContext(ctx) c.errorsMu.Lock() diff --git a/graphql/context_response_test.go b/graphql/context_response_test.go index a4e16cc86d7..59d80f4403a 100644 --- a/graphql/context_response_test.go +++ b/graphql/context_response_test.go @@ -14,23 +14,23 @@ import ( func TestAddError(t *testing.T) { ctx := WithResponseContext(context.Background(), DefaultErrorPresenter, nil) - root := &ResolverContext{ + root := &FieldContext{ Field: CollectedField{ Field: &ast.Field{ Alias: "foo", }, }, } - ctx = WithResolverContext(ctx, root) + ctx = WithFieldContext(ctx, root) AddError(ctx, errors.New("foo1")) AddError(ctx, errors.New("foo2")) index := 1 - child := &ResolverContext{ + child := &FieldContext{ Parent: root, Index: &index, } - userProvidedPath := &ResolverContext{ + userProvidedPath := &FieldContext{ Parent: child, Field: CollectedField{ Field: &ast.Field{ @@ -39,7 +39,7 @@ func TestAddError(t *testing.T) { }, } - ctx = WithResolverContext(ctx, child) + ctx = WithFieldContext(ctx, child) AddError(ctx, errors.New("bar")) AddError(ctx, &gqlerror.Error{ Message: "foo3", @@ -48,16 +48,16 @@ func TestAddError(t *testing.T) { specs := []struct { Name string - RCtx *ResolverContext + RCtx *FieldContext Messages []string }{ { - Name: "with root ResolverContext", + Name: "with root FieldContext", RCtx: root, Messages: []string{"foo1", "foo2"}, }, { - Name: "with child ResolverContext", + Name: "with child FieldContext", RCtx: child, Messages: []string{"bar"}, }, diff --git a/graphql/error.go b/graphql/error.go index af8b4ce4088..feaf3cc6351 100644 --- a/graphql/error.go +++ b/graphql/error.go @@ -15,7 +15,7 @@ type ExtendedError interface { func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { if gqlerr, ok := err.(*gqlerror.Error); ok { if gqlerr.Path == nil { - gqlerr.Path = GetResolverContext(ctx).Path() + gqlerr.Path = GetFieldContext(ctx).Path() } return gqlerr } @@ -27,7 +27,7 @@ func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { return &gqlerror.Error{ Message: err.Error(), - Path: GetResolverContext(ctx).Path(), + Path: GetFieldContext(ctx).Path(), Extensions: extensions, } } diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index d3a10789edc..4c875fc006b 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -52,7 +52,7 @@ func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res defer func() { td.mu.Lock() defer td.mu.Unlock() - fc := graphql.GetResolverContext(ctx) + fc := graphql.GetFieldContext(ctx) end := graphql.Now() diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index c4cebcbac00..878b67b7c48 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -53,7 +53,7 @@ func New() *TestServer { } ran = true // Field execution happens inside the generated code, lets simulate some of it. - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", Field: graphql.CollectedField{ Field: &ast.Field{ diff --git a/integration/generated.go b/integration/generated.go index b63592e5189..63c52b732ed 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -1,5 +1,3 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - package integration import ( @@ -417,7 +415,7 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Element", Field: field, Args: nil, @@ -425,14 +423,14 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Child(rctx, obj) @@ -442,18 +440,18 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*models.Element) - rctx.Result = res + fc.Result = res return ec.marshalNElement2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx, field.Selections, res) } func (ec *executionContext) _Element_error(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Element", Field: field, Args: nil, @@ -461,14 +459,14 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Error(rctx, obj) @@ -478,18 +476,18 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Element_mismatched(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Element", Field: field, Args: nil, @@ -497,14 +495,14 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Mismatched(rctx, obj) @@ -517,12 +515,12 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph return graphql.Null } res := resTmp.([]bool) - rctx.Result = res + fc.Result = res return ec.marshalOBoolean2ᚕbool(ctx, field.Selections, res) } func (ec *executionContext) _Query_path(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -530,14 +528,14 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Path(rctx) @@ -550,12 +548,12 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle return graphql.Null } res := resTmp.([]*models.Element) - rctx.Result = res + fc.Result = res return ec.marshalOElement2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx, field.Selections, res) } func (ec *executionContext) _Query_date(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -563,21 +561,21 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_date_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Date(rctx, args["filter"].(models.DateFilter)) @@ -587,18 +585,18 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -606,14 +604,14 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Viewer(rctx) @@ -626,12 +624,12 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*models.Viewer) - rctx.Result = res + fc.Result = res return ec.marshalOViewer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐViewer(ctx, field.Selections, res) } func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -639,14 +637,14 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().JSONEncoding(rctx) @@ -656,18 +654,18 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Query_error(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -675,21 +673,21 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_error_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Error(rctx, args["type"].(*models.ErrorType)) @@ -699,18 +697,18 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -718,21 +716,21 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_complexity_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Complexity(rctx, args["value"].(int)) @@ -742,18 +740,18 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -761,21 +759,21 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -788,12 +786,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Query", Field: field, Args: nil, @@ -801,14 +799,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -821,12 +819,12 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return graphql.Null } res := resTmp.(*introspection.Schema) - rctx.Result = res + fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -834,14 +832,14 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -851,18 +849,18 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _User_likes(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "User", Field: field, Args: nil, @@ -870,14 +868,14 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Likes(rctx, obj) @@ -887,18 +885,18 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalNString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.CollectedField, obj *models.Viewer) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "Viewer", Field: field, Args: nil, @@ -906,14 +904,14 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -926,12 +924,12 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*remote_api.User) - rctx.Result = res + fc.Result = res return ec.marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋremote_apiᚐUser(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -939,14 +937,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -956,18 +954,18 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -975,14 +973,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -995,12 +993,12 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -1008,14 +1006,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -1025,18 +1023,18 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) - rctx.Result = res + fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Directive", Field: field, Args: nil, @@ -1044,14 +1042,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1061,18 +1059,18 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1080,14 +1078,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1097,18 +1095,18 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1116,14 +1114,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1136,12 +1134,12 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1149,14 +1147,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1166,18 +1164,18 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__EnumValue", Field: field, Args: nil, @@ -1185,14 +1183,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1205,12 +1203,12 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1218,14 +1216,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1235,18 +1233,18 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1254,14 +1252,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1274,12 +1272,12 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1287,14 +1285,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1304,18 +1302,18 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1323,14 +1321,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1340,18 +1338,18 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1359,14 +1357,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1376,18 +1374,18 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) - rctx.Result = res + fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Field", Field: field, Args: nil, @@ -1395,14 +1393,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1415,12 +1413,12 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1428,14 +1426,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1445,18 +1443,18 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1464,14 +1462,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1484,12 +1482,12 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1497,14 +1495,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1514,18 +1512,18 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__InputValue", Field: field, Args: nil, @@ -1533,14 +1531,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1553,12 +1551,12 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1566,14 +1564,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1583,18 +1581,18 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1602,14 +1600,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1619,18 +1617,18 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1638,14 +1636,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1658,12 +1656,12 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1671,14 +1669,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1691,12 +1689,12 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Schema", Field: field, Args: nil, @@ -1704,14 +1702,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1721,18 +1719,18 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) - rctx.Result = res + fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1740,14 +1738,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1757,18 +1755,18 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, rctx) { + if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1776,14 +1774,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1796,12 +1794,12 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return graphql.Null } res := resTmp.(*string) - rctx.Result = res + fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1809,14 +1807,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1829,12 +1827,12 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return graphql.Null } res := resTmp.(string) - rctx.Result = res + fc.Result = res return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1842,21 +1840,21 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1869,12 +1867,12 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.([]introspection.Field) - rctx.Result = res + fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1882,14 +1880,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1902,12 +1900,12 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1915,14 +1913,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1935,12 +1933,12 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return graphql.Null } res := resTmp.([]introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1948,21 +1946,21 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null } - rctx.Args = args - rctx.Stats.ArgumentsCompleted = graphql.Now() + fc.Args = args + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1975,12 +1973,12 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } res := resTmp.([]introspection.EnumValue) - rctx.Result = res + fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -1988,14 +1986,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2008,12 +2006,12 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return graphql.Null } res := resTmp.([]introspection.InputValue) - rctx.Result = res + fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Object: "__Type", Field: field, Args: nil, @@ -2021,14 +2019,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co Stats: graphql.FieldStats{Started: graphql.Now()}, } defer func() { - rctx.Stats.Completed = graphql.Now() + fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithResolverContext(ctx, rctx) - rctx.Stats.ArgumentsCompleted = graphql.Now() + ctx = graphql.WithFieldContext(ctx, fc) + fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2041,7 +2039,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return graphql.Null } res := resTmp.(*introspection.Type) - rctx.Result = res + fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } @@ -2160,8 +2158,9 @@ var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", + Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2580,7 +2579,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { res := graphql.MarshalBoolean(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2597,7 +2596,7 @@ func (ec *executionContext) marshalNElement2githubᚗcomᚋ99designsᚋgqlgenᚋ func (ec *executionContext) marshalNElement2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx context.Context, sel ast.SelectionSet, v *models.Element) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2612,7 +2611,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{} func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { res := graphql.MarshalInt(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2626,7 +2625,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2675,11 +2674,12 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2710,7 +2710,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2746,11 +2746,12 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2795,11 +2796,12 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2836,11 +2838,12 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -2866,7 +2869,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null @@ -2881,7 +2884,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { res := graphql.MarshalString(v) if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetResolverContext(ctx)) { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "must not be null") } } @@ -2983,11 +2986,12 @@ func (ec *executionContext) marshalOElement2ᚕᚖgithubᚗcomᚋ99designsᚋgql } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3122,11 +3126,12 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3162,11 +3167,12 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3202,11 +3208,12 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { @@ -3257,11 +3264,12 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen } for i := range v { i := i - rctx := &graphql.ResolverContext{ + fc := &graphql.FieldContext{ Index: &i, Result: &v[i], + Stats: graphql.FieldStats{Started: graphql.Now()}, } - ctx := graphql.WithResolverContext(ctx, rctx) + ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { diff --git a/integration/server/server.go b/integration/server/server.go index 64a91bf48a6..a2b8a50cda7 100644 --- a/integration/server/server.go +++ b/integration/server/server.go @@ -36,7 +36,7 @@ func main() { if e, ok := errors.Cause(e).(*integration.CustomError); ok { return &gqlerror.Error{ Message: e.UserMessage, - Path: graphql.GetResolverContext(ctx).Path(), + Path: graphql.GetFieldContext(ctx).Path(), } } return graphql.DefaultErrorPresenter(ctx, e) From f2ef5ec3d660c7c226ad5392d9d43e38abcc6827 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Nov 2019 23:37:15 +1100 Subject: [PATCH 34/53] more deprecations and more compat --- handler/handler.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/handler/handler.go b/handler/handler.go index 573d20be7c3..6718a9e5e57 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -10,9 +10,11 @@ import ( "github.com/99designs/gqlgen/graphql/handler/extension" "github.com/99designs/gqlgen/graphql/handler/lru" "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql/playground" "github.com/gorilla/websocket" ) +// Deprecated: switch to graphql/handler.New func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc { var cfg Config @@ -68,6 +70,7 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc return srv.ServeHTTP } +// Deprecated: switch to graphql/handler.New type Config struct { cacheSize int upgrader websocket.Upgrader @@ -85,14 +88,17 @@ type Config struct { apqCache PersistedQueryCache } +// Deprecated: switch to graphql/handler.New type Option func(cfg *Config) +// Deprecated: switch to graphql/handler.New func WebsocketUpgrader(upgrader websocket.Upgrader) Option { return func(cfg *Config) { cfg.upgrader = upgrader } } +// Deprecated: switch to graphql/handler.New func RecoverFunc(recover graphql.RecoverFunc) Option { return func(cfg *Config) { cfg.recover = recover @@ -102,6 +108,7 @@ func RecoverFunc(recover graphql.RecoverFunc) Option { // ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides // a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default // implementation in graphql.DefaultErrorPresenter for an example. +// Deprecated: switch to graphql/handler.New func ErrorPresenter(f graphql.ErrorPresenterFunc) Option { return func(cfg *Config) { cfg.errorPresenter = f @@ -110,6 +117,7 @@ func ErrorPresenter(f graphql.ErrorPresenterFunc) Option { // IntrospectionEnabled = false will forbid clients from calling introspection endpoints. Can be useful in prod when you dont // want clients introspecting the full schema. +// Deprecated: switch to graphql/handler.New func IntrospectionEnabled(enabled bool) Option { return func(cfg *Config) { cfg.disableIntrospection = !enabled @@ -118,6 +126,7 @@ func IntrospectionEnabled(enabled bool) Option { // ComplexityLimit sets a maximum query complexity that is allowed to be executed. // If a query is submitted that exceeds the limit, a 422 status code will be returned. +// Deprecated: switch to graphql/handler.New func ComplexityLimit(limit int) Option { return func(cfg *Config) { cfg.complexityLimit = limit @@ -127,6 +136,7 @@ func ComplexityLimit(limit int) Option { // ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed // to be executed. // If a query is submitted that exceeds the limit, a 422 status code will be returned. +// Deprecated: switch to graphql/handler.New func ComplexityLimitFunc(complexityLimitFunc func(ctx context.Context) int) Option { return func(cfg *Config) { cfg.complexityLimitFunc = complexityLimitFunc @@ -135,6 +145,7 @@ func ComplexityLimitFunc(complexityLimitFunc func(ctx context.Context) int) Opti // ResolverMiddleware allows you to define a function that will be called around every resolver, // useful for logging. +// Deprecated: switch to graphql/handler.New func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { return func(cfg *Config) { cfg.fieldHooks = append(cfg.fieldHooks, middleware) @@ -143,6 +154,7 @@ func ResolverMiddleware(middleware graphql.FieldMiddleware) Option { // RequestMiddleware allows you to define a function that will be called around the root request, // after the query has been parsed. This is useful for logging +// Deprecated: switch to graphql/handler.New func RequestMiddleware(middleware graphql.ResponseMiddleware) Option { return func(cfg *Config) { cfg.requestHooks = append(cfg.requestHooks, middleware) @@ -151,6 +163,7 @@ func RequestMiddleware(middleware graphql.ResponseMiddleware) Option { // WebsocketInitFunc is called when the server receives connection init message from the client. // This can be used to check initial payload to see whether to accept the websocket connection. +// Deprecated: switch to graphql/handler.New func WebsocketInitFunc(websocketInitFunc transport.WebsocketInitFunc) Option { return func(cfg *Config) { cfg.websocketInitFunc = websocketInitFunc @@ -159,6 +172,7 @@ func WebsocketInitFunc(websocketInitFunc transport.WebsocketInitFunc) Option { // CacheSize sets the maximum size of the query cache. // If size is less than or equal to 0, the cache is disabled. +// Deprecated: switch to graphql/handler.New func CacheSize(size int) Option { return func(cfg *Config) { cfg.cacheSize = size @@ -167,6 +181,7 @@ func CacheSize(size int) Option { // UploadMaxSize sets the maximum number of bytes used to parse a request body // as multipart/form-data. +// Deprecated: switch to graphql/handler.New func UploadMaxSize(size int64) Option { return func(cfg *Config) { cfg.uploadMaxSize = size @@ -176,6 +191,7 @@ func UploadMaxSize(size int64) Option { // UploadMaxMemory sets the maximum number of bytes used to parse a request body // as multipart/form-data in memory, with the remainder stored on disk in // temporary files. +// Deprecated: switch to graphql/handler.New func UploadMaxMemory(size int64) Option { return func(cfg *Config) { cfg.uploadMaxMemory = size @@ -186,6 +202,7 @@ func UploadMaxMemory(size int64) Option { // By default, keepalive is enabled with a DefaultConnectionKeepAlivePingInterval // duration. Set handler.connectionKeepAlivePingInterval = 0 to disable keepalive // altogether. +// Deprecated: switch to graphql/handler.New func WebsocketKeepAliveDuration(duration time.Duration) Option { return func(cfg *Config) { cfg.connectionKeepAlivePingInterval = duration @@ -193,6 +210,7 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option { } // Add cache that will hold queries for automatic persisted queries (APQ) +// Deprecated: switch to graphql/handler.New func EnablePersistedQueryCache(cache PersistedQueryCache) Option { return func(cfg *Config) { cfg.apqCache = cache @@ -218,3 +236,11 @@ type PersistedQueryCache interface { Add(ctx context.Context, hash string, query string) Get(ctx context.Context, hash string) (string, bool) } + +// Deprecated: use playground.Handler instead +func Playground(title string, endpoint string) http.HandlerFunc { + return playground.Handler(title, endpoint) +} + +// Deprecated: use transport.InitPayload instead +type InitPayload = transport.InitPayload From 0a39ae206916d607fcf8c7fb07a167d0b48c8933 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 12:24:28 +1100 Subject: [PATCH 35/53] add fixed complexity limit --- graphql/handler/extension/complexity.go | 7 +++++++ graphql/handler/extension/complexity_test.go | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index da2b15e851e..01e5d4624d1 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -15,6 +15,13 @@ type ComplexityLimit func(ctx context.Context, rc *graphql.OperationContext) int var _ graphql.OperationContextMutator = ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { return 0 }) +// FixedComplexityLimit sets a complexity limit that does not change +func FixedComplexityLimit(limit int) graphql.HandlerExtension { + return ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { + return limit + }) +} + func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { es := graphql.GetServerContext(ctx) op := rc.Doc.Operations.ForName(rc.OperationName) diff --git a/graphql/handler/extension/complexity_test.go b/graphql/handler/extension/complexity_test.go index 9ee1b398bd4..fbf8c4710ae 100644 --- a/graphql/handler/extension/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -46,6 +46,26 @@ func TestHandlerComplexity(t *testing.T) { }) } +func TestFixedComplexity(t *testing.T) { + h := testserver.New() + h.Use(extension.FixedComplexityLimit(2)) + h.AddTransport(&transport.POST{}) + + t.Run("below complexity limit", func(t *testing.T) { + h.SetCalculatedComplexity(2) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) + + t.Run("above complexity limit", func(t *testing.T) { + h.SetCalculatedComplexity(4) + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) + require.Equal(t, `{"errors":[{"message":"operation has complexity 4, which exceeds the limit of 2"}],"data":null}`, resp.Body.String()) + }) +} + func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { r := httptest.NewRequest(method, target, strings.NewReader(body)) r.Header.Set("Content-Type", "application/json") From fc727c9cd7663a874d3dcdccdbb096f385934dfd Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 12:29:23 +1100 Subject: [PATCH 36/53] Add a signpost method to handler extension interface --- graphql/handler.go | 6 ++++-- graphql/handler/apollotracing/tracer.go | 4 ++++ graphql/handler/extension/apq.go | 4 ++++ graphql/handler/extension/complexity.go | 4 ++++ graphql/handler/extension/introspection.go | 4 ++++ graphql/handler/server.go | 12 ++++++++++++ graphql/recovery.go | 4 ++++ 7 files changed, 36 insertions(+), 2 deletions(-) diff --git a/graphql/handler.go b/graphql/handler.go index 0177b001c23..01ff4e73253 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -34,7 +34,7 @@ type ( DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context) } - // HandlerExtension interface is entirely optional, see the list of possible hook points below + // HandlerExtension adds functionality to the http handler. See the list of possible hook points below // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen // before working with these // @@ -46,7 +46,9 @@ type ( // | | RESPONSE { "data": { "chat": { "message": "byee" } } } | | // | +--------------------------------------------------------------------+ | // +------------------------------------------------------------------------+ - HandlerExtension interface{} + HandlerExtension interface { + ExtensionName() string + } // OperationParameterMutator is called before creating a request context. allows manipulating the raw query // on the way in. diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 4c875fc006b..b2f550c38c0 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -42,6 +42,10 @@ type ( var _ graphql.ResponseInterceptor = Tracer{} var _ graphql.FieldInterceptor = Tracer{} +func (a Tracer) ExtensionName() string { + return "ApolloTracing" +} + func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { rc := graphql.GetOperationContext(ctx) td, ok := graphql.GetExtension(ctx, "tracing").(*TracingExtension) diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index 4b01afb2c91..1354550eada 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -20,6 +20,10 @@ type AutomaticPersistedQuery struct { Cache graphql.Cache } +func (a AutomaticPersistedQuery) ExtensionName() string { + return "AutomaticPersistedQuery" +} + func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *graphql.RawParams) error { if rawParams.Extensions["persistedQuery"] == nil { return nil diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index 01e5d4624d1..26f881b67dc 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -22,6 +22,10 @@ func FixedComplexityLimit(limit int) graphql.HandlerExtension { }) } +func (c ComplexityLimit) ExtensionName() string { + return "ComplexityLimit" +} + func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { es := graphql.GetServerContext(ctx) op := rc.Doc.Operations.ForName(rc.OperationName) diff --git a/graphql/handler/extension/introspection.go b/graphql/handler/extension/introspection.go index 1af70418e17..a5610c2b1d9 100644 --- a/graphql/handler/extension/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -12,6 +12,10 @@ type Introspection struct{} var _ graphql.OperationContextMutator = Introspection{} +func (c Introspection) ExtensionName() string { + return "Introspection" +} + func (c Introspection) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { rc.DisableIntrospection = false return nil diff --git a/graphql/handler/server.go b/graphql/handler/server.go index ae2680dce1b..bfb35dfcb78 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -153,18 +153,30 @@ func sendErrorf(w http.ResponseWriter, code int, format string, args ...interfac type OperationFunc func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler +func (r OperationFunc) ExtensionName() string { + return "InlineOperationFunc" +} + func (r OperationFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { return r(ctx, next) } type ResponseFunc func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response +func (r ResponseFunc) ExtensionName() string { + return "InlineResponseFunc" +} + func (r ResponseFunc) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { return r(ctx, next) } type FieldFunc func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) +func (f FieldFunc) ExtensionName() string { + return "InlineFieldFunc" +} + func (f FieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { return f(ctx, next) } diff --git a/graphql/recovery.go b/graphql/recovery.go index fbd18556d4f..a999252f6ca 100644 --- a/graphql/recovery.go +++ b/graphql/recovery.go @@ -22,6 +22,10 @@ func DefaultRecover(ctx context.Context, err interface{}) error { var _ OperationContextMutator = RecoverFunc(nil) +func (f RecoverFunc) ExtensionName() string { + return "RecoverFunc" +} + func (f RecoverFunc) MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error { rc.Recover = f return nil From e9502ae042f901e85731b39316d5d4687e3709f9 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 12:36:07 +1100 Subject: [PATCH 37/53] Make extensions validatable --- graphql/handler.go | 1 + graphql/handler/apollotracing/tracer.go | 4 ++++ graphql/handler/extension/apq.go | 8 +++++++ graphql/handler/extension/complexity.go | 8 +++++++ graphql/handler/extension/introspection.go | 4 ++++ graphql/handler/server.go | 25 ++++++++++++++++++++++ graphql/recovery.go | 7 ++++++ 7 files changed, 57 insertions(+) diff --git a/graphql/handler.go b/graphql/handler.go index 01ff4e73253..388de65092f 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -48,6 +48,7 @@ type ( // +------------------------------------------------------------------------+ HandlerExtension interface { ExtensionName() string + Validate() error } // OperationParameterMutator is called before creating a request context. allows manipulating the raw query diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index b2f550c38c0..ce790aa718c 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -46,6 +46,10 @@ func (a Tracer) ExtensionName() string { return "ApolloTracing" } +func (a Tracer) Validate() error { + return nil +} + func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { rc := graphql.GetOperationContext(ctx) td, ok := graphql.GetExtension(ctx, "tracing").(*TracingExtension) diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index 1354550eada..d22120454ea 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "encoding/hex" "errors" + "fmt" "github.com/99designs/gqlgen/graphql" "github.com/mitchellh/mapstructure" @@ -24,6 +25,13 @@ func (a AutomaticPersistedQuery) ExtensionName() string { return "AutomaticPersistedQuery" } +func (a AutomaticPersistedQuery) Validate() error { + if a.Cache == nil { + return fmt.Errorf("AutomaticPersistedQuery.Cache can not be nil") + } + return nil +} + func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *graphql.RawParams) error { if rawParams.Extensions["persistedQuery"] == nil { return nil diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index 26f881b67dc..d9db9659d3e 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -2,6 +2,7 @@ package extension import ( "context" + "fmt" "github.com/99designs/gqlgen/complexity" "github.com/99designs/gqlgen/graphql" @@ -26,6 +27,13 @@ func (c ComplexityLimit) ExtensionName() string { return "ComplexityLimit" } +func (c ComplexityLimit) Validate() error { + if c == nil { + return fmt.Errorf("ComplexityLimit func can not be nil") + } + return nil +} + func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { es := graphql.GetServerContext(ctx) op := rc.Doc.Operations.ForName(rc.OperationName) diff --git a/graphql/handler/extension/introspection.go b/graphql/handler/extension/introspection.go index a5610c2b1d9..5e20c420853 100644 --- a/graphql/handler/extension/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -16,6 +16,10 @@ func (c Introspection) ExtensionName() string { return "Introspection" } +func (c Introspection) Validate() error { + return nil +} + func (c Introspection) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { rc.DisableIntrospection = false return nil diff --git a/graphql/handler/server.go b/graphql/handler/server.go index bfb35dfcb78..f673798d8e3 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -78,6 +78,10 @@ func (s *Server) SetQueryCache(cache graphql.Cache) { } func (s *Server) Use(extension graphql.HandlerExtension) { + if err := extension.Validate(); err != nil { + panic(err) + } + switch extension.(type) { case graphql.OperationParameterMutator, graphql.OperationContextMutator, @@ -157,6 +161,13 @@ func (r OperationFunc) ExtensionName() string { return "InlineOperationFunc" } +func (r OperationFunc) Validate() error { + if r == nil { + return fmt.Errorf("OperationFunc can not be nil") + } + return nil +} + func (r OperationFunc) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { return r(ctx, next) } @@ -167,6 +178,13 @@ func (r ResponseFunc) ExtensionName() string { return "InlineResponseFunc" } +func (r ResponseFunc) Validate() error { + if r == nil { + return fmt.Errorf("ResponseFunc can not be nil") + } + return nil +} + func (r ResponseFunc) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { return r(ctx, next) } @@ -177,6 +195,13 @@ func (f FieldFunc) ExtensionName() string { return "InlineFieldFunc" } +func (f FieldFunc) Validate() error { + if f == nil { + return fmt.Errorf("FieldFunc can not be nil") + } + return nil +} + func (f FieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { return f(ctx, next) } diff --git a/graphql/recovery.go b/graphql/recovery.go index a999252f6ca..7fb97760db9 100644 --- a/graphql/recovery.go +++ b/graphql/recovery.go @@ -26,6 +26,13 @@ func (f RecoverFunc) ExtensionName() string { return "RecoverFunc" } +func (f RecoverFunc) Validate() error { + if f == nil { + return fmt.Errorf("RecoverFunc can not be nil") + } + return nil +} + func (f RecoverFunc) MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error { rc.Recover = f return nil From 67fa21049567aff73f5ae019683a14b7b03a496d Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 13:55:24 +1100 Subject: [PATCH 38/53] allow extensions to declare their own stats --- graphql/handler.go | 1 + graphql/handler/executor.go | 16 ++++++- graphql/handler/extension/complexity.go | 27 ++++++++++- graphql/handler/extension/complexity_test.go | 48 ++++++++++++++++++++ graphql/handler/transport/http_form.go | 3 +- graphql/handler/transport/http_get.go | 3 +- graphql/handler/transport/http_post.go | 3 +- graphql/handler/transport/websocket.go | 3 +- graphql/stats.go | 4 ++ 9 files changed, 102 insertions(+), 6 deletions(-) diff --git a/graphql/handler.go b/graphql/handler.go index 388de65092f..852222a262e 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -32,6 +32,7 @@ type ( GraphExecutor interface { CreateOperationContext(ctx context.Context, params *RawParams) (*OperationContext, gqlerror.List) DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context) + DispatchError(ctx context.Context, list gqlerror.List) *Response } // HandlerExtension adds functionality to the http handler. See the list of possible hook points below diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index c4890bf2589..6248cfab08d 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -120,6 +120,7 @@ func (e executor) CreateOperationContext(ctx context.Context, params *graphql.Ra stats := graphql.Stats{ OperationStart: graphql.GetStartTime(ctx), + Extension: map[string]interface{}{}, } for _, p := range e.operationParameterMutators { if err := p.MutateOperationParameters(ctx, params); err != nil { @@ -157,13 +158,26 @@ func (e executor) CreateOperationContext(ctx context.Context, params *graphql.Ra for _, p := range e.operationContextMutators { if err := p.MutateOperationContext(ctx, rc); err != nil { - return nil, gqlerror.List{err} + return rc, gqlerror.List{err} } } return rc, nil } +func (e executor) DispatchError(ctx context.Context, list gqlerror.List) *graphql.Response { + ctx = graphql.WithResponseContext(ctx, e.server.errorPresenter, e.server.recoverFunc) + resp := e.responseMiddleware(ctx, func(ctx context.Context) *graphql.Response { + resp := &graphql.Response{ + Errors: list, + } + resp.Extensions = graphql.GetExtensions(ctx) + return resp + }) + + return resp +} + // parseQuery decodes the incoming query and validates it, pulling from cache if present. // // NOTE: This should NOT look at variables, they will change per request. It should only parse and validate diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index d9db9659d3e..3b95429d7e6 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -16,6 +16,16 @@ type ComplexityLimit func(ctx context.Context, rc *graphql.OperationContext) int var _ graphql.OperationContextMutator = ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { return 0 }) +const complexityExtension = "ComplexityLimit" + +type ComplexityStats struct { + // The calculated complexity for this request + Complexity int + + // The complexity limit for this request returned by the extension func + ComplexityLimit int +} + // FixedComplexityLimit sets a complexity limit that does not change func FixedComplexityLimit(limit int) graphql.HandlerExtension { return ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { @@ -24,7 +34,7 @@ func FixedComplexityLimit(limit int) graphql.HandlerExtension { } func (c ComplexityLimit) ExtensionName() string { - return "ComplexityLimit" + return complexityExtension } func (c ComplexityLimit) Validate() error { @@ -41,9 +51,24 @@ func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql limit := c(ctx, rc) + rc.Stats.Extension[complexityExtension] = &ComplexityStats{ + Complexity: complexity, + ComplexityLimit: limit, + } + if complexity > limit { return gqlerror.Errorf("operation has complexity %d, which exceeds the limit of %d", complexity, limit) } return nil } + +func GetComplexityStats(ctx context.Context) *ComplexityStats { + rc := graphql.GetRequestContext(ctx) + if rc == nil { + return nil + } + + s, _ := rc.Stats.Extension[complexityExtension].(*ComplexityStats) + return s +} diff --git a/graphql/handler/extension/complexity_test.go b/graphql/handler/extension/complexity_test.go index fbf8c4710ae..d8c55a09336 100644 --- a/graphql/handler/extension/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -2,6 +2,7 @@ package extension_test import ( "context" + "fmt" "net/http" "net/http/httptest" "strings" @@ -12,6 +13,7 @@ import ( "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/gqlerror" ) func TestHandlerComplexity(t *testing.T) { @@ -23,26 +25,43 @@ func TestHandlerComplexity(t *testing.T) { return 2 })) h.AddTransport(&transport.POST{}) + var stats *extension.ComplexityStats + h.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + stats = extension.GetComplexityStats(ctx) + return next(ctx) + }) t.Run("below complexity limit", func(t *testing.T) { + stats = nil h.SetCalculatedComplexity(2) resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + require.Equal(t, 2, stats.ComplexityLimit) + require.Equal(t, 2, stats.Complexity) }) t.Run("above complexity limit", func(t *testing.T) { + stats = nil h.SetCalculatedComplexity(4) resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"operation has complexity 4, which exceeds the limit of 2"}],"data":null}`, resp.Body.String()) + + require.Equal(t, 2, stats.ComplexityLimit) + require.Equal(t, 4, stats.Complexity) }) t.Run("within dynamic complexity limit", func(t *testing.T) { + stats = nil h.SetCalculatedComplexity(4) resp := doRequest(h, "POST", "/graphql", `{"query":"{ ok: name }"}`) require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + require.Equal(t, 4, stats.ComplexityLimit) + require.Equal(t, 4, stats.Complexity) }) } @@ -51,11 +70,20 @@ func TestFixedComplexity(t *testing.T) { h.Use(extension.FixedComplexityLimit(2)) h.AddTransport(&transport.POST{}) + var stats *extension.ComplexityStats + h.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + stats = extension.GetComplexityStats(ctx) + return next(ctx) + }) + t.Run("below complexity limit", func(t *testing.T) { h.SetCalculatedComplexity(2) resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + require.Equal(t, 2, stats.ComplexityLimit) + require.Equal(t, 2, stats.Complexity) }) t.Run("above complexity limit", func(t *testing.T) { @@ -63,6 +91,9 @@ func TestFixedComplexity(t *testing.T) { resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }"}`) require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"operation has complexity 4, which exceeds the limit of 2"}],"data":null}`, resp.Body.String()) + + require.Equal(t, 2, stats.ComplexityLimit) + require.Equal(t, 4, stats.Complexity) }) } @@ -74,3 +105,20 @@ func doRequest(handler http.Handler, method string, target string, body string) handler.ServeHTTP(w, r) return w } + +type operationMutatorFunc func(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error + +func (r operationMutatorFunc) ExtensionName() string { + return "operationMutatorFunc" +} + +func (r operationMutatorFunc) Validate() error { + if r == nil { + return fmt.Errorf("operationMutatorFunc can not be nil") + } + return nil +} + +func (r operationMutatorFunc) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { + return r(ctx, rc) +} diff --git a/graphql/handler/transport/http_form.go b/graphql/handler/transport/http_form.go index 6d7a5acd531..a8f5b80a5f5 100644 --- a/graphql/handler/transport/http_form.go +++ b/graphql/handler/transport/http_form.go @@ -191,7 +191,8 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G rc, gerr := exec.CreateOperationContext(r.Context(), ¶ms) if gerr != nil { w.WriteHeader(http.StatusUnprocessableEntity) - write.GraphqlErr(gerr...) + resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), gerr) + write(graphql.StatusValidationError, resp) return } responses, ctx := exec.DispatchOperation(r.Context(), rc) diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 1ba9757a21f..5afac2149b3 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -63,7 +63,8 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut rc, err := exec.CreateOperationContext(r.Context(), raw) if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) - write.GraphqlErr(err...) + resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), err) + write(graphql.StatusValidationError, resp) return } op := rc.Doc.Operations.ForName(rc.OperationName) diff --git a/graphql/handler/transport/http_post.go b/graphql/handler/transport/http_post.go index 020b540f3ca..09b9910f185 100644 --- a/graphql/handler/transport/http_post.go +++ b/graphql/handler/transport/http_post.go @@ -55,7 +55,8 @@ func (h POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecu rc, err := exec.CreateOperationContext(r.Context(), params) if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) - write.GraphqlErr(err...) + resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), err) + write(graphql.StatusValidationError, resp) return } responses, ctx := exec.DispatchOperation(r.Context(), rc) diff --git a/graphql/handler/transport/websocket.go b/graphql/handler/transport/websocket.go index 49e4ffe1db2..bbbc2c1a241 100644 --- a/graphql/handler/transport/websocket.go +++ b/graphql/handler/transport/websocket.go @@ -200,7 +200,8 @@ func (c *wsConnection) subscribe(message *operationMessage) bool { rc, err := c.exec.CreateOperationContext(ctx, params) if err != nil { - c.sendError(message.ID, err...) + resp := c.exec.DispatchError(graphql.WithOperationContext(ctx, rc), err) + c.sendError(message.ID, resp.Errors...) return false } diff --git a/graphql/stats.go b/graphql/stats.go index bc695a9fb92..8210665f9cb 100644 --- a/graphql/stats.go +++ b/graphql/stats.go @@ -10,6 +10,10 @@ type Stats struct { OperationStart time.Time Parsing TraceTiming Validation TraceTiming + + // Stats collected by handler extensions. Dont use directly, the extension should provide a type safe way to + // access this. + Extension map[string]interface{} } type TraceTiming struct { From 7cbd75db593854ac3be66fa66a3248a4b0acf6a9 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 14:17:27 +1100 Subject: [PATCH 39/53] fix APQ signature --- graphql/handler/extension/apq.go | 15 ++++++++----- graphql/handler/extension/apq_test.go | 32 +++++++++++++-------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index d22120454ea..e4297a1ba26 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -4,9 +4,10 @@ import ( "context" "crypto/sha256" "encoding/hex" - "errors" "fmt" + "github.com/vektah/gqlparser/gqlerror" + "github.com/99designs/gqlgen/graphql" "github.com/mitchellh/mapstructure" ) @@ -21,6 +22,8 @@ type AutomaticPersistedQuery struct { Cache graphql.Cache } +var _ graphql.OperationParameterMutator = AutomaticPersistedQuery{} + func (a AutomaticPersistedQuery) ExtensionName() string { return "AutomaticPersistedQuery" } @@ -32,7 +35,7 @@ func (a AutomaticPersistedQuery) Validate() error { return nil } -func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *graphql.RawParams) error { +func (a AutomaticPersistedQuery) MutateOperationParameters(ctx context.Context, rawParams *graphql.RawParams) *gqlerror.Error { if rawParams.Extensions["persistedQuery"] == nil { return nil } @@ -43,24 +46,24 @@ func (a AutomaticPersistedQuery) MutateRequest(ctx context.Context, rawParams *g } if err := mapstructure.Decode(rawParams.Extensions["persistedQuery"], &extension); err != nil { - return errors.New("invalid APQ extension data") + return gqlerror.Errorf("invalid APQ extension data") } if extension.Version != 1 { - return errors.New("unsupported APQ version") + return gqlerror.Errorf("unsupported APQ version") } if rawParams.Query == "" { // client sent optimistic query hash without query string, get it from the cache query, ok := a.Cache.Get(extension.Sha256) if !ok { - return errors.New(errPersistedQueryNotFound) + return gqlerror.Errorf(errPersistedQueryNotFound) } rawParams.Query = query.(string) } else { // client sent optimistic query hash with query string, verify and store it if computeQueryHash(rawParams.Query) != extension.Sha256 { - return errors.New("provided APQ hash does not match query") + return gqlerror.Errorf("provided APQ hash does not match query") } a.Cache.Add(extension.Sha256, rawParams.Query) } diff --git a/graphql/handler/extension/apq_test.go b/graphql/handler/extension/apq_test.go index 0add620e889..824516260ae 100644 --- a/graphql/handler/extension/apq_test.go +++ b/graphql/handler/extension/apq_test.go @@ -16,8 +16,8 @@ func TestAPQ(t *testing.T) { params := &graphql.RawParams{ Query: "original query", } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.NoError(t, err) + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + require.Nil(t, err) require.Equal(t, "original query", params.Query) }) @@ -32,8 +32,8 @@ func TestAPQ(t *testing.T) { }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "PersistedQueryNotFound") + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + require.Equal(t, err.Message, "PersistedQueryNotFound") }) t.Run("with hash miss and query", func(t *testing.T) { @@ -47,8 +47,8 @@ func TestAPQ(t *testing.T) { }, } cache := graphql.MapCache{} - err := AutomaticPersistedQuery{cache}.MutateRequest(context.Background(), params) - require.NoError(t, err) + err := AutomaticPersistedQuery{cache}.MutateOperationParameters(context.Background(), params) + require.Nil(t, err) require.Equal(t, "{ me { name } }", params.Query) require.Equal(t, "{ me { name } }", cache[hash]) @@ -65,8 +65,8 @@ func TestAPQ(t *testing.T) { }, } cache := graphql.MapCache{} - err := AutomaticPersistedQuery{cache}.MutateRequest(context.Background(), params) - require.NoError(t, err) + err := AutomaticPersistedQuery{cache}.MutateOperationParameters(context.Background(), params) + require.Nil(t, err) require.Equal(t, "{ me { name } }", params.Query) require.Equal(t, "{ me { name } }", cache[hash]) @@ -84,8 +84,8 @@ func TestAPQ(t *testing.T) { cache := graphql.MapCache{ hash: query, } - err := AutomaticPersistedQuery{cache}.MutateRequest(context.Background(), params) - require.NoError(t, err) + err := AutomaticPersistedQuery{cache}.MutateOperationParameters(context.Background(), params) + require.Nil(t, err) require.Equal(t, "{ me { name } }", params.Query) }) @@ -97,8 +97,8 @@ func TestAPQ(t *testing.T) { }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "invalid APQ extension data") + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + require.Equal(t, err.Message, "invalid APQ extension data") }) t.Run("with invalid extension version", func(t *testing.T) { @@ -109,8 +109,8 @@ func TestAPQ(t *testing.T) { }, }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "unsupported APQ version") + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + require.Equal(t, err.Message, "unsupported APQ version") }) t.Run("with hash mismatch", func(t *testing.T) { @@ -124,7 +124,7 @@ func TestAPQ(t *testing.T) { }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateRequest(context.Background(), params) - require.EqualError(t, err, "provided APQ hash does not match query") + err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + require.Equal(t, err.Message, "provided APQ hash does not match query") }) } From 0ee185b811db5d81286e02d90e2bf5cfbd424b9a Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 14:37:29 +1100 Subject: [PATCH 40/53] fix duplicate header sends --- graphql/handler.go | 28 --------- graphql/handler/transport/http_form.go | 66 ++++++++++----------- graphql/handler/transport/http_form_test.go | 10 ++-- graphql/handler/transport/http_get.go | 24 ++------ graphql/handler/transport/http_post.go | 22 +------ graphql/handler/transport/util.go | 30 ++++++++++ 6 files changed, 75 insertions(+), 105 deletions(-) create mode 100644 graphql/handler/transport/util.go diff --git a/graphql/handler.go b/graphql/handler.go index 852222a262e..2ecc37e5cd6 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -2,7 +2,6 @@ package graphql import ( "context" - "fmt" "net/http" "strconv" "strings" @@ -11,8 +10,6 @@ import ( ) type ( - Writer func(Status, *Response) - OperationMiddleware func(ctx context.Context, next OperationHandler) ResponseHandler OperationHandler func(ctx context.Context) ResponseHandler @@ -89,31 +86,6 @@ type ( type Status int -const ( - StatusOk Status = iota - StatusParseError - StatusValidationError - StatusResolverError -) - -func (w Writer) Errorf(format string, args ...interface{}) { - w(StatusResolverError, &Response{ - Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}, - }) -} - -func (w Writer) Error(msg string) { - w(StatusResolverError, &Response{ - Errors: gqlerror.List{{Message: msg}}, - }) -} - -func (w Writer) GraphqlErr(err ...*gqlerror.Error) { - w(StatusResolverError, &Response{ - Errors: err, - }) -} - func (p *RawParams) AddUpload(upload Upload, key, path string) *gqlerror.Error { if !strings.HasPrefix(path, "variables.") { return gqlerror.Errorf("invalid operations paths for key %s", key) diff --git a/graphql/handler/transport/http_form.go b/graphql/handler/transport/http_form.go index a8f5b80a5f5..3418993a043 100644 --- a/graphql/handler/transport/http_form.go +++ b/graphql/handler/transport/http_form.go @@ -56,33 +56,19 @@ func (f MultipartForm) maxMemory() int64 { func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { w.Header().Set("Content-Type", "application/json") - write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { - switch status { - case graphql.StatusOk, graphql.StatusResolverError: - w.WriteHeader(http.StatusOK) - case graphql.StatusParseError, graphql.StatusValidationError: - w.WriteHeader(http.StatusUnprocessableEntity) - } - - b, err := json.Marshal(response) - if err != nil { - panic(err) - } - w.Write(b) - }) - var err error if r.ContentLength > f.maxUploadSize() { - write.Errorf("failed to parse multipart form, request body too large") + writeJsonError(w, "failed to parse multipart form, request body too large") return } r.Body = http.MaxBytesReader(w, r.Body, f.maxUploadSize()) if err = r.ParseMultipartForm(f.maxUploadSize()); err != nil { + w.WriteHeader(http.StatusUnprocessableEntity) if strings.Contains(err.Error(), "request body too large") { - write.Errorf("failed to parse multipart form, request body too large") + writeJsonError(w, "failed to parse multipart form, request body too large") return } - write.Errorf("failed to parse multipart form") + writeJsonError(w, "failed to parse multipart form") return } defer r.Body.Close() @@ -90,25 +76,29 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G var params graphql.RawParams if err = jsonDecode(strings.NewReader(r.Form.Get("operations")), ¶ms); err != nil { - write.Errorf("operations form field could not be decoded") + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonError(w, "operations form field could not be decoded") return } var uploadsMap = map[string][]string{} if err = json.Unmarshal([]byte(r.Form.Get("map")), &uploadsMap); err != nil { - write.Errorf("map form field could not be decoded") + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonError(w, "map form field could not be decoded") return } var upload graphql.Upload for key, paths := range uploadsMap { if len(paths) == 0 { - write.Errorf("invalid empty operations paths list for key %s", key) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonErrorf(w, "invalid empty operations paths list for key %s", key) return } file, header, err := r.FormFile(key) if err != nil { - write.Errorf("failed to get key %s from form", key) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonErrorf(w, "failed to get key %s from form", key) return } defer file.Close() @@ -121,14 +111,16 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G } if err := params.AddUpload(upload, key, paths[0]); err != nil { - write.GraphqlErr(err) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonGraphqlError(w, err) return } } else { if r.ContentLength < f.maxMemory() { fileBytes, err := ioutil.ReadAll(file) if err != nil { - write.Errorf("failed to read file for key %s", key) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonErrorf(w, "failed to read file for key %s", key) return } for _, path := range paths { @@ -139,14 +131,16 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G } if err := params.AddUpload(upload, key, path); err != nil { - write.GraphqlErr(err) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonGraphqlError(w, err) return } } } else { tmpFile, err := ioutil.TempFile(os.TempDir(), "gqlgen-") if err != nil { - write.Errorf("failed to create temp file for key %s", key) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonErrorf(w, "failed to create temp file for key %s", key) return } tmpName := tmpFile.Name() @@ -155,21 +149,24 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G }() _, err = io.Copy(tmpFile, file) if err != nil { + w.WriteHeader(http.StatusUnprocessableEntity) if err := tmpFile.Close(); err != nil { - write.Errorf("failed to copy to temp file and close temp file for key %s", key) + writeJsonErrorf(w, "failed to copy to temp file and close temp file for key %s", key) return } - write.Errorf("failed to copy to temp file for key %s", key) + writeJsonErrorf(w, "failed to copy to temp file for key %s", key) return } if err := tmpFile.Close(); err != nil { - write.Errorf("failed to close temp file for key %s", key) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonErrorf(w, "failed to close temp file for key %s", key) return } for _, path := range paths { pathTmpFile, err := os.Open(tmpName) if err != nil { - write.Errorf("failed to open temp file for key %s", key) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonErrorf(w, "failed to open temp file for key %s", key) return } defer pathTmpFile.Close() @@ -180,7 +177,8 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G } if err := params.AddUpload(upload, key, path); err != nil { - write.GraphqlErr(err) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJsonGraphqlError(w, err) return } } @@ -190,11 +188,11 @@ func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.G rc, gerr := exec.CreateOperationContext(r.Context(), ¶ms) if gerr != nil { - w.WriteHeader(http.StatusUnprocessableEntity) resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), gerr) - write(graphql.StatusValidationError, resp) + w.WriteHeader(http.StatusUnprocessableEntity) + writeJson(w, resp) return } responses, ctx := exec.DispatchOperation(r.Context(), rc) - write(graphql.StatusResolverError, responses(ctx)) + writeJson(w, responses(ctx)) } diff --git a/graphql/handler/transport/http_form_test.go b/graphql/handler/transport/http_form_test.go index 0df529d4662..b41e216e559 100644 --- a/graphql/handler/transport/http_form_test.go +++ b/graphql/handler/transport/http_form_test.go @@ -204,7 +204,7 @@ func TestFileUpload(t *testing.T) { } resp := httptest.NewRecorder() h.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"failed to parse multipart form"}],"data":null}`, resp.Body.String()) }) @@ -214,7 +214,7 @@ func TestFileUpload(t *testing.T) { resp := httptest.NewRecorder() h.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"operations form field could not be decoded"}],"data":null}`, resp.Body.String()) }) @@ -224,7 +224,7 @@ func TestFileUpload(t *testing.T) { resp := httptest.NewRecorder() h.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"map form field could not be decoded"}],"data":null}`, resp.Body.String()) }) @@ -234,7 +234,7 @@ func TestFileUpload(t *testing.T) { resp := httptest.NewRecorder() h.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"failed to get key 0 from form"}],"data":null}`, resp.Body.String()) }) @@ -244,7 +244,7 @@ func TestFileUpload(t *testing.T) { resp := httptest.NewRecorder() h.ServeHTTP(resp, req) - require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) require.Equal(t, `{"errors":[{"message":"invalid operations paths for key 0"}],"data":null}`, resp.Body.String()) }) diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 5afac2149b3..d263c22158b 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -30,24 +30,10 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut OperationName: r.URL.Query().Get("operationName"), } - write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { - switch status { - case graphql.StatusOk, graphql.StatusResolverError: - w.WriteHeader(http.StatusOK) - case graphql.StatusParseError, graphql.StatusValidationError: - w.WriteHeader(http.StatusUnprocessableEntity) - } - b, err := json.Marshal(response) - if err != nil { - panic(err) - } - w.Write(b) - }) - if variables := r.URL.Query().Get("variables"); variables != "" { if err := jsonDecode(strings.NewReader(variables), &raw.Variables); err != nil { w.WriteHeader(http.StatusBadRequest) - write.Errorf("variables could not be decoded") + writeJsonError(w, "variables could not be decoded") return } } @@ -55,7 +41,7 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if extensions := r.URL.Query().Get("extensions"); extensions != "" { if err := jsonDecode(strings.NewReader(extensions), &raw.Extensions); err != nil { w.WriteHeader(http.StatusBadRequest) - write.Errorf("extensions could not be decoded") + writeJsonError(w, "extensions could not be decoded") return } } @@ -64,18 +50,18 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), err) - write(graphql.StatusValidationError, resp) + writeJson(w, resp) return } op := rc.Doc.Operations.ForName(rc.OperationName) if op.Operation != ast.Query { w.WriteHeader(http.StatusNotAcceptable) - write.Errorf("GET requests only allow query operations") + writeJsonError(w, "GET requests only allow query operations") return } responses, ctx := exec.DispatchOperation(r.Context(), rc) - write(graphql.StatusResolverError, responses(ctx)) + writeJson(w, responses(ctx)) } func jsonDecode(r io.Reader, val interface{}) error { diff --git a/graphql/handler/transport/http_post.go b/graphql/handler/transport/http_post.go index 09b9910f185..e024d97bd42 100644 --- a/graphql/handler/transport/http_post.go +++ b/graphql/handler/transport/http_post.go @@ -1,7 +1,6 @@ package transport import ( - "encoding/json" "mime" "net/http" @@ -30,25 +29,10 @@ func (h POST) Supports(r *http.Request) bool { func (h POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor) { w.Header().Set("Content-Type", "application/json") - write := graphql.Writer(func(status graphql.Status, response *graphql.Response) { - switch status { - case graphql.StatusOk, graphql.StatusResolverError: - w.WriteHeader(http.StatusOK) - case graphql.StatusParseError, graphql.StatusValidationError: - w.WriteHeader(http.StatusUnprocessableEntity) - } - - b, err := json.Marshal(response) - if err != nil { - panic(err) - } - w.Write(b) - }) - var params *graphql.RawParams if err := jsonDecode(r.Body, ¶ms); err != nil { w.WriteHeader(http.StatusBadRequest) - write.Errorf("json body could not be decoded: " + err.Error()) + writeJsonErrorf(w, "json body could not be decoded: "+err.Error()) return } @@ -56,9 +40,9 @@ func (h POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecu if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), err) - write(graphql.StatusValidationError, resp) + writeJson(w, resp) return } responses, ctx := exec.DispatchOperation(r.Context(), rc) - write(graphql.StatusResolverError, responses(ctx)) + writeJson(w, responses(ctx)) } diff --git a/graphql/handler/transport/util.go b/graphql/handler/transport/util.go new file mode 100644 index 00000000000..d2de3664304 --- /dev/null +++ b/graphql/handler/transport/util.go @@ -0,0 +1,30 @@ +package transport + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser/gqlerror" +) + +func writeJson(w io.Writer, response *graphql.Response) { + b, err := json.Marshal(response) + if err != nil { + panic(err) + } + w.Write(b) +} + +func writeJsonError(w io.Writer, msg string) { + writeJson(w, &graphql.Response{Errors: gqlerror.List{{Message: msg}}}) +} + +func writeJsonErrorf(w io.Writer, format string, args ...interface{}) { + writeJson(w, &graphql.Response{Errors: gqlerror.List{{Message: fmt.Sprintf(format, args...)}}}) +} + +func writeJsonGraphqlError(w io.Writer, err ...*gqlerror.Error) { + writeJson(w, &graphql.Response{Errors: err}) +} From a77d9fc29019a78bd0f4459251cf24ce3083723b Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 14:44:03 +1100 Subject: [PATCH 41/53] Add generated stanzas back in --- codegen/generate.go | 2 +- codegen/testserver/generated.go | 2 ++ example/chat/generated.go | 2 ++ example/config/generated.go | 2 ++ example/dataloader/generated.go | 2 ++ example/fileupload/generated.go | 2 ++ example/scalars/generated.go | 2 ++ example/selection/generated.go | 2 ++ example/starwars/generated/exec.go | 2 ++ example/todo/generated.go | 2 ++ example/type-system-extension/generated.go | 2 ++ integration/generated.go | 2 ++ 12 files changed, 23 insertions(+), 1 deletion(-) diff --git a/codegen/generate.go b/codegen/generate.go index a32e329e60c..eafa3f87434 100644 --- a/codegen/generate.go +++ b/codegen/generate.go @@ -10,6 +10,6 @@ func GenerateCode(data *Data) error { Filename: data.Config.Exec.Filename, Data: data, RegionTags: true, - GeneratedHeader: false, + GeneratedHeader: true, }) } diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 5eca48f7cd2..1fdb4601fc8 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package testserver import ( diff --git a/example/chat/generated.go b/example/chat/generated.go index 87928f53f1f..0a200af5322 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package chat import ( diff --git a/example/config/generated.go b/example/config/generated.go index dea8fafc91b..76fb16a48f5 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package config import ( diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 10500847fc6..1b5bf32ef26 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package dataloader import ( diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 221b473e638..8e0781b8cea 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package fileupload import ( diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 4f735596fd3..3b4d51b7634 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package scalars import ( diff --git a/example/selection/generated.go b/example/selection/generated.go index 4bdbb5c278d..61e862b7665 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package selection import ( diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index c24b9bbdf16..7157f1f796e 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package generated import ( diff --git a/example/todo/generated.go b/example/todo/generated.go index b59f468dc56..6f9e3ed3a28 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package todo import ( diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index b8dde8dfc0c..45557d74bc7 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package type_system_extension import ( diff --git a/integration/generated.go b/integration/generated.go index 63c52b732ed..fa633ca390f 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -1,3 +1,5 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + package integration import ( From 631b48a56ac159cd03dbc67e15f4a8dfef7dc266 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 14:49:00 +1100 Subject: [PATCH 42/53] remove automatic field stat collection to reduce time calls --- codegen/field.gotpl | 16 +- codegen/object.gotpl | 2 - codegen/testserver/generated.go | 2548 +++++++++----------- codegen/type.gotpl | 1 - example/chat/generated.go | 706 +++--- example/config/generated.go | 705 +++--- example/dataloader/generated.go | 803 +++--- example/fileupload/generated.go | 689 +++--- example/scalars/generated.go | 752 +++--- example/selection/generated.go | 702 +++--- example/starwars/generated/exec.go | 1186 ++++----- example/todo/generated.go | 689 +++--- example/type-system-extension/generated.go | 673 +++--- graphql/context_field.go | 3 - graphql/handler/apollotracing/tracer.go | 6 +- graphql/handler/testserver/testserver.go | 3 - integration/generated.go | 752 +++--- 17 files changed, 4424 insertions(+), 5812 deletions(-) diff --git a/codegen/field.gotpl b/codegen/field.gotpl index 431028e097d..993625b7419 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -5,20 +5,19 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex {{- if $object.Stream }} {{- $null = "nil" }} {{- end }} - fc := &graphql.FieldContext{ - Object: {{$object.Name|quote}}, - Field: field, - Args: nil, - IsMethod: {{or $field.IsMethod $field.IsResolver}}, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func () { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = {{ $null }} } }() + fc := &graphql.FieldContext{ + Object: {{$object.Name|quote}}, + Field: field, + Args: nil, + IsMethod: {{or $field.IsMethod $field.IsResolver}}, + } + ctx = graphql.WithFieldContext(ctx, fc) {{- if $field.Args }} rawArgs := field.ArgumentMap(ec.Variables) @@ -29,7 +28,6 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex } fc.Args = args {{- end }} - fc.Stats.ArgumentsCompleted = graphql.Now() {{- if $.Directives.LocationDirectives "FIELD" }} resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { {{ template "field" $field }} diff --git a/codegen/object.gotpl b/codegen/object.gotpl index 8dfef7c6fa7..33775a0b4c3 100644 --- a/codegen/object.gotpl +++ b/codegen/object.gotpl @@ -7,7 +7,6 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: {{$object.Name|quote}}, - Stats: graphql.FieldStats{Started: graphql.Now()}, }) if len(fields) != 1 { ec.Errorf(ctx, "must subscribe to exactly one stream") @@ -29,7 +28,6 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec {{if $object.Root}} ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: {{$object.Name|quote}}, - Stats: graphql.FieldStats{Started: graphql.Now()}, }) {{end}} diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 1fdb4601fc8..932f2ad61d7 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -2714,22 +2714,20 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "A", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "A", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2747,22 +2745,20 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi } func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.CollectedField, obj *AIt) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "AIt", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "AIt", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2780,22 +2776,20 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected } func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.CollectedField, obj *AbIt) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "AbIt", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "AbIt", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2813,22 +2807,20 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Autobind", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Autobind", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int, nil @@ -2846,22 +2838,20 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col } func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Autobind", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Autobind", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int32, nil @@ -2879,22 +2869,20 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C } func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Autobind", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Autobind", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int64, nil @@ -2912,22 +2900,20 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C } func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Autobind", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Autobind", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdStr, nil @@ -2945,22 +2931,20 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C } func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Autobind", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Autobind", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdInt, nil @@ -2978,22 +2962,20 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C } func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedField, obj *B) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "B", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "B", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3011,22 +2993,20 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi } func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Circle", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Circle", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Radius, nil @@ -3041,22 +3021,20 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co } func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Circle", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Circle", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -3071,22 +3049,20 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Content_Post", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Content_Post", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3101,22 +3077,20 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql } func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Content_User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Content_User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -3131,22 +3105,20 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql } func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, field graphql.CollectedField, obj *EmbeddedDefaultScalar) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "EmbeddedDefaultScalar", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "EmbeddedDefaultScalar", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil @@ -3161,22 +3133,20 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi } func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "EmbeddedPointer", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "EmbeddedPointer", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3191,22 +3161,20 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph } func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "EmbeddedPointer", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "EmbeddedPointer", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Title, nil @@ -3221,22 +3189,20 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr } func (ec *executionContext) _Error_id(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Error", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Error", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3254,22 +3220,20 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Error", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Error", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnNonRequiredField() @@ -3284,22 +3248,20 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, } func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Error", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Error", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnRequiredField() @@ -3317,22 +3279,20 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie } func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Error", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Error", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NilOnRequiredField(), nil @@ -3347,25 +3307,23 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field res := resTmp.(*string) fc.Result = res return ec.marshalNString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Errors", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } +} + +func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Errors", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().A(rctx, obj) @@ -3383,22 +3341,20 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Errors", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Errors", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().B(rctx, obj) @@ -3416,22 +3372,20 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Errors", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Errors", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().C(rctx, obj) @@ -3449,22 +3403,20 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Errors", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Errors", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().D(rctx, obj) @@ -3482,22 +3434,20 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Errors", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Errors", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().E(rctx, obj) @@ -3515,22 +3465,20 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect } func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field graphql.CollectedField, obj *ForcedResolver) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ForcedResolver", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ForcedResolver", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ForcedResolver().Field(rctx, obj) @@ -3545,22 +3493,20 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra } func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.CollectedField, obj *InnerObject) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "InnerObject", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "InnerObject", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3578,22 +3524,20 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C } func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field graphql.CollectedField, obj *invalid_packagename.InvalidIdentifier) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "InvalidIdentifier", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "InvalidIdentifier", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3611,22 +3555,20 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra } func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedField, obj *introspection1.It) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "It", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "It", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3644,22 +3586,20 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF } func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.CollectedField, obj *LoopA) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "LoopA", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "LoopA", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.B, nil @@ -3677,22 +3617,20 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.CollectedField, obj *LoopB) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "LoopB", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "LoopB", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.A, nil @@ -3710,22 +3648,20 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Map", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Map", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -3743,22 +3679,20 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected } func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MapStringInterfaceType", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MapStringInterfaceType", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["a"].(type) { @@ -3782,22 +3716,20 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field } func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MapStringInterfaceType", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MapStringInterfaceType", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["b"].(type) { @@ -3821,22 +3753,20 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field } func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ModelMethods", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ModelMethods", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ModelMethods().ResolverField(rctx, obj) @@ -3854,22 +3784,20 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie } func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ModelMethods", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ModelMethods", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NoContext(), nil @@ -3887,22 +3815,20 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g } func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ModelMethods", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ModelMethods", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.WithContext(ctx), nil @@ -3920,22 +3846,20 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field } func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ObjectDirectives", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ObjectDirectives", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -3985,22 +3909,20 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr } func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ObjectDirectives", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ObjectDirectives", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4035,22 +3957,20 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, } func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectivesWithCustomGoModel) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ObjectDirectivesWithCustomGoModel", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ObjectDirectivesWithCustomGoModel", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -4085,22 +4005,20 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx } func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphql.CollectedField, obj *OuterObject) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "OuterObject", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "OuterObject", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Inner, nil @@ -4118,22 +4036,20 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq } func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "OverlappingFields", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "OverlappingFields", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -4151,22 +4067,20 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "OverlappingFields", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "OverlappingFields", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil @@ -4184,22 +4098,20 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "OverlappingFields", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "OverlappingFields", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) @@ -4217,22 +4129,20 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "OverlappingFields", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "OverlappingFields", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil @@ -4250,22 +4160,20 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field } func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "OverlappingFields", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "OverlappingFields", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil @@ -4283,22 +4191,20 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel } func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Panics", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Panics", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) @@ -4316,20 +4222,19 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel } func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Panics", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Panics", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Panics_fieldFuncMarshal_args(ctx, rawArgs) @@ -4338,7 +4243,6 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FieldFuncMarshal(ctx, args["u"].([]MarshalPanic)), nil @@ -4356,20 +4260,19 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field } func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Panics", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Panics", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Panics_argUnmarshal_args(ctx, rawArgs) @@ -4378,7 +4281,6 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, args["u"].([]MarshalPanic)) @@ -4396,22 +4298,20 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap } func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Primitive", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Primitive", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Primitive().Value(rctx, obj) @@ -4429,22 +4329,20 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. } func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Primitive", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Primitive", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Squared(), nil @@ -4462,22 +4360,20 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq } func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "PrimitiveString", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "PrimitiveString", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Value(rctx, obj) @@ -4495,22 +4391,20 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr } func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "PrimitiveString", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "PrimitiveString", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Doubled(), nil @@ -4528,22 +4422,20 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field } func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "PrimitiveString", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "PrimitiveString", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Len(rctx, obj) @@ -4561,22 +4453,20 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap } func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InvalidIdentifier(rctx) @@ -4591,22 +4481,20 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field } func (ec *executionContext) _Query_collision(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Collision(rctx) @@ -4621,20 +4509,19 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. } func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapInput_args(ctx, rawArgs) @@ -4643,7 +4530,6 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapInput(rctx, args["input"].(map[string]interface{})) @@ -4658,20 +4544,19 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_recursive_args(ctx, rawArgs) @@ -4680,7 +4565,6 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Recursive(rctx, args["input"].(*RecursiveInputSlice)) @@ -4695,20 +4579,19 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. } func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_nestedInputs_args(ctx, rawArgs) @@ -4717,7 +4600,6 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedInputs(rctx, args["input"].([][]*OuterInput)) @@ -4730,24 +4612,22 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph fc.Result = res return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } - -func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } + +func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedOutputs(rctx) @@ -4762,22 +4642,20 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap } func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ModelMethods(rctx) @@ -4792,20 +4670,19 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_user_args(ctx, rawArgs) @@ -4814,7 +4691,6 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(int)) @@ -4832,20 +4708,19 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_nullableArg_args(ctx, rawArgs) @@ -4854,7 +4729,6 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NullableArg(rctx, args["arg"].(*int)) @@ -4869,20 +4743,19 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq } func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_inputSlice_args(ctx, rawArgs) @@ -4891,7 +4764,6 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InputSlice(rctx, args["arg"].([]string)) @@ -4909,22 +4781,20 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql } func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ShapeUnion(rctx) @@ -4942,22 +4812,20 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql } func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Autobind(rctx) @@ -4972,22 +4840,20 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DeprecatedField(rctx) @@ -5005,22 +4871,20 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr } func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Overlapping(rctx) @@ -5035,20 +4899,19 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq } func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveArg_args(ctx, rawArgs) @@ -5057,7 +4920,6 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveArg(rctx, args["arg"].(string)) @@ -5072,20 +4934,19 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph } func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveNullableArg_args(ctx, rawArgs) @@ -5094,7 +4955,6 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -5109,20 +4969,19 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie } func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInputNullable_args(ctx, rawArgs) @@ -5131,7 +4990,6 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputNullable(rctx, args["arg"].(*InputDirectives)) @@ -5146,20 +5004,19 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f } func (ec *executionContext) _Query_directiveInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInput_args(ctx, rawArgs) @@ -5168,7 +5025,6 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInput(rctx, args["arg"].(InputDirectives)) @@ -5183,20 +5039,19 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra } func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveInputType_args(ctx, rawArgs) @@ -5205,7 +5060,6 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputType(rctx, args["arg"].(InnerInput)) @@ -5220,22 +5074,20 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field } func (ec *executionContext) _Query_directiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObject(rctx) @@ -5250,22 +5102,20 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr } func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObjectWithCustomGoModel(rctx) @@ -5280,20 +5130,19 @@ func (ec *executionContext) _Query_directiveObjectWithCustomGoModel(ctx context. } func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_directiveFieldDef_args(ctx, rawArgs) @@ -5302,7 +5151,6 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5348,22 +5196,20 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field } func (ec *executionContext) _Query_directiveField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveField(rctx) @@ -5378,22 +5224,20 @@ func (ec *executionContext) _Query_directiveField(ctx context.Context, field gra } func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5434,22 +5278,20 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr } func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5484,22 +5326,20 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f } func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Shapes(rctx) @@ -5514,22 +5354,20 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -5564,20 +5402,19 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co } func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapStringInterface_args(ctx, rawArgs) @@ -5586,7 +5423,6 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapStringInterface(rctx, args["in"].(map[string]interface{})) @@ -5601,20 +5437,19 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field } func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_mapNestedStringInterface_args(ctx, rawArgs) @@ -5623,7 +5458,6 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapNestedStringInterface(rctx, args["in"].(*NestedMapInput)) @@ -5638,22 +5472,20 @@ func (ec *executionContext) _Query_mapNestedStringInterface(ctx context.Context, } func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ErrorBubble(rctx) @@ -5668,22 +5500,20 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq } func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Errors(rctx) @@ -5698,22 +5528,20 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Valid(rctx) @@ -5731,22 +5559,20 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Panics(rctx) @@ -5761,22 +5587,20 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveObject(rctx) @@ -5794,22 +5618,20 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr } func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveStringObject(rctx) @@ -5827,20 +5649,19 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi } func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_defaultScalar_args(ctx, rawArgs) @@ -5849,7 +5670,6 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DefaultScalar(rctx, args["arg"].(string)) @@ -5867,22 +5687,20 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap } func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Slices(rctx) @@ -5897,22 +5715,20 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ScalarSlice(rctx) @@ -5930,20 +5746,19 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq } func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_fallback_args(ctx, rawArgs) @@ -5952,7 +5767,6 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Fallback(rctx, args["arg"].(FallbackToStringEncoding)) @@ -5970,22 +5784,20 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().OptionalUnion(rctx) @@ -6000,22 +5812,20 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap } func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ValidType(rctx) @@ -6030,22 +5840,20 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. } func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedStruct(rctx) @@ -6063,22 +5871,20 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap } func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedScalar(rctx) @@ -6096,20 +5902,19 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -6118,7 +5923,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -6130,25 +5934,23 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -6163,22 +5965,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Rectangle", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Rectangle", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Length, nil @@ -6193,22 +5993,20 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql } func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Rectangle", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Rectangle", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Width, nil @@ -6223,22 +6021,20 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. } func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Rectangle", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Rectangle", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil @@ -6253,22 +6049,20 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C } func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Slices", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Slices", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test1, nil @@ -6283,22 +6077,20 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col } func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Slices", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Slices", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test2, nil @@ -6313,22 +6105,20 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col } func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Slices", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Slices", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test3, nil @@ -6346,22 +6136,20 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col } func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Slices", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Slices", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test4, nil @@ -6379,22 +6167,20 @@ func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.Col } func (ec *executionContext) _Subscription_updated(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().Updated(rctx) @@ -6422,22 +6208,20 @@ func (ec *executionContext) _Subscription_updated(ctx context.Context, field gra } func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().InitPayload(rctx) @@ -6465,20 +6249,19 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field } func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_directiveArg_args(ctx, rawArgs) @@ -6487,7 +6270,6 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel return nil } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveArg(rctx, args["arg"].(string)) @@ -6512,20 +6294,19 @@ func (ec *executionContext) _Subscription_directiveArg(ctx context.Context, fiel } func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_directiveNullableArg_args(ctx, rawArgs) @@ -6534,7 +6315,6 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte return nil } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int), args["arg3"].(*string)) @@ -6559,22 +6339,20 @@ func (ec *executionContext) _Subscription_directiveNullableArg(ctx context.Conte } func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6625,22 +6403,20 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f } func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -6685,22 +6461,20 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -6718,22 +6492,20 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _User_friends(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Friends(rctx, obj) @@ -6751,22 +6523,20 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil @@ -6784,22 +6554,20 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Updated, nil @@ -6814,22 +6582,20 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col } func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ValidType", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ValidType", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCase, nil @@ -6847,22 +6613,20 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field } func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ValidType", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ValidType", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCaseOld, nil @@ -6880,20 +6644,19 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field } func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ValidType", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ValidType", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_ValidType_validInputKeywords_args(ctx, rawArgs) @@ -6902,7 +6665,6 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidInputKeywords, nil @@ -6920,20 +6682,19 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f } func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "ValidType", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "ValidType", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_ValidType_validArgs_args(ctx, rawArgs) @@ -6942,7 +6703,6 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidArgs, nil @@ -6960,22 +6720,20 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap } func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "WrappedStruct", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "WrappedStruct", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -6993,22 +6751,20 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph } func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "XXIt", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "XXIt", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -7026,22 +6782,20 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.CollectedField, obj *XxIt) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "XxIt", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "XxIt", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -7059,22 +6813,20 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -7092,22 +6844,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7122,22 +6872,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -7155,22 +6903,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -7188,22 +6934,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -7221,22 +6965,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7251,22 +6993,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -7284,22 +7024,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7314,22 +7052,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -7347,22 +7083,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7377,22 +7111,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -7410,22 +7142,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -7443,22 +7173,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -7476,22 +7204,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -7504,24 +7230,22 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } - -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -7539,22 +7263,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -7569,22 +7291,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -7602,22 +7322,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -7632,22 +7350,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -7665,22 +7381,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -7698,22 +7412,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -7728,22 +7440,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -7758,22 +7468,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -7791,22 +7499,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -7824,22 +7530,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -7854,22 +7558,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -7884,20 +7586,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -7906,7 +7607,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -7921,22 +7621,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -7951,22 +7649,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -7981,20 +7677,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -8003,7 +7698,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -8018,22 +7712,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -8048,22 +7740,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -8078,22 +7768,20 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.CollectedField, obj *AsdfIt) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "asdfIt", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "asdfIt", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -8111,22 +7799,20 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec } func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.CollectedField, obj *IIt) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "iIt", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "iIt", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -9590,7 +9276,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -10196,7 +9881,6 @@ func (ec *executionContext) _Subscription(ctx context.Context, sel ast.Selection fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Subscription", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) if len(fields) != 1 { ec.Errorf(ctx, "must subscribe to exactly one stream") @@ -10956,7 +10640,6 @@ func (ec *executionContext) marshalNPrimitive2ᚕgithubᚗcomᚋ99designsᚋgqlg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -10998,7 +10681,6 @@ func (ec *executionContext) marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designs fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11172,7 +10854,6 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11253,7 +10934,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11325,7 +11005,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11375,7 +11054,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11417,7 +11095,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11771,7 +11448,6 @@ func (ec *executionContext) marshalOOuterObject2ᚕᚕᚖgithubᚗcomᚋ99design fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11812,7 +11488,6 @@ func (ec *executionContext) marshalOOuterObject2ᚕᚖgithubᚗcomᚋ99designs fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -11921,7 +11596,6 @@ func (ec *executionContext) marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -12136,7 +11810,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -12177,7 +11850,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -12218,7 +11890,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -12274,7 +11945,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/codegen/type.gotpl b/codegen/type.gotpl index b0274fc16e0..dad8a8d9984 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -78,7 +78,6 @@ fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/chat/generated.go b/example/chat/generated.go index 0a200af5322..e667c1fa3c8 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -450,22 +450,20 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as // region **************************** field.gotpl ***************************** func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Chatroom", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Chatroom", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -486,22 +484,20 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co } func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Chatroom", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Chatroom", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Messages, nil @@ -522,22 +518,20 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq } func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Message", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Message", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -558,22 +552,20 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Message", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Message", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -594,22 +586,20 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col } func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Message", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Message", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedBy, nil @@ -630,22 +620,20 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq } func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Message", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Message", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil @@ -666,20 +654,19 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq } func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_post_args(ctx, rawArgs) @@ -688,7 +675,6 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().Post(rctx, args["text"].(string), args["username"].(string), args["roomName"].(string)) @@ -709,20 +695,19 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co } func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_room_args(ctx, rawArgs) @@ -731,7 +716,6 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Room(rctx, args["name"].(string)) @@ -749,20 +733,19 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -771,7 +754,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -789,22 +771,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -822,20 +802,19 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, field graphql.CollectedField) (ret func() graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Subscription", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() + fc := &graphql.FieldContext{ + Object: "Subscription", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Subscription_messageAdded_args(ctx, rawArgs) @@ -844,7 +823,6 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel return nil } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().MessageAdded(rctx, args["roomName"].(string)) @@ -875,22 +853,20 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -911,22 +887,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -944,22 +918,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -980,22 +952,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1016,22 +986,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1052,22 +1020,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1085,22 +1051,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1121,22 +1085,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1154,24 +1116,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1190,22 +1150,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1223,22 +1181,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1259,22 +1215,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1295,22 +1249,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1331,22 +1283,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1364,22 +1314,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1400,22 +1348,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1433,22 +1379,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1469,22 +1413,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1502,22 +1444,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1538,22 +1478,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1574,22 +1512,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1607,22 +1543,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1640,22 +1574,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1676,22 +1608,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1712,22 +1642,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1745,22 +1673,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1778,20 +1704,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1800,7 +1725,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1818,22 +1742,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1851,22 +1773,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1884,20 +1804,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1906,7 +1825,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1924,22 +1842,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1957,22 +1873,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2082,7 +1996,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2114,7 +2027,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2155,7 +2067,6 @@ func (ec *executionContext) _Subscription(ctx context.Context, sel ast.Selection fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Subscription", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) if len(fields) != 1 { ec.Errorf(ctx, "must subscribe to exactly one stream") @@ -2459,7 +2370,6 @@ func (ec *executionContext) marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2539,7 +2449,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2611,7 +2520,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2661,7 +2569,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2703,7 +2610,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2825,7 +2731,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2866,7 +2771,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2907,7 +2811,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2963,7 +2866,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/config/generated.go b/example/config/generated.go index 76fb16a48f5..f7467fbfc75 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -324,20 +324,19 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_createTodo_args(ctx, rawArgs) @@ -346,7 +345,6 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateTodo(rctx, args["input"].(NewTodo)) @@ -367,22 +365,20 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap } func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Todos(rctx) @@ -403,20 +399,19 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -425,7 +420,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -443,22 +437,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -476,22 +468,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Todo().ID(rctx, obj) @@ -512,22 +502,20 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DatabaseID, nil @@ -548,22 +536,20 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -584,22 +570,20 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Done, nil @@ -620,22 +604,20 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -656,22 +638,20 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -692,22 +672,20 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FullName(), nil @@ -728,22 +706,20 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -764,22 +740,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -797,22 +771,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -833,22 +805,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -869,22 +839,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -905,22 +873,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -938,22 +904,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -974,22 +938,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1007,24 +969,22 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1043,22 +1003,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1076,22 +1034,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1112,22 +1068,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1148,22 +1102,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1184,22 +1136,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1217,22 +1167,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1253,22 +1201,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1286,22 +1232,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1322,22 +1266,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1355,22 +1297,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1391,22 +1331,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1427,22 +1365,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1460,22 +1396,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1493,22 +1427,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1529,22 +1461,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1565,22 +1495,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1598,22 +1526,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1631,20 +1557,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1653,7 +1578,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1671,22 +1595,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1704,22 +1626,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1737,20 +1657,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1759,7 +1678,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1777,22 +1695,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1810,22 +1726,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1885,7 +1799,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1917,7 +1830,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2364,7 +2276,6 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2430,7 +2341,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2502,7 +2412,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2552,7 +2461,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2594,7 +2502,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2737,7 +2644,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2778,7 +2684,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2819,7 +2724,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2875,7 +2779,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 1b5bf32ef26..ed5a94077ac 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -386,22 +386,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Address", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Address", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -422,22 +420,20 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Address_street(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Address", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Address", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Street, nil @@ -458,22 +454,20 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C } func (ec *executionContext) _Address_country(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Address", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Address", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Country, nil @@ -494,22 +488,20 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. } func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Customer", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Customer", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -530,22 +522,20 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Customer", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Customer", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -566,22 +556,20 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co } func (ec *executionContext) _Customer_address(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Customer", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Customer", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Address(rctx, obj) @@ -599,22 +587,20 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql } func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Customer", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Customer", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Orders(rctx, obj) @@ -632,22 +618,20 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. } func (ec *executionContext) _Item_name(ctx context.Context, field graphql.CollectedField, obj *Item) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Item", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Item", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -668,22 +652,20 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Order_id(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Order", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Order", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -704,22 +686,20 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Order_date(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Order", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Order", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Date, nil @@ -740,22 +720,20 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Order", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Order", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Amount, nil @@ -776,22 +754,20 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col } func (ec *executionContext) _Order_items(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Order", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Order", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Order().Items(rctx, obj) @@ -809,22 +785,20 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_customers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Customers(rctx) @@ -842,20 +816,19 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. } func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_torture1d_args(ctx, rawArgs) @@ -864,7 +837,6 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture1d(rctx, args["customerIds"].([]int)) @@ -882,20 +854,19 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. } func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_torture2d_args(ctx, rawArgs) @@ -904,7 +875,6 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture2d(rctx, args["customerIds"].([][]int)) @@ -922,20 +892,19 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -944,7 +913,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -962,22 +930,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -995,22 +961,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1031,22 +995,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1064,24 +1026,22 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1100,22 +1060,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1136,22 +1094,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1172,22 +1128,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1205,22 +1159,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1241,22 +1193,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1274,22 +1224,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1310,22 +1258,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1343,22 +1289,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1379,22 +1323,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1415,22 +1357,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1451,22 +1391,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1484,22 +1422,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1520,22 +1456,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1553,22 +1487,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1589,22 +1521,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1622,22 +1552,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1658,22 +1586,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1694,22 +1620,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1727,22 +1651,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1760,22 +1682,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1796,22 +1716,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1832,22 +1750,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1865,22 +1781,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1898,20 +1812,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1920,7 +1833,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1938,22 +1850,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1971,22 +1881,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -2004,20 +1912,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -2026,7 +1933,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -2044,22 +1950,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2077,22 +1981,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2294,7 +2196,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2724,7 +2625,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2796,7 +2696,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2846,7 +2745,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2888,7 +2786,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2987,7 +2884,6 @@ func (ec *executionContext) marshalOCustomer2ᚕᚕᚖgithubᚗcomᚋ99designs fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3028,7 +2924,6 @@ func (ec *executionContext) marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3133,7 +3028,6 @@ func (ec *executionContext) marshalOItem2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3174,7 +3068,6 @@ func (ec *executionContext) marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlge fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3238,7 +3131,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3279,7 +3171,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3320,7 +3211,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3376,7 +3266,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 8e0781b8cea..c2c34d4e136 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -369,22 +369,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "File", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "File", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -405,22 +403,20 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _File_name(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "File", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "File", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -441,22 +437,20 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _File_content(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "File", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "File", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Content, nil @@ -477,20 +471,19 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col } func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_singleUpload_args(ctx, rawArgs) @@ -499,7 +492,6 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUpload(rctx, args["file"].(graphql.Upload)) @@ -520,20 +512,19 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr } func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_singleUploadWithPayload_args(ctx, rawArgs) @@ -542,7 +533,6 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUploadWithPayload(rctx, args["req"].(model.UploadFile)) @@ -563,20 +553,19 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex } func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_multipleUpload_args(ctx, rawArgs) @@ -585,7 +574,6 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUpload(rctx, args["files"].([]*graphql.Upload)) @@ -606,20 +594,19 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field } func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_multipleUploadWithPayload_args(ctx, rawArgs) @@ -628,7 +615,6 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUploadWithPayload(rctx, args["req"].([]*model.UploadFile)) @@ -649,22 +635,20 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont } func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Empty(rctx) @@ -685,20 +669,19 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -707,7 +690,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -725,22 +707,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -758,22 +738,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -794,22 +772,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -827,22 +803,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -863,22 +837,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -899,22 +871,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -935,22 +905,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -968,22 +936,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1004,22 +970,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1037,22 +1001,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1073,24 +1035,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1106,22 +1066,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1142,22 +1100,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1178,22 +1134,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1214,22 +1168,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1247,22 +1199,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1283,22 +1233,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1316,22 +1264,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1352,22 +1298,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1385,22 +1329,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1421,22 +1363,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1457,22 +1397,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1490,22 +1428,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1523,22 +1459,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1559,22 +1493,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1595,22 +1527,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1628,22 +1558,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1661,20 +1589,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1683,7 +1610,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1701,22 +1627,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1734,22 +1658,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1767,20 +1689,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1789,7 +1710,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1807,22 +1727,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1840,22 +1758,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1952,7 +1868,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1999,7 +1914,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2312,7 +2226,6 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2485,7 +2398,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2557,7 +2469,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2607,7 +2518,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2649,7 +2559,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2760,7 +2669,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2801,7 +2709,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2842,7 +2749,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2898,7 +2804,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 3b4d51b7634..054ff243543 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -357,22 +357,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Address", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Address", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -393,22 +391,20 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Address_location(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Address", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Address", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Location, nil @@ -426,20 +422,19 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql } func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_user_args(ctx, rawArgs) @@ -448,7 +443,6 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(external.ObjectID)) @@ -466,20 +460,19 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_search_args(ctx, rawArgs) @@ -488,7 +481,6 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["input"].(*model.SearchArgs)) @@ -509,20 +501,19 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -531,7 +522,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -549,22 +539,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -582,22 +570,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -618,22 +604,20 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -654,22 +638,20 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil @@ -687,22 +669,20 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsBanned, nil @@ -723,22 +703,20 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co } func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().PrimitiveResolver(rctx, obj) @@ -759,22 +737,20 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g } func (ec *executionContext) _User_customResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().CustomResolver(rctx, obj) @@ -795,22 +771,20 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap } func (ec *executionContext) _User_address(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Address, nil @@ -828,22 +802,20 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col } func (ec *executionContext) _User_tier(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Tier, nil @@ -861,22 +833,20 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -897,22 +867,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -930,22 +898,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -966,22 +932,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1002,22 +966,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1038,24 +1000,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1071,22 +1031,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1107,22 +1065,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1140,22 +1096,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1176,22 +1130,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1209,22 +1161,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1245,22 +1195,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1281,22 +1229,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1317,22 +1263,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1350,22 +1294,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1386,22 +1328,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1419,22 +1359,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1455,22 +1393,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1488,22 +1424,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1524,22 +1458,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1560,22 +1492,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1593,22 +1523,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1626,22 +1554,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1662,22 +1588,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1698,22 +1622,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1731,22 +1653,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1764,20 +1684,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1786,7 +1705,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1804,22 +1722,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1837,22 +1753,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1870,20 +1784,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1892,7 +1805,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1910,22 +1822,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1943,22 +1853,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2053,7 +1961,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2512,7 +2419,6 @@ func (ec *executionContext) marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2564,7 +2470,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2636,7 +2541,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2686,7 +2590,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2728,7 +2631,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2931,7 +2833,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2972,7 +2873,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3013,7 +2913,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3069,7 +2968,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/selection/generated.go b/example/selection/generated.go index 61e862b7665..6f3184ede85 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -275,22 +275,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Like", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Like", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Reaction, nil @@ -311,22 +309,20 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co } func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Like", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Like", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -347,22 +343,20 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Like", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Like", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -380,22 +374,20 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C } func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Like", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Like", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -413,22 +405,20 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C } func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Post", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Post", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Message, nil @@ -449,22 +439,20 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col } func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Post", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Post", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil @@ -485,22 +473,20 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Post", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Post", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil @@ -518,22 +504,20 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C } func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Post", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Post", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil @@ -551,22 +535,20 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C } func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Events(rctx) @@ -584,20 +566,19 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -606,7 +587,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -624,22 +604,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -657,22 +635,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -693,22 +669,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -726,22 +700,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -762,22 +734,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -798,22 +768,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -834,22 +802,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -867,22 +833,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -903,22 +867,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -936,22 +898,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -972,22 +932,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1005,22 +963,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1041,22 +997,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1075,24 +1029,22 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } - -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1113,22 +1065,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1146,22 +1096,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1182,22 +1130,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1215,22 +1161,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1251,22 +1195,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1284,22 +1226,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1320,22 +1260,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1356,22 +1294,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1389,22 +1325,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1422,22 +1356,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1458,22 +1390,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1494,22 +1424,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1527,22 +1455,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1560,20 +1486,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1582,7 +1507,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1600,22 +1524,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1633,22 +1555,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1666,20 +1586,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1688,7 +1607,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1706,22 +1624,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1739,22 +1655,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1879,7 +1793,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2227,7 +2140,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2299,7 +2211,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2349,7 +2260,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2391,7 +2301,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2479,7 +2388,6 @@ func (ec *executionContext) marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2575,7 +2483,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2616,7 +2523,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2657,7 +2563,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2713,7 +2618,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 7157f1f796e..5f01f2ea8d6 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -939,22 +939,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Droid", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Droid", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -975,22 +973,20 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Droid", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Droid", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1011,22 +1007,20 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Droid", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Droid", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().Friends(rctx, obj) @@ -1044,20 +1038,19 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co } func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Droid", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Droid", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Droid_friendsConnection_args(ctx, rawArgs) @@ -1066,7 +1059,6 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1087,22 +1079,20 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field } func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Droid", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Droid", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1123,22 +1113,20 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. } func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Droid", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Droid", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PrimaryFunction, nil @@ -1156,22 +1144,20 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr } func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "FriendsConnection", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "FriendsConnection", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount(), nil @@ -1192,22 +1178,20 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f } func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "FriendsConnection", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "FriendsConnection", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Edges(rctx, obj) @@ -1225,22 +1209,20 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field } func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "FriendsConnection", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "FriendsConnection", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Friends(rctx, obj) @@ -1258,22 +1240,20 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel } func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "FriendsConnection", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "FriendsConnection", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo(), nil @@ -1294,22 +1274,20 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie } func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "FriendsEdge", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "FriendsEdge", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil @@ -1330,22 +1308,20 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph } func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "FriendsEdge", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "FriendsEdge", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil @@ -1363,22 +1339,20 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql } func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -1399,22 +1373,20 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect } func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1435,20 +1407,19 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Human_height_args(ctx, rawArgs) @@ -1457,7 +1428,6 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Height(args["unit"].(models.LengthUnit)), nil @@ -1478,22 +1448,20 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col } func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Mass, nil @@ -1511,22 +1479,20 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Friends(rctx, obj) @@ -1544,20 +1510,19 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co } func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Human_friendsConnection_args(ctx, rawArgs) @@ -1566,7 +1531,6 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) @@ -1587,22 +1551,20 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field } func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil @@ -1623,24 +1585,22 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. } func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Human", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "Human", + Field: field, + Args: nil, + IsMethod: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Starships(rctx, obj) }) if err != nil { @@ -1656,20 +1616,19 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. } func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Mutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Mutation_createReview_args(ctx, rawArgs) @@ -1678,7 +1637,6 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateReview(rctx, args["episode"].(models.Episode), args["review"].(models.Review)) @@ -1696,22 +1654,20 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr } func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.StartCursor, nil @@ -1732,22 +1688,20 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra } func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EndCursor, nil @@ -1768,22 +1722,20 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph } func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "PageInfo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "PageInfo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.HasNextPage, nil @@ -1804,20 +1756,19 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra } func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_hero_args(ctx, rawArgs) @@ -1826,7 +1777,6 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Hero(rctx, args["episode"].(*models.Episode)) @@ -1844,20 +1794,19 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_reviews_args(ctx, rawArgs) @@ -1866,7 +1815,6 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Reviews(rctx, args["episode"].(models.Episode), args["since"].(*time.Time)) @@ -1887,20 +1835,19 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co } func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_search_args(ctx, rawArgs) @@ -1909,7 +1856,6 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["text"].(string)) @@ -1930,20 +1876,19 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_character_args(ctx, rawArgs) @@ -1952,7 +1897,6 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Character(rctx, args["id"].(string)) @@ -1970,20 +1914,19 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. } func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_droid_args(ctx, rawArgs) @@ -1992,7 +1935,6 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Droid(rctx, args["id"].(string)) @@ -2010,20 +1952,19 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_human_args(ctx, rawArgs) @@ -2032,7 +1973,6 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Human(rctx, args["id"].(string)) @@ -2050,20 +1990,19 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_starship_args(ctx, rawArgs) @@ -2072,7 +2011,6 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Starship(rctx, args["id"].(string)) @@ -2090,20 +2028,19 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -2112,7 +2049,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -2130,22 +2066,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -2163,22 +2097,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Review", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Review", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Stars, nil @@ -2199,22 +2131,20 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col } func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Review", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Review", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Commentary, nil @@ -2232,22 +2162,20 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq } func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Review", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Review", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Time, nil @@ -2265,22 +2193,20 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Starship", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Starship", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -2301,22 +2227,20 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Starship", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Starship", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2337,29 +2261,27 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co } func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Starship", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Starship_length_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null + fc := &graphql.FieldContext{ + Object: "Starship", + Field: field, + Args: nil, + IsMethod: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Starship_length_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Starship().Length(rctx, obj, args["unit"].(*models.LengthUnit)) @@ -2380,22 +2302,20 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. } func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Starship", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Starship", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.History, nil @@ -2416,22 +2336,20 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2452,22 +2370,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2485,22 +2401,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -2521,22 +2435,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2557,22 +2469,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2593,22 +2503,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2626,22 +2534,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2662,22 +2568,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2695,22 +2599,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2731,22 +2633,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2764,22 +2664,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -2800,22 +2698,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -2836,22 +2732,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -2872,22 +2766,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -2905,22 +2797,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -2941,22 +2831,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -2974,22 +2862,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -3010,22 +2896,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -3043,22 +2927,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -3079,22 +2961,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -3115,22 +2995,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -3148,22 +3026,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -3181,22 +3057,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -3217,22 +3091,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -3253,22 +3125,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -3286,22 +3156,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -3319,20 +3187,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -3341,7 +3208,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -3359,22 +3225,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -3392,22 +3256,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -3425,20 +3287,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -3447,7 +3308,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -3465,22 +3325,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -3498,22 +3356,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -3844,7 +3700,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Mutation", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -3910,7 +3765,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -4409,7 +4263,6 @@ func (ec *executionContext) marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4583,7 +4436,6 @@ func (ec *executionContext) marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4645,7 +4497,6 @@ func (ec *executionContext) marshalNSearchResult2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4715,7 +4566,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4787,7 +4637,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4837,7 +4686,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4879,7 +4727,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -4974,7 +4821,6 @@ func (ec *executionContext) marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -5058,7 +4904,6 @@ func (ec *executionContext) marshalOFriendsEdge2ᚕᚖgithubᚗcomᚋ99designs fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -5195,7 +5040,6 @@ func (ec *executionContext) marshalOStarship2ᚕᚖgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -5289,7 +5133,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -5330,7 +5173,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -5371,7 +5213,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -5427,7 +5268,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/todo/generated.go b/example/todo/generated.go index 6f9e3ed3a28..1b1421ad5cd 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -498,20 +498,19 @@ func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{ // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyMutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyMutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_createTodo_args(ctx, rawArgs) @@ -520,7 +519,6 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) @@ -538,20 +536,19 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyMutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyMutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_updateTodo_args(ctx, rawArgs) @@ -560,7 +557,6 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{})) @@ -575,20 +571,19 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery_todo_args(ctx, rawArgs) @@ -597,7 +592,6 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int)) @@ -612,22 +606,20 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().LastTodo(rctx) @@ -642,22 +634,20 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) @@ -675,20 +665,19 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery___type_args(ctx, rawArgs) @@ -697,7 +686,6 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -712,22 +700,20 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -742,22 +728,20 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -775,22 +759,20 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -808,22 +790,20 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children @@ -865,22 +845,20 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -898,22 +876,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -928,22 +904,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -961,22 +935,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -994,22 +966,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1027,22 +997,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1057,22 +1025,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1090,22 +1056,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1120,22 +1084,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1153,24 +1115,22 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children return obj.Description, nil }) @@ -1183,22 +1143,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1216,22 +1174,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1249,22 +1205,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1282,22 +1236,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1312,22 +1264,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1345,22 +1295,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1375,22 +1323,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1408,22 +1354,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1438,22 +1382,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1471,22 +1413,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1504,22 +1444,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1534,22 +1472,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1564,22 +1500,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1597,22 +1531,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1630,22 +1562,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1660,22 +1590,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1690,20 +1618,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1712,7 +1639,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1727,22 +1653,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1757,22 +1681,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1787,20 +1709,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1809,7 +1730,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1824,22 +1744,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1854,22 +1772,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1926,7 +1842,6 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyMutation", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1960,7 +1875,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyQuery", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2392,7 +2306,6 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2448,7 +2361,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2520,7 +2432,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2570,7 +2481,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2612,7 +2522,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2734,7 +2643,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2775,7 +2683,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2816,7 +2723,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2872,7 +2778,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 45557d74bc7..5286d9265cc 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -379,20 +379,19 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyMutation", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyMutation", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyMutation_createTodo_args(ctx, rawArgs) @@ -401,7 +400,6 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) @@ -422,22 +420,20 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) @@ -458,20 +454,19 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery_todo_args(ctx, rawArgs) @@ -480,7 +475,6 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(string)) @@ -498,20 +492,19 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_MyQuery___type_args(ctx, rawArgs) @@ -520,7 +513,6 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -538,22 +530,20 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "MyQuery", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "MyQuery", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -571,22 +561,20 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil @@ -607,22 +595,20 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil @@ -643,22 +629,20 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.State, nil @@ -679,22 +663,20 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Todo", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Todo", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() 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 @@ -735,22 +717,20 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -771,22 +751,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -804,22 +782,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -840,22 +816,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -876,22 +850,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -912,22 +884,20 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -945,22 +915,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -981,22 +949,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1014,22 +980,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1050,22 +1014,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1083,24 +1045,22 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1119,22 +1079,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1155,22 +1113,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1191,22 +1147,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1224,22 +1178,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1260,22 +1212,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1293,22 +1243,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1329,22 +1277,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1362,22 +1308,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1398,22 +1342,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1434,22 +1376,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1467,22 +1407,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1500,22 +1438,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1536,22 +1472,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1572,22 +1506,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1605,22 +1537,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1638,20 +1568,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1660,7 +1589,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1678,22 +1606,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1711,22 +1637,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1744,20 +1668,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1766,7 +1689,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1784,22 +1706,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -1817,22 +1737,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -1912,7 +1830,6 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyMutation", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -1944,7 +1861,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "MyQuery", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2347,7 +2263,6 @@ func (ec *executionContext) marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2403,7 +2318,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2475,7 +2389,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2525,7 +2438,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2567,7 +2479,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2689,7 +2600,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2730,7 +2640,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2771,7 +2680,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2827,7 +2735,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { diff --git a/graphql/context_field.go b/graphql/context_field.go index 5471adfaccd..802b60e4c5e 100644 --- a/graphql/context_field.go +++ b/graphql/context_field.go @@ -26,9 +26,6 @@ type FieldContext struct { Result interface{} // IsMethod indicates if the resolver is a method IsMethod bool - - // Stats collected while executing this field - Stats FieldStats } type FieldStats struct { diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index ce790aa718c..e943e17ac97 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -57,6 +57,8 @@ func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res panic("missing tracing extension") } + start := graphql.Now() + defer func() { td.mu.Lock() defer td.mu.Unlock() @@ -69,8 +71,8 @@ func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (res ParentType: fc.Object, FieldName: fc.Field.Name, ReturnType: fc.Field.Definition.Type.String(), - StartOffset: fc.Stats.Started.Sub(rc.Stats.OperationStart), - Duration: end.Sub(fc.Stats.Started), + StartOffset: start.Sub(rc.Stats.OperationStart), + Duration: end.Sub(start), }) }() diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index 878b67b7c48..0a1d91b420a 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -62,9 +62,6 @@ func New() *TestServer { Definition: schema.Types["Query"].Fields.ForName("name"), }, }, - Stats: graphql.FieldStats{ - Started: graphql.Now(), - }, }) res, err := graphql.GetOperationContext(ctx).ResolverMiddleware(ctx, func(ctx context.Context) (interface{}, error) { return &graphql.Response{Data: []byte(`{"name":"test"}`)}, nil diff --git a/integration/generated.go b/integration/generated.go index fa633ca390f..06b04db9851 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -417,22 +417,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Element", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Element", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Child(rctx, obj) @@ -453,22 +451,20 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co } func (ec *executionContext) _Element_error(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Element", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Element", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Error(rctx, obj) @@ -489,22 +485,20 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co } func (ec *executionContext) _Element_mismatched(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Element", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Element", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Mismatched(rctx, obj) @@ -522,22 +516,20 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph } func (ec *executionContext) _Query_path(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Path(rctx) @@ -555,20 +547,19 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_date(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_date_args(ctx, rawArgs) @@ -577,7 +568,6 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Date(rctx, args["filter"].(models.DateFilter)) @@ -598,22 +588,20 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Viewer(rctx) @@ -631,22 +619,20 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().JSONEncoding(rctx) @@ -667,20 +653,19 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph } func (ec *executionContext) _Query_error(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_error_args(ctx, rawArgs) @@ -689,7 +674,6 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Error(rctx, args["type"].(*models.ErrorType)) @@ -710,20 +694,19 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll } func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query_complexity_args(ctx, rawArgs) @@ -732,7 +715,6 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Complexity(rctx, args["value"].(int)) @@ -753,20 +735,19 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field_Query___type_args(ctx, rawArgs) @@ -775,7 +756,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) @@ -793,22 +773,20 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() @@ -826,22 +804,20 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -862,22 +838,20 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } func (ec *executionContext) _User_likes(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "User", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "User", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Likes(rctx, obj) @@ -898,22 +872,20 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle } func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.CollectedField, obj *models.Viewer) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "Viewer", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "Viewer", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil @@ -931,22 +903,20 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -967,22 +937,20 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1000,22 +968,20 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil @@ -1036,22 +1002,20 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Directive", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1072,22 +1036,20 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1108,24 +1070,22 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + 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 { @@ -1141,22 +1101,20 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1177,22 +1135,20 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1210,22 +1166,20 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1246,22 +1200,20 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1279,22 +1231,20 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil @@ -1315,22 +1265,20 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1351,22 +1299,20 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil @@ -1387,22 +1333,20 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Field", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil @@ -1420,22 +1364,20 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil @@ -1456,22 +1398,20 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil @@ -1489,22 +1429,20 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil @@ -1525,22 +1463,20 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - Args: nil, - IsMethod: false, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil @@ -1558,22 +1494,20 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil @@ -1594,22 +1528,20 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil @@ -1630,22 +1562,20 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil @@ -1663,22 +1593,20 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil @@ -1696,22 +1624,20 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Schema", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil @@ -1732,22 +1658,20 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil @@ -1768,22 +1692,20 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil @@ -1801,22 +1723,20 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil @@ -1834,20 +1754,19 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_fields_args(ctx, rawArgs) @@ -1856,7 +1775,6 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil @@ -1874,22 +1792,20 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil @@ -1907,22 +1823,20 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil @@ -1940,20 +1854,19 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) args, err := ec.field___Type_enumValues_args(ctx, rawArgs) @@ -1962,7 +1875,6 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return graphql.Null } fc.Args = args - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil @@ -1980,22 +1892,20 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil @@ -2013,22 +1923,20 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc := &graphql.FieldContext{ - Object: "__Type", - Field: field, - Args: nil, - IsMethod: true, - Stats: graphql.FieldStats{Started: graphql.Now()}, - } defer func() { - fc.Stats.Completed = graphql.Now() if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithFieldContext(ctx, fc) - fc.Stats.ArgumentsCompleted = graphql.Now() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil @@ -2162,7 +2070,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", - Stats: graphql.FieldStats{Started: graphql.Now()}, }) out := graphql.NewFieldSet(fields) @@ -2679,7 +2586,6 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2751,7 +2657,6 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2801,7 +2706,6 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2843,7 +2747,6 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -2991,7 +2894,6 @@ func (ec *executionContext) marshalOElement2ᚕᚖgithubᚗcomᚋ99designsᚋgql fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3131,7 +3033,6 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgq fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3172,7 +3073,6 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3213,7 +3113,6 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋg fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { @@ -3269,7 +3168,6 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgen fc := &graphql.FieldContext{ Index: &i, Result: &v[i], - Stats: graphql.FieldStats{Started: graphql.Now()}, } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { From c3f938108d172b7097828d1ae2a7ce940b611ae6 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 14:51:30 +1100 Subject: [PATCH 43/53] fix benchmark --- example/starwars/benchmarks_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/starwars/benchmarks_test.go b/example/starwars/benchmarks_test.go index af2401f222b..ad76062aa16 100644 --- a/example/starwars/benchmarks_test.go +++ b/example/starwars/benchmarks_test.go @@ -16,6 +16,7 @@ func BenchmarkSimpleQueryNoArgs(b *testing.B) { var body strings.Reader r := httptest.NewRequest("POST", "/graphql", &body) + r.Header.Set("Content-Type", "application/json") b.ReportAllocs() b.ResetTimer() @@ -26,7 +27,7 @@ func BenchmarkSimpleQueryNoArgs(b *testing.B) { rec.Body.Reset() server.ServeHTTP(rec, r) if rec.Body.String() != `{"data":{"search":[{"starships":[{"name":"X-Wing"},{"name":"Imperial shuttle"}]}]}}` { - b.Fatalf("Unexpected response") + b.Fatalf("Unexpected response: %s", rec.Body.String()) } } From dc6223462ed4dc85b66e836feb5c5ee58bc363bd Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 16:08:10 +1100 Subject: [PATCH 44/53] Tune allocs for benchmarks --- graphql/context_server.go | 13 ------- graphql/handler.go | 2 +- graphql/handler/apollotracing/tracer.go | 2 +- graphql/handler/executor.go | 39 ++++++++------------ graphql/handler/extension/apq.go | 2 +- graphql/handler/extension/complexity.go | 32 +++++++++------- graphql/handler/extension/complexity_test.go | 33 ++++------------- graphql/handler/extension/introspection.go | 2 +- graphql/handler/server.go | 10 ++--- graphql/recovery.go | 2 +- graphql/stats.go | 16 +++++++- handler/handler.go | 13 ++++--- 12 files changed, 75 insertions(+), 91 deletions(-) delete mode 100644 graphql/context_server.go diff --git a/graphql/context_server.go b/graphql/context_server.go deleted file mode 100644 index d87c35bc9c1..00000000000 --- a/graphql/context_server.go +++ /dev/null @@ -1,13 +0,0 @@ -package graphql - -import "context" - -const serverCtx key = "serverCtx" - -func GetServerContext(ctx context.Context) ExecutableSchema { - return ctx.Value(serverCtx).(ExecutableSchema) -} - -func WithServerContext(ctx context.Context, es ExecutableSchema) context.Context { - return context.WithValue(ctx, serverCtx, es) -} diff --git a/graphql/handler.go b/graphql/handler.go index 2ecc37e5cd6..8e4c0822363 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -46,7 +46,7 @@ type ( // +------------------------------------------------------------------------+ HandlerExtension interface { ExtensionName() string - Validate() error + Validate(schema ExecutableSchema) error } // OperationParameterMutator is called before creating a request context. allows manipulating the raw query diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index e943e17ac97..27e739a5291 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -46,7 +46,7 @@ func (a Tracer) ExtensionName() string { return "ApolloTracing" } -func (a Tracer) Validate() error { +func (a Tracer) Validate(schema graphql.ExecutableSchema) error { return nil } diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 6248cfab08d..acc9f454c4b 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -116,45 +116,38 @@ func (e executor) DispatchOperation(ctx context.Context, rc *graphql.OperationCo } func (e executor) CreateOperationContext(ctx context.Context, params *graphql.RawParams) (*graphql.OperationContext, gqlerror.List) { - ctx = graphql.WithServerContext(ctx, e.server.es) - - stats := graphql.Stats{ - OperationStart: graphql.GetStartTime(ctx), - Extension: map[string]interface{}{}, - } for _, p := range e.operationParameterMutators { if err := p.MutateOperationParameters(ctx, params); err != nil { return nil, gqlerror.List{err} } } - doc, listErr := e.parseQuery(ctx, &stats, params.Query) + rc := &graphql.OperationContext{ + RawQuery: params.Query, + OperationName: params.OperationName, + DisableIntrospection: true, + Recover: graphql.DefaultRecover, + ResolverMiddleware: e.fieldMiddleware, + Stats: graphql.Stats{OperationStart: graphql.GetStartTime(ctx)}, + } + + var listErr gqlerror.List + rc.Doc, listErr = e.parseQuery(ctx, &rc.Stats, params.Query) if len(listErr) != 0 { return nil, listErr } - op := doc.Operations.ForName(params.OperationName) - if op == nil { + rc.Operation = rc.Doc.Operations.ForName(params.OperationName) + if rc.Operation == nil { return nil, gqlerror.List{gqlerror.Errorf("operation %s not found", params.OperationName)} } - vars, err := validator.VariableValues(e.server.es.Schema(), op, params.Variables) + var err *gqlerror.Error + rc.Variables, err = validator.VariableValues(e.server.es.Schema(), rc.Operation, params.Variables) if err != nil { return nil, gqlerror.List{err} } - stats.Validation.End = graphql.Now() - - rc := &graphql.OperationContext{ - RawQuery: params.Query, - Variables: vars, - OperationName: params.OperationName, - Doc: doc, - Operation: op, - DisableIntrospection: true, - Recover: graphql.DefaultRecover, - ResolverMiddleware: e.fieldMiddleware, - Stats: stats, - } + rc.Stats.Validation.End = graphql.Now() for _, p := range e.operationContextMutators { if err := p.MutateOperationContext(ctx, rc); err != nil { diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index e4297a1ba26..80766fa4c80 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -28,7 +28,7 @@ func (a AutomaticPersistedQuery) ExtensionName() string { return "AutomaticPersistedQuery" } -func (a AutomaticPersistedQuery) Validate() error { +func (a AutomaticPersistedQuery) Validate(schema graphql.ExecutableSchema) error { if a.Cache == nil { return fmt.Errorf("AutomaticPersistedQuery.Cache can not be nil") } diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index 3b95429d7e6..85c49f35865 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -12,9 +12,13 @@ import ( // ComplexityLimit allows you to define a limit on query complexity // // If a query is submitted that exceeds the limit, a 422 status code will be returned. -type ComplexityLimit func(ctx context.Context, rc *graphql.OperationContext) int +type ComplexityLimit struct { + Func func(ctx context.Context, rc *graphql.OperationContext) int -var _ graphql.OperationContextMutator = ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { return 0 }) + es graphql.ExecutableSchema +} + +var _ graphql.OperationContextMutator = &ComplexityLimit{} const complexityExtension = "ComplexityLimit" @@ -28,33 +32,35 @@ type ComplexityStats struct { // FixedComplexityLimit sets a complexity limit that does not change func FixedComplexityLimit(limit int) graphql.HandlerExtension { - return ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { - return limit - }) + return &ComplexityLimit{ + Func: func(ctx context.Context, rc *graphql.OperationContext) int { + return limit + }, + } } func (c ComplexityLimit) ExtensionName() string { return complexityExtension } -func (c ComplexityLimit) Validate() error { - if c == nil { +func (c *ComplexityLimit) Validate(schema graphql.ExecutableSchema) error { + if c.Func == nil { return fmt.Errorf("ComplexityLimit func can not be nil") } + c.es = schema return nil } func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { - es := graphql.GetServerContext(ctx) op := rc.Doc.Operations.ForName(rc.OperationName) - complexity := complexity.Calculate(es, op, rc.Variables) + complexity := complexity.Calculate(c.es, op, rc.Variables) - limit := c(ctx, rc) + limit := c.Func(ctx, rc) - rc.Stats.Extension[complexityExtension] = &ComplexityStats{ + rc.Stats.SetExtension(complexityExtension, &ComplexityStats{ Complexity: complexity, ComplexityLimit: limit, - } + }) if complexity > limit { return gqlerror.Errorf("operation has complexity %d, which exceeds the limit of %d", complexity, limit) @@ -69,6 +75,6 @@ func GetComplexityStats(ctx context.Context) *ComplexityStats { return nil } - s, _ := rc.Stats.Extension[complexityExtension].(*ComplexityStats) + s, _ := rc.Stats.GetExtension(complexityExtension).(*ComplexityStats) return s } diff --git a/graphql/handler/extension/complexity_test.go b/graphql/handler/extension/complexity_test.go index d8c55a09336..7622ebff98d 100644 --- a/graphql/handler/extension/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -2,7 +2,6 @@ package extension_test import ( "context" - "fmt" "net/http" "net/http/httptest" "strings" @@ -13,17 +12,18 @@ import ( "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" - "github.com/vektah/gqlparser/gqlerror" ) func TestHandlerComplexity(t *testing.T) { h := testserver.New() - h.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { - if rc.RawQuery == "{ ok: name }" { - return 4 - } - return 2 - })) + h.Use(&extension.ComplexityLimit{ + Func: func(ctx context.Context, rc *graphql.OperationContext) int { + if rc.RawQuery == "{ ok: name }" { + return 4 + } + return 2 + }, + }) h.AddTransport(&transport.POST{}) var stats *extension.ComplexityStats h.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { @@ -105,20 +105,3 @@ func doRequest(handler http.Handler, method string, target string, body string) handler.ServeHTTP(w, r) return w } - -type operationMutatorFunc func(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error - -func (r operationMutatorFunc) ExtensionName() string { - return "operationMutatorFunc" -} - -func (r operationMutatorFunc) Validate() error { - if r == nil { - return fmt.Errorf("operationMutatorFunc can not be nil") - } - return nil -} - -func (r operationMutatorFunc) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { - return r(ctx, rc) -} diff --git a/graphql/handler/extension/introspection.go b/graphql/handler/extension/introspection.go index 5e20c420853..632ca26f0b1 100644 --- a/graphql/handler/extension/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -16,7 +16,7 @@ func (c Introspection) ExtensionName() string { return "Introspection" } -func (c Introspection) Validate() error { +func (c Introspection) Validate(schema graphql.ExecutableSchema) error { return nil } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index f673798d8e3..d75b6f3861c 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -50,7 +50,7 @@ func NewDefaultServer(es graphql.ExecutableSchema) *Server { srv.AddTransport(transport.POST{}) srv.AddTransport(transport.MultipartForm{}) - srv.SetQueryCache(lru.New(100)) + srv.SetQueryCache(lru.New(1000)) srv.Use(extension.Introspection{}) srv.Use(extension.AutomaticPersistedQuery{ @@ -78,7 +78,7 @@ func (s *Server) SetQueryCache(cache graphql.Cache) { } func (s *Server) Use(extension graphql.HandlerExtension) { - if err := extension.Validate(); err != nil { + if err := extension.Validate(s.es); err != nil { panic(err) } @@ -161,7 +161,7 @@ func (r OperationFunc) ExtensionName() string { return "InlineOperationFunc" } -func (r OperationFunc) Validate() error { +func (r OperationFunc) Validate(schema graphql.ExecutableSchema) error { if r == nil { return fmt.Errorf("OperationFunc can not be nil") } @@ -178,7 +178,7 @@ func (r ResponseFunc) ExtensionName() string { return "InlineResponseFunc" } -func (r ResponseFunc) Validate() error { +func (r ResponseFunc) Validate(schema graphql.ExecutableSchema) error { if r == nil { return fmt.Errorf("ResponseFunc can not be nil") } @@ -195,7 +195,7 @@ func (f FieldFunc) ExtensionName() string { return "InlineFieldFunc" } -func (f FieldFunc) Validate() error { +func (f FieldFunc) Validate(schema graphql.ExecutableSchema) error { if f == nil { return fmt.Errorf("FieldFunc can not be nil") } diff --git a/graphql/recovery.go b/graphql/recovery.go index 7fb97760db9..d2cf9114287 100644 --- a/graphql/recovery.go +++ b/graphql/recovery.go @@ -26,7 +26,7 @@ func (f RecoverFunc) ExtensionName() string { return "RecoverFunc" } -func (f RecoverFunc) Validate() error { +func (f RecoverFunc) Validate(schema ExecutableSchema) error { if f == nil { return fmt.Errorf("RecoverFunc can not be nil") } diff --git a/graphql/stats.go b/graphql/stats.go index 8210665f9cb..f607f25a1e9 100644 --- a/graphql/stats.go +++ b/graphql/stats.go @@ -13,7 +13,7 @@ type Stats struct { // Stats collected by handler extensions. Dont use directly, the extension should provide a type safe way to // access this. - Extension map[string]interface{} + extension map[string]interface{} } type TraceTiming struct { @@ -41,5 +41,19 @@ func GetStartTime(ctx context.Context) time.Time { return t } +func (c *Stats) SetExtension(name string, data interface{}) { + if c.extension == nil { + c.extension = map[string]interface{}{} + } + c.extension[name] = data +} + +func (c *Stats) GetExtension(name string) interface{} { + if c.extension == nil { + return nil + } + return c.extension[name] +} + // Now is time.Now, except in tests. Then it can be whatever you want it to be. var Now = time.Now diff --git a/handler/handler.go b/handler/handler.go index 6718a9e5e57..c1d2b649ac3 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -17,6 +17,7 @@ import ( // Deprecated: switch to graphql/handler.New func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc { var cfg Config + cfg.cacheSize = 1000 for _, option := range options { option(&cfg) @@ -53,13 +54,13 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc srv.AroundResponses(hook) } if cfg.complexityLimit != 0 { - srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { - return cfg.complexityLimit - })) + srv.Use(extension.FixedComplexityLimit(cfg.complexityLimit)) } else if cfg.complexityLimitFunc != nil { - srv.Use(extension.ComplexityLimit(func(ctx context.Context, rc *graphql.OperationContext) int { - return cfg.complexityLimitFunc(graphql.WithOperationContext(ctx, rc)) - })) + srv.Use(&extension.ComplexityLimit{ + Func: func(ctx context.Context, rc *graphql.OperationContext) int { + return cfg.complexityLimitFunc(graphql.WithOperationContext(ctx, rc)) + }, + }) } if !cfg.disableIntrospection { srv.Use(extension.Introspection{}) From 572fb419fc66c56ac103abf65bb54282d46aec29 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Nov 2019 17:10:26 +1100 Subject: [PATCH 45/53] remove all references to deprecated handler package --- .golangci.yml | 1 - cmd/root.go | 1 + codegen/testserver/complexity_test.go | 11 +- codegen/testserver/directive_test.go | 179 +++++++++--------- codegen/testserver/generated_test.go | 12 +- codegen/testserver/input_test.go | 6 +- codegen/testserver/interfaces_test.go | 4 +- codegen/testserver/introspection_test.go | 28 ++- codegen/testserver/maps_test.go | 4 +- codegen/testserver/middleware_test.go | 30 +-- codegen/testserver/modelmethod_test.go | 4 +- codegen/testserver/nulls_test.go | 4 +- codegen/testserver/panics_test.go | 4 +- codegen/testserver/primitive_objects_test.go | 6 +- codegen/testserver/response_extension_test.go | 16 +- codegen/testserver/scalar_default_test.go | 4 +- codegen/testserver/slices_test.go | 4 +- codegen/testserver/subscription_test.go | 26 +-- codegen/testserver/time_test.go | 4 +- codegen/testserver/typefallback_test.go | 4 +- codegen/testserver/validtypes_test.go | 4 +- codegen/testserver/wrapped_type_test.go | 4 +- docs/content/recipes/authentication.md | 10 +- docs/content/recipes/cors.md | 31 +-- docs/content/recipes/gin.md | 8 +- example/chat/chat_test.go | 4 +- example/chat/server/server.go | 22 ++- example/config/server/server.go | 7 +- example/dataloader/dataloader_test.go | 4 +- example/dataloader/server/server.go | 7 +- example/fileupload/fileupload_test.go | 17 +- example/fileupload/server/server.go | 16 +- example/scalars/scalar_test.go | 4 +- example/scalars/server/server.go | 7 +- example/selection/selection_test.go | 4 +- example/selection/server/server.go | 7 +- example/starwars/benchmarks_test.go | 4 +- example/starwars/server/server.go | 24 +-- example/starwars/starwars_test.go | 4 +- example/todo/server/server.go | 23 ++- example/todo/todo_test.go | 6 +- .../type-system-extension/server/server.go | 4 +- graphql/error.go | 2 +- graphql/handler/extension/complexity.go | 2 +- graphql/handler/server.go | 2 - integration/server/server.go | 32 ++-- plugin/resolvergen/resolver.gotpl | 1 - plugin/servergen/server.gotpl | 6 +- plugin/stubgen/stubs.gotpl | 1 - 49 files changed, 320 insertions(+), 299 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 320be5449d5..b026536e41a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,7 +29,6 @@ linters: - staticcheck - structcheck - stylecheck - - typecheck - unconvert - unused - varcheck diff --git a/cmd/root.go b/cmd/root.go index dc2970ac890..d409633af75 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,6 +10,7 @@ import ( "github.com/urfave/cli" // Required since otherwise dep will prune away these unused packages before codegen has a chance to run + _ "github.com/99designs/gqlgen/graphql/handler" _ "github.com/99designs/gqlgen/handler" ) diff --git a/codegen/testserver/complexity_test.go b/codegen/testserver/complexity_test.go index a48b74303bb..f5d041c9763 100644 --- a/codegen/testserver/complexity_test.go +++ b/codegen/testserver/complexity_test.go @@ -5,14 +5,17 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" "github.com/stretchr/testify/require" ) func TestComplexityCollisions(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers})) + + c := client.New(srv) resolvers.QueryResolver.Overlapping = func(ctx context.Context) (fields *OverlappingFields, e error) { return &OverlappingFields{ @@ -48,7 +51,9 @@ func TestComplexityFuncs(t *testing.T) { cfg.Complexity.OverlappingFields.Foo = func(childComplexity int) int { return 1000 } cfg.Complexity.OverlappingFields.NewFoo = func(childComplexity int) int { return 5 } - c := client.New(handler.GraphQL(NewExecutableSchema(cfg), handler.ComplexityLimit(10))) + srv := handler.NewDefaultServer(NewExecutableSchema(cfg)) + srv.Use(extension.FixedComplexityLimit(10)) + c := client.New(srv) resolvers.QueryResolver.Overlapping = func(ctx context.Context) (fields *OverlappingFields, e error) { return &OverlappingFields{ diff --git a/codegen/testserver/directive_test.go b/codegen/testserver/directive_test.go index c8611c1cfce..c201b255726 100644 --- a/codegen/testserver/directive_test.go +++ b/codegen/testserver/directive_test.go @@ -7,7 +7,7 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -85,96 +85,95 @@ func TestDirectives(t *testing.T) { resolvers.SubscriptionResolver.DirectiveUnimplemented = func(ctx context.Context) (<-chan *string, error) { return okchan() } + srv := handler.NewDefaultServer(NewExecutableSchema(Config{ + Resolvers: resolvers, + Directives: DirectiveRoot{ + Length: func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int, message *string) (interface{}, error) { + e := func(msg string) error { + if message == nil { + return fmt.Errorf(msg) + } + return fmt.Errorf(*message) + } + res, err := next(ctx) + if err != nil { + return nil, err + } + + s := res.(string) + if len(s) < min { + return nil, e("too short") + } + if max != nil && len(s) > *max { + return nil, e("too long") + } + return res, nil + }, + Range: func(ctx context.Context, obj interface{}, next graphql.Resolver, min *int, max *int) (interface{}, error) { + res, err := next(ctx) + if err != nil { + return nil, err + } + + switch res := res.(type) { + case int: + if min != nil && res < *min { + return nil, fmt.Errorf("too small") + } + if max != nil && res > *max { + return nil, fmt.Errorf("too large") + } + return next(ctx) + + case int64: + if min != nil && int(res) < *min { + return nil, fmt.Errorf("too small") + } + if max != nil && int(res) > *max { + return nil, fmt.Errorf("too large") + } + return next(ctx) + + case *int: + if min != nil && *res < *min { + return nil, fmt.Errorf("too small") + } + if max != nil && *res > *max { + return nil, fmt.Errorf("too large") + } + return next(ctx) + } + return nil, fmt.Errorf("unsupported type %T", res) + }, + Custom: func(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error) { + return next(ctx) + }, + Logged: func(ctx context.Context, obj interface{}, next graphql.Resolver, id string) (interface{}, error) { + return next(context.WithValue(ctx, "request_id", &id)) + }, + ToNull: func(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error) { + return nil, nil + }, + Directive1: func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { + return next(ctx) + }, + Directive2: func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { + return next(ctx) + }, + Unimplemented: nil, + }, + })) + + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + path, _ := ctx.Value("path").([]int) + return next(context.WithValue(ctx, "path", append(path, 1))) + }) + + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + path, _ := ctx.Value("path").([]int) + return next(context.WithValue(ctx, "path", append(path, 2))) + }) - srv := - handler.GraphQL( - NewExecutableSchema(Config{ - Resolvers: resolvers, - Directives: DirectiveRoot{ - Length: func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int, message *string) (interface{}, error) { - e := func(msg string) error { - if message == nil { - return fmt.Errorf(msg) - } - return fmt.Errorf(*message) - } - res, err := next(ctx) - if err != nil { - return nil, err - } - - s := res.(string) - if len(s) < min { - return nil, e("too short") - } - if max != nil && len(s) > *max { - return nil, e("too long") - } - return res, nil - }, - Range: func(ctx context.Context, obj interface{}, next graphql.Resolver, min *int, max *int) (interface{}, error) { - res, err := next(ctx) - if err != nil { - return nil, err - } - - switch res := res.(type) { - case int: - if min != nil && res < *min { - return nil, fmt.Errorf("too small") - } - if max != nil && res > *max { - return nil, fmt.Errorf("too large") - } - return next(ctx) - - case int64: - if min != nil && int(res) < *min { - return nil, fmt.Errorf("too small") - } - if max != nil && int(res) > *max { - return nil, fmt.Errorf("too large") - } - return next(ctx) - - case *int: - if min != nil && *res < *min { - return nil, fmt.Errorf("too small") - } - if max != nil && *res > *max { - return nil, fmt.Errorf("too large") - } - return next(ctx) - } - return nil, fmt.Errorf("unsupported type %T", res) - }, - Custom: func(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error) { - return next(ctx) - }, - Logged: func(ctx context.Context, obj interface{}, next graphql.Resolver, id string) (interface{}, error) { - return next(context.WithValue(ctx, "request_id", &id)) - }, - ToNull: func(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error) { - return nil, nil - }, - Directive1: func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - return next(ctx) - }, - Directive2: func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { - return next(ctx) - }, - Unimplemented: nil, - }, - }), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 1))) - }), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 2))) - }), - ) c := client.New(srv) t.Run("arg directives", func(t *testing.T) { diff --git a/codegen/testserver/generated_test.go b/codegen/testserver/generated_test.go index 38362c131f5..7868045adc8 100644 --- a/codegen/testserver/generated_test.go +++ b/codegen/testserver/generated_test.go @@ -5,21 +5,14 @@ package testserver import ( "context" - "net/http" "reflect" "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) -func TestGeneratedResolversAreValid(t *testing.T) { - http.Handle("/query", handler.GraphQL(NewExecutableSchema(Config{ - Resolvers: &Resolver{}, - }))) -} - func TestForcedResolverFieldIsPointer(t *testing.T) { field, ok := reflect.TypeOf((*ForcedResolverResolver)(nil)).Elem().MethodByName("Field") require.True(t, ok) @@ -39,7 +32,8 @@ func TestUnionFragments(t *testing.T) { return &Circle{Radius: 32}, nil } - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers})) + c := client.New(srv) t.Run("inline fragment on union", func(t *testing.T) { var resp struct { diff --git a/codegen/testserver/input_test.go b/codegen/testserver/input_test.go index 851d1f5eecc..5593c4225c3 100644 --- a/codegen/testserver/input_test.go +++ b/codegen/testserver/input_test.go @@ -5,14 +5,14 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestInput(t *testing.T) { resolvers := &Stub{} - - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers})) + c := client.New(srv) t.Run("when function errors on directives", func(t *testing.T) { resolvers.QueryResolver.InputSlice = func(ctx context.Context, arg []string) (b bool, e error) { diff --git a/codegen/testserver/interfaces_test.go b/codegen/testserver/interfaces_test.go index 88c3fe61ee9..05a31dff349 100644 --- a/codegen/testserver/interfaces_test.go +++ b/codegen/testserver/interfaces_test.go @@ -7,7 +7,7 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -24,7 +24,7 @@ func TestInterfaces(t *testing.T) { return nil, nil } - srv := handler.GraphQL( + srv := handler.NewDefaultServer( NewExecutableSchema(Config{ Resolvers: resolvers, Directives: DirectiveRoot{ diff --git a/codegen/testserver/introspection_test.go b/codegen/testserver/introspection_test.go index 75ce38e9b66..e98dbe93e2a 100644 --- a/codegen/testserver/introspection_test.go +++ b/codegen/testserver/introspection_test.go @@ -6,19 +6,19 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/99designs/gqlgen/graphql/introspection" - "github.com/99designs/gqlgen/handler" "github.com/stretchr/testify/require" ) func TestIntrospection(t *testing.T) { - t.Run("disabled", func(t *testing.T) { + t.Run("disabled when creating your own server", func(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL( - NewExecutableSchema(Config{Resolvers: resolvers}), - handler.IntrospectionEnabled(false), - )) + srv := handler.New(NewExecutableSchema(Config{Resolvers: resolvers})) + srv.AddTransport(transport.POST{}) + c := client.New(srv) var resp interface{} err := c.Post(introspection.Query, &resp) @@ -28,7 +28,7 @@ func TestIntrospection(t *testing.T) { t.Run("enabled by default", func(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL( + c := client.New(handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolvers}), )) @@ -65,14 +65,12 @@ func TestIntrospection(t *testing.T) { t.Run("disabled by middleware", func(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL( - NewExecutableSchema(Config{Resolvers: resolvers}), - handler.RequestMiddleware(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { - graphql.GetOperationContext(ctx).DisableIntrospection = true - - return next(ctx) - }), - )) + srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers})) + srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + graphql.GetOperationContext(ctx).DisableIntrospection = true + return next(ctx) + }) + c := client.New(srv) var resp interface{} err := c.Post(introspection.Query, &resp) diff --git a/codegen/testserver/maps_test.go b/codegen/testserver/maps_test.go index 20035f8911c..85b964d9eb8 100644 --- a/codegen/testserver/maps_test.go +++ b/codegen/testserver/maps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -21,7 +21,7 @@ func TestMaps(t *testing.T) { return in.Map, nil } - c := client.New(handler.GraphQL( + c := client.New(handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolver}), )) t.Run("unset", func(t *testing.T) { diff --git a/codegen/testserver/middleware_test.go b/codegen/testserver/middleware_test.go index 13d0ce84e42..721f4532272 100644 --- a/codegen/testserver/middleware_test.go +++ b/codegen/testserver/middleware_test.go @@ -6,7 +6,7 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -27,21 +27,23 @@ func TestMiddleware(t *testing.T) { } areMethods := []bool{} - srv := handler.GraphQL( + srv := handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolvers}), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 1))) - }), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 2))) - }), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - areMethods = append(areMethods, graphql.GetFieldContext(ctx).IsMethod) - return next(ctx) - }), ) + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + path, _ := ctx.Value("path").([]int) + return next(context.WithValue(ctx, "path", append(path, 1))) + }) + + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + path, _ := ctx.Value("path").([]int) + return next(context.WithValue(ctx, "path", append(path, 2))) + }) + + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + areMethods = append(areMethods, graphql.GetFieldContext(ctx).IsMethod) + return next(ctx) + }) c := client.New(srv) diff --git a/codegen/testserver/modelmethod_test.go b/codegen/testserver/modelmethod_test.go index 6174c15eab5..6455a8cef44 100644 --- a/codegen/testserver/modelmethod_test.go +++ b/codegen/testserver/modelmethod_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -18,7 +18,7 @@ func TestModelMethods(t *testing.T) { return true, nil } - c := client.New(handler.GraphQL( + c := client.New(handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolver}), )) t.Run("without context", func(t *testing.T) { diff --git a/codegen/testserver/nulls_test.go b/codegen/testserver/nulls_test.go index eac27a9847b..e79eecc283a 100644 --- a/codegen/testserver/nulls_test.go +++ b/codegen/testserver/nulls_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -22,7 +22,7 @@ func TestNullBubbling(t *testing.T) { return &Error{ID: "E1234"}, nil } - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("when function errors on non required field", func(t *testing.T) { var resp struct { diff --git a/codegen/testserver/panics_test.go b/codegen/testserver/panics_test.go index f5de5ab4715..85235864f0a 100644 --- a/codegen/testserver/panics_test.go +++ b/codegen/testserver/panics_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -21,7 +21,7 @@ func TestPanics(t *testing.T) { return []MarshalPanic{MarshalPanic("aa"), MarshalPanic("bb")}, nil } - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("panics in marshallers will not kill server", func(t *testing.T) { var resp interface{} diff --git a/codegen/testserver/primitive_objects_test.go b/codegen/testserver/primitive_objects_test.go index cef6a84b2a9..c52a8979d73 100644 --- a/codegen/testserver/primitive_objects_test.go +++ b/codegen/testserver/primitive_objects_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/assert" ) @@ -19,7 +19,7 @@ func TestPrimitiveObjects(t *testing.T) { return int(*obj), nil } - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("can fetch value", func(t *testing.T) { var resp struct { @@ -51,7 +51,7 @@ func TestPrimitiveStringObjects(t *testing.T) { return len(string(*obj)), nil } - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("can fetch value", func(t *testing.T) { var resp struct { diff --git a/codegen/testserver/response_extension_test.go b/codegen/testserver/response_extension_test.go index 198ea08e561..692327d0f2c 100644 --- a/codegen/testserver/response_extension_test.go +++ b/codegen/testserver/response_extension_test.go @@ -6,7 +6,7 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -16,14 +16,16 @@ func TestResponseExtension(t *testing.T) { return "Ok", nil } - srv := handler.GraphQL( + srv := handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolvers}), - handler.RequestMiddleware(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { - graphql.RegisterExtension(ctx, "example", "value") - - return next(ctx) - }), ) + + srv.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + graphql.RegisterExtension(ctx, "example", "value") + + return next(ctx) + }) + c := client.New(srv) raw, _ := c.RawPost(`query { valid }`) diff --git a/codegen/testserver/scalar_default_test.go b/codegen/testserver/scalar_default_test.go index d891737b787..c510ca46671 100644 --- a/codegen/testserver/scalar_default_test.go +++ b/codegen/testserver/scalar_default_test.go @@ -5,14 +5,14 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestDefaultScalarImplementation(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) resolvers.QueryResolver.DefaultScalar = func(ctx context.Context, arg string) (i string, e error) { return arg, nil diff --git a/codegen/testserver/slices_test.go b/codegen/testserver/slices_test.go index 6d314b71bbf..783a4a49b00 100644 --- a/codegen/testserver/slices_test.go +++ b/codegen/testserver/slices_test.go @@ -5,14 +5,14 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestSlices(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("nulls vs empty slices", func(t *testing.T) { resolvers.QueryResolver.Slices = func(ctx context.Context) (slices *Slices, e error) { diff --git a/codegen/testserver/subscription_test.go b/codegen/testserver/subscription_test.go index 9e34599155c..1731aae9b46 100644 --- a/codegen/testserver/subscription_test.go +++ b/codegen/testserver/subscription_test.go @@ -8,9 +8,11 @@ import ( "testing" "time" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -20,7 +22,7 @@ func TestSubscriptions(t *testing.T) { resolvers := &Stub{} resolvers.SubscriptionResolver.InitPayload = func(ctx context.Context) (strings <-chan string, e error) { - payload := handler.GetInitPayload(ctx) + payload := transport.GetInitPayload(ctx) channel := make(chan string, len(payload)+1) go func() { @@ -66,17 +68,19 @@ func TestSubscriptions(t *testing.T) { return res, nil } - srv := handler.GraphQL( + srv := handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolvers}), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 1))) - }), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - path, _ := ctx.Value("path").([]int) - return next(context.WithValue(ctx, "path", append(path, 2))) - }), ) + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + path, _ := ctx.Value("path").([]int) + return next(context.WithValue(ctx, "path", append(path, 1))) + }) + + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + path, _ := ctx.Value("path").([]int) + return next(context.WithValue(ctx, "path", append(path, 2))) + }) + c := client.New(srv) t.Run("wont leak goroutines", func(t *testing.T) { diff --git a/codegen/testserver/time_test.go b/codegen/testserver/time_test.go index 1b41df3aea2..291567e7a1b 100644 --- a/codegen/testserver/time_test.go +++ b/codegen/testserver/time_test.go @@ -6,14 +6,14 @@ import ( "time" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestTime(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) resolvers.QueryResolver.User = func(ctx context.Context, id int) (user *User, e error) { return &User{}, nil diff --git a/codegen/testserver/typefallback_test.go b/codegen/testserver/typefallback_test.go index ac74f36ac7c..8ebd091e9ef 100644 --- a/codegen/testserver/typefallback_test.go +++ b/codegen/testserver/typefallback_test.go @@ -5,14 +5,14 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestTypeFallback(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) resolvers.QueryResolver.Fallback = func(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) { return arg, nil diff --git a/codegen/testserver/validtypes_test.go b/codegen/testserver/validtypes_test.go index 412ebbe41dc..6ae9f1bff1c 100644 --- a/codegen/testserver/validtypes_test.go +++ b/codegen/testserver/validtypes_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -18,7 +18,7 @@ func TestValidType(t *testing.T) { }, nil } - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("fields with differing cases can be distinguished", func(t *testing.T) { var resp struct { diff --git a/codegen/testserver/wrapped_type_test.go b/codegen/testserver/wrapped_type_test.go index 4785307f2b0..7c0405a1149 100644 --- a/codegen/testserver/wrapped_type_test.go +++ b/codegen/testserver/wrapped_type_test.go @@ -6,14 +6,14 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/codegen/testserver/otherpkg" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestWrappedTypes(t *testing.T) { resolvers := &Stub{} - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) resolvers.QueryResolver.WrappedScalar = func(ctx context.Context) (scalar WrappedScalar, e error) { return "hello", nil diff --git a/docs/content/recipes/authentication.md b/docs/content/recipes/authentication.md index 284330a9c08..a1c7d24cda3 100644 --- a/docs/content/recipes/authentication.md +++ b/docs/content/recipes/authentication.md @@ -78,7 +78,8 @@ import ( "net/http" "github.com/99designs/gqlgen/example/starwars" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" "github.com/go-chi/chi" ) @@ -87,10 +88,9 @@ func main() { router.Use(auth.Middleware(db)) - router.Handle("/", handler.Playground("Starwars", "/query")) - router.Handle("/query", - handler.GraphQL(starwars.NewExecutableSchema(starwars.NewResolver())), - ) + srv := handler.NewDefaultServer(starwars.NewExecutableSchema(starwars.NewResolver())) + router.Handle("/", playground.Handler("Starwars", "/query")) + router.Handle("/query", srv) err := http.ListenAndServe(":8080", router) if err != nil { diff --git a/docs/content/recipes/cors.md b/docs/content/recipes/cors.md index 321c49b89c9..cbfaa2576d3 100644 --- a/docs/content/recipes/cors.md +++ b/docs/content/recipes/cors.md @@ -15,10 +15,11 @@ gqlgen doesn't include a CORS implementation, but it is built to work with all s package main import ( - "net/http" + "net/http" - "github.com/99designs/gqlgen/example/starwars" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/example/starwars" + "github.com/99designs/gqlgen/graphql/handler" "github.com/go-chi/chi" "github.com/rs/cors" ) @@ -34,19 +35,21 @@ func main() { Debug: true, }).Handler) - upgrader := websocket.Upgrader{ - CheckOrigin: func(r *http.Request) bool { - // Check against your desired domains here - return r.Host == "example.org" - }, - ReadBufferSize: 1024, - WriteBufferSize: 1024, - } + + srv := handler.New(starwars.NewExecutableSchema(starwars.NewResolver())) + srv.AddTransport(&transport.Websocket{ + Upgrader: websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + // Check against your desired domains here + return r.Host == "example.org" + }, + ReadBufferSize: 1024, + WriteBufferSize: 1024, + }, + }) router.Handle("/", handler.Playground("Starwars", "/query")) - router.Handle("/query", - handler.GraphQL(starwars.NewExecutableSchema(starwars.NewResolver()), handler.WebsocketUpgrader(upgrader)), - ) + router.Handle("/query", srv) err := http.ListenAndServe(":8080", router) if err != nil { diff --git a/docs/content/recipes/gin.md b/docs/content/recipes/gin.md index e793575031c..1e680dc6471 100644 --- a/docs/content/recipes/gin.md +++ b/docs/content/recipes/gin.md @@ -19,7 +19,7 @@ $ go get github.com/gin-gonic/gin In your router file, define the handlers for the GraphQL and Playground endpoints in two different methods and tie then together in the Gin router: ```go import ( - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/gin-gonic/gin" ) @@ -27,7 +27,7 @@ import ( func graphqlHandler() gin.HandlerFunc { // NewExecutableSchema and Config are in the generated.go file // Resolver is in the resolver.go file - h := handler.GraphQL(NewExecutableSchema(Config{Resolvers: &Resolver{}})) + h := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{}})) return func(c *gin.Context) { h.ServeHTTP(c.Writer, c.Request) @@ -36,7 +36,7 @@ func graphqlHandler() gin.HandlerFunc { // Defining the Playground handler func playgroundHandler() gin.HandlerFunc { - h := handler.Playground("GraphQL", "/query") + h := playground.Handler("GraphQL", "/query") return func(c *gin.Context) { h.ServeHTTP(c.Writer, c.Request) @@ -99,4 +99,4 @@ func (r *resolver) Todo(ctx context.Context) (*Todo, error) { // ... } -``` \ No newline at end of file +``` diff --git a/example/chat/chat_test.go b/example/chat/chat_test.go index c3eff1832f5..40b37c07f70 100644 --- a/example/chat/chat_test.go +++ b/example/chat/chat_test.go @@ -5,13 +5,13 @@ import ( "time" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestChatSubscriptions(t *testing.T) { - c := client.New(handler.GraphQL(NewExecutableSchema(New()))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(New()))) sub := c.Websocket(`subscription @user(username:"vektah") { messageAdded(roomName:"#gophers") { text createdBy } }`) defer sub.Close() diff --git a/example/chat/server/server.go b/example/chat/server/server.go index 3bc41acd96f..65077b80e8a 100644 --- a/example/chat/server/server.go +++ b/example/chat/server/server.go @@ -6,10 +6,13 @@ import ( "net/url" "time" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql/playground" "github.com/99designs/gqlgen/example/chat" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/gorilla/websocket" "github.com/opentracing/opentracing-go" "github.com/rs/cors" @@ -26,14 +29,21 @@ func main() { AllowCredentials: true, }) - http.Handle("/", playground.Handler("Todo", "/query")) - http.Handle("/query", c.Handler(handler.GraphQL(chat.NewExecutableSchema(chat.New()), - handler.WebsocketUpgrader(websocket.Upgrader{ + srv := handler.New(chat.NewExecutableSchema(chat.New())) + + srv.AddTransport(transport.Websocket{ + KeepAlivePingInterval: 10 * time.Second, + Upgrader: websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, - }))), - ) + }, + }) + srv.Use(extension.Introspection{}) + + http.Handle("/", playground.Handler("Todo", "/query")) + http.Handle("/query", c.Handler(srv)) + log.Fatal(http.ListenAndServe(":8085", nil)) } diff --git a/example/config/server/server.go b/example/config/server/server.go index 24c0e98bb41..b2dfbeda73e 100644 --- a/example/config/server/server.go +++ b/example/config/server/server.go @@ -4,15 +4,14 @@ import ( "log" "net/http" - "github.com/99designs/gqlgen/graphql/playground" - todo "github.com/99designs/gqlgen/example/config" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" ) func main() { http.Handle("/", playground.Handler("Todo", "/query")) - http.Handle("/query", handler.GraphQL( + http.Handle("/query", handler.NewDefaultServer( todo.NewExecutableSchema(todo.New()), )) log.Fatal(http.ListenAndServe(":8081", nil)) diff --git a/example/dataloader/dataloader_test.go b/example/dataloader/dataloader_test.go index ef20367ad31..17df8076027 100644 --- a/example/dataloader/dataloader_test.go +++ b/example/dataloader/dataloader_test.go @@ -4,13 +4,13 @@ import ( "testing" "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/introspection" - "github.com/99designs/gqlgen/handler" "github.com/stretchr/testify/require" ) func TestTodo(t *testing.T) { - c := client.New(LoaderMiddleware(handler.GraphQL(NewExecutableSchema(Config{Resolvers: &Resolver{}})))) + c := client.New(LoaderMiddleware(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{}})))) t.Run("create a new todo", func(t *testing.T) { var resp interface{} diff --git a/example/dataloader/server/server.go b/example/dataloader/server/server.go index fd52d248cdf..d599330ff90 100644 --- a/example/dataloader/server/server.go +++ b/example/dataloader/server/server.go @@ -4,10 +4,9 @@ import ( "log" "net/http" - "github.com/99designs/gqlgen/graphql/playground" - "github.com/99designs/gqlgen/example/dataloader" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" "github.com/go-chi/chi" ) @@ -16,7 +15,7 @@ func main() { router.Use(dataloader.LoaderMiddleware) router.Handle("/", playground.Handler("Dataloader", "/query")) - router.Handle("/query", handler.GraphQL( + router.Handle("/query", handler.NewDefaultServer( dataloader.NewExecutableSchema(dataloader.Config{Resolvers: &dataloader.Resolver{}}), )) diff --git a/example/fileupload/fileupload_test.go b/example/fileupload/fileupload_test.go index 10fff064b64..9856d639c1e 100644 --- a/example/fileupload/fileupload_test.go +++ b/example/fileupload/fileupload_test.go @@ -14,7 +14,8 @@ import ( "github.com/99designs/gqlgen/example/fileupload/model" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" ) @@ -36,7 +37,7 @@ func TestFileUpload(t *testing.T) { Content: string(content), }, nil } - srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolver}))) + srv := httptest.NewServer(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolver}))) defer srv.Close() operations := `{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) { id, name, content } }", "variables": { "file": null } }` @@ -77,7 +78,7 @@ func TestFileUpload(t *testing.T) { Content: string(content), }, nil } - srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolver}))) + srv := httptest.NewServer(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolver}))) defer srv.Close() operations := `{ "query": "mutation ($req: UploadFile!) { singleUploadWithPayload(req: $req) { id, name, content } }", "variables": { "req": {"file": null, "id": 1 } } }` @@ -121,7 +122,7 @@ func TestFileUpload(t *testing.T) { require.ElementsMatch(t, []string{"test1", "test2"}, contents) return resp, nil } - srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolver}))) + srv := httptest.NewServer(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolver}))) defer srv.Close() operations := `{ "query": "mutation($files: [Upload!]!) { multipleUpload(files: $files) { id, name, content } }", "variables": { "files": [null, null] } }` @@ -174,7 +175,7 @@ func TestFileUpload(t *testing.T) { require.ElementsMatch(t, []string{"test1", "test2"}, contents) return resp, nil } - srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolver}))) + srv := httptest.NewServer(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolver}))) defer srv.Close() operations := `{ "query": "mutation($req: [UploadFile!]!) { multipleUploadWithPayload(req: $req) { id, name, content } }", "variables": { "req": [ { "id": 1, "file": null }, { "id": 2, "file": null } ] } }` @@ -250,8 +251,10 @@ func TestFileUpload(t *testing.T) { } test := func(uploadMaxMemory int64) { - memory := handler.UploadMaxMemory(uploadMaxMemory) - srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolver}), memory)) + hndlr := handler.New(NewExecutableSchema(Config{Resolvers: resolver})) + hndlr.AddTransport(transport.MultipartForm{MaxMemory: uploadMaxMemory}) + + srv := httptest.NewServer(hndlr) defer srv.Close() req := createUploadRequest(t, srv.URL, operations, mapData, files) resp, err := client.Do(req) diff --git a/example/fileupload/server/server.go b/example/fileupload/server/server.go index 40c7cc5cf02..a1b165de6dd 100644 --- a/example/fileupload/server/server.go +++ b/example/fileupload/server/server.go @@ -7,24 +7,30 @@ import ( "log" "net/http" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql/playground" "github.com/99designs/gqlgen/example/fileupload" "github.com/99designs/gqlgen/example/fileupload/model" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" ) func main() { http.Handle("/", playground.Handler("File Upload Demo", "/query")) resolver := getResolver() - exec := fileupload.NewExecutableSchema(fileupload.Config{Resolvers: resolver}) var mb int64 = 1 << 20 - uploadMaxMemory := handler.UploadMaxMemory(32 * mb) - uploadMaxSize := handler.UploadMaxSize(50 * mb) - http.Handle("/query", handler.GraphQL(exec, uploadMaxMemory, uploadMaxSize)) + srv := handler.New(fileupload.NewExecutableSchema(fileupload.Config{Resolvers: resolver})) + + srv.AddTransport(transport.MultipartForm{ + MaxMemory: 32 * mb, + MaxUploadSize: 50 * mb, + }) + + http.Handle("/query", srv) log.Print("connect to http://localhost:8087/ for GraphQL playground") log.Fatal(http.ListenAndServe(":8087", nil)) } diff --git a/example/scalars/scalar_test.go b/example/scalars/scalar_test.go index 8268c9acf8d..85ac48c3911 100644 --- a/example/scalars/scalar_test.go +++ b/example/scalars/scalar_test.go @@ -5,8 +5,8 @@ import ( "time" "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/introspection" - "github.com/99designs/gqlgen/handler" "github.com/stretchr/testify/require" ) @@ -21,7 +21,7 @@ type RawUser struct { } func TestScalars(t *testing.T) { - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: &Resolver{}}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{}}))) t.Run("marshaling", func(t *testing.T) { var resp struct { diff --git a/example/scalars/server/server.go b/example/scalars/server/server.go index 7a70f2e59fc..45cb75c146f 100644 --- a/example/scalars/server/server.go +++ b/example/scalars/server/server.go @@ -4,15 +4,14 @@ import ( "log" "net/http" - "github.com/99designs/gqlgen/graphql/playground" - "github.com/99designs/gqlgen/example/scalars" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" ) func main() { http.Handle("/", playground.Handler("Starwars", "/query")) - http.Handle("/query", handler.GraphQL(scalars.NewExecutableSchema(scalars.Config{Resolvers: &scalars.Resolver{}}))) + http.Handle("/query", handler.NewDefaultServer(scalars.NewExecutableSchema(scalars.Config{Resolvers: &scalars.Resolver{}}))) log.Fatal(http.ListenAndServe(":8084", nil)) } diff --git a/example/selection/selection_test.go b/example/selection/selection_test.go index 9ccf3a150f4..c6874033220 100644 --- a/example/selection/selection_test.go +++ b/example/selection/selection_test.go @@ -4,12 +4,12 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) func TestSelection(t *testing.T) { - c := client.New(handler.GraphQL(NewExecutableSchema(Config{Resolvers: &Resolver{}}))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{}}))) query := `{ events { diff --git a/example/selection/server/server.go b/example/selection/server/server.go index 4278e7c7eea..4cd1f44c083 100644 --- a/example/selection/server/server.go +++ b/example/selection/server/server.go @@ -4,14 +4,13 @@ import ( "log" "net/http" - "github.com/99designs/gqlgen/graphql/playground" - "github.com/99designs/gqlgen/example/selection" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" ) func main() { http.Handle("/", playground.Handler("Selection Demo", "/query")) - http.Handle("/query", handler.GraphQL(selection.NewExecutableSchema(selection.Config{Resolvers: &selection.Resolver{}}))) + http.Handle("/query", handler.NewDefaultServer(selection.NewExecutableSchema(selection.Config{Resolvers: &selection.Resolver{}}))) log.Fatal(http.ListenAndServe(":8086", nil)) } diff --git a/example/starwars/benchmarks_test.go b/example/starwars/benchmarks_test.go index ad76062aa16..1aaec2b5794 100644 --- a/example/starwars/benchmarks_test.go +++ b/example/starwars/benchmarks_test.go @@ -6,11 +6,11 @@ import ( "testing" "github.com/99designs/gqlgen/example/starwars/generated" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" ) func BenchmarkSimpleQueryNoArgs(b *testing.B) { - server := handler.GraphQL(generated.NewExecutableSchema(NewResolver())) + server := handler.NewDefaultServer(generated.NewExecutableSchema(NewResolver())) q := `{"query":"{ search(text:\"Luke\") { ... on Human { starships { name } } } }"}` diff --git a/example/starwars/server/server.go b/example/starwars/server/server.go index 73c7bebca30..cd1af69ad76 100644 --- a/example/starwars/server/server.go +++ b/example/starwars/server/server.go @@ -6,25 +6,25 @@ import ( "log" "net/http" - "github.com/99designs/gqlgen/graphql/playground" - "github.com/99designs/gqlgen/example/starwars" "github.com/99designs/gqlgen/example/starwars/generated" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" ) func main() { + srv := handler.NewDefaultServer(generated.NewExecutableSchema(starwars.NewResolver())) + srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + rc := graphql.GetFieldContext(ctx) + fmt.Println("Entered", rc.Object, rc.Field.Name) + res, err = next(ctx) + fmt.Println("Left", rc.Object, rc.Field.Name, "=>", res, err) + return res, err + }) + http.Handle("/", playground.Handler("Starwars", "/query")) - http.Handle("/query", handler.GraphQL(generated.NewExecutableSchema(starwars.NewResolver()), - handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { - rc := graphql.GetFieldContext(ctx) - fmt.Println("Entered", rc.Object, rc.Field.Name) - res, err = next(ctx) - fmt.Println("Left", rc.Object, rc.Field.Name, "=>", res, err) - return res, err - }), - )) + http.Handle("/query", srv) log.Fatal(http.ListenAndServe(":8080", nil)) } diff --git a/example/starwars/starwars_test.go b/example/starwars/starwars_test.go index 9e9f8172f5d..c720270e2b9 100644 --- a/example/starwars/starwars_test.go +++ b/example/starwars/starwars_test.go @@ -5,13 +5,13 @@ import ( "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/example/starwars/generated" + "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/introspection" - "github.com/99designs/gqlgen/handler" "github.com/stretchr/testify/require" ) func TestStarwars(t *testing.T) { - c := client.New(handler.GraphQL(generated.NewExecutableSchema(NewResolver()))) + c := client.New(handler.NewDefaultServer(generated.NewExecutableSchema(NewResolver()))) t.Run("Lukes starships", func(t *testing.T) { var resp struct { diff --git a/example/todo/server/server.go b/example/todo/server/server.go index 3cbe0a83d77..4c105427cfa 100644 --- a/example/todo/server/server.go +++ b/example/todo/server/server.go @@ -7,22 +7,21 @@ import ( "net/http" "runtime/debug" - "github.com/99designs/gqlgen/graphql/playground" - "github.com/99designs/gqlgen/example/todo" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" ) func main() { + srv := handler.NewDefaultServer(todo.NewExecutableSchema(todo.New())) + srv.SetRecoverFunc(func(ctx context.Context, err interface{}) (userMessage error) { + // send this panic somewhere + log.Print(err) + debug.PrintStack() + return errors.New("user message on panic") + }) + http.Handle("/", playground.Handler("Todo", "/query")) - http.Handle("/query", handler.GraphQL( - todo.NewExecutableSchema(todo.New()), - handler.RecoverFunc(func(ctx context.Context, err interface{}) error { - // send this panic somewhere - log.Print(err) - debug.PrintStack() - return errors.New("user message on panic") - }), - )) + http.Handle("/query", srv) log.Fatal(http.ListenAndServe(":8081", nil)) } diff --git a/example/todo/todo_test.go b/example/todo/todo_test.go index 965f62b7606..7423580f8c8 100644 --- a/example/todo/todo_test.go +++ b/example/todo/todo_test.go @@ -4,13 +4,13 @@ import ( "testing" "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/introspection" - "github.com/99designs/gqlgen/handler" "github.com/stretchr/testify/require" ) func TestTodo(t *testing.T) { - c := client.New(handler.GraphQL(NewExecutableSchema(New()))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(New()))) var resp struct { CreateTodo struct{ ID string } @@ -180,7 +180,7 @@ func TestTodo(t *testing.T) { } func TestSkipAndIncludeDirectives(t *testing.T) { - c := client.New(handler.GraphQL(NewExecutableSchema(New()))) + c := client.New(handler.NewDefaultServer(NewExecutableSchema(New()))) t.Run("skip on field", func(t *testing.T) { var resp map[string]interface{} diff --git a/example/type-system-extension/server/server.go b/example/type-system-extension/server/server.go index 2d29bdc623c..e7f703b4155 100644 --- a/example/type-system-extension/server/server.go +++ b/example/type-system-extension/server/server.go @@ -8,7 +8,7 @@ import ( "github.com/99designs/gqlgen/graphql/playground" extension "github.com/99designs/gqlgen/example/type-system-extension" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" ) const defaultPort = "8080" @@ -20,7 +20,7 @@ func main() { } http.Handle("/", playground.Handler("GraphQL playground", "/query")) - http.Handle("/query", handler.GraphQL( + http.Handle("/query", handler.NewDefaultServer( extension.NewExecutableSchema( extension.Config{ Resolvers: extension.NewRootResolver(), diff --git a/graphql/error.go b/graphql/error.go index feaf3cc6351..a7a6769beda 100644 --- a/graphql/error.go +++ b/graphql/error.go @@ -6,7 +6,7 @@ import ( "github.com/vektah/gqlparser/gqlerror" ) -type ErrorPresenterFunc func(context.Context, error) *gqlerror.Error +type ErrorPresenterFunc func(ctx context.Context, err error) *gqlerror.Error type ExtendedError interface { Extensions() map[string]interface{} diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index 85c49f35865..83979978509 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -70,7 +70,7 @@ func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql } func GetComplexityStats(ctx context.Context) *ComplexityStats { - rc := graphql.GetRequestContext(ctx) + rc := graphql.GetOperationContext(ctx) if rc == nil { return nil } diff --git a/graphql/handler/server.go b/graphql/handler/server.go index d75b6f3861c..042bd588a28 100644 --- a/graphql/handler/server.go +++ b/graphql/handler/server.go @@ -8,7 +8,6 @@ import ( "time" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/handler/apollotracing" "github.com/99designs/gqlgen/graphql/handler/extension" "github.com/99designs/gqlgen/graphql/handler/lru" "github.com/99designs/gqlgen/graphql/handler/transport" @@ -56,7 +55,6 @@ func NewDefaultServer(es graphql.ExecutableSchema) *Server { srv.Use(extension.AutomaticPersistedQuery{ Cache: lru.New(100), }) - srv.Use(apollotracing.Tracer{}) return srv } diff --git a/integration/server/server.go b/integration/server/server.go index a2b8a50cda7..63f2eca37d0 100644 --- a/integration/server/server.go +++ b/integration/server/server.go @@ -6,10 +6,11 @@ import ( "net/http" "os" - "github.com/99designs/gqlgen/graphql/playground" + "github.com/99designs/gqlgen/graphql/handler/extension" "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" "github.com/99designs/gqlgen/integration" "github.com/pkg/errors" "github.com/vektah/gqlparser/gqlerror" @@ -29,20 +30,21 @@ func main() { // function is executed. return value } - http.Handle("/", playground.Handler("GraphQL playground", "/query")) - http.Handle("/query", handler.GraphQL( - integration.NewExecutableSchema(cfg), - handler.ErrorPresenter(func(ctx context.Context, e error) *gqlerror.Error { - if e, ok := errors.Cause(e).(*integration.CustomError); ok { - return &gqlerror.Error{ - Message: e.UserMessage, - Path: graphql.GetFieldContext(ctx).Path(), - } + + srv := handler.NewDefaultServer(integration.NewExecutableSchema(cfg)) + srv.SetErrorPresenter(func(ctx context.Context, e error) *gqlerror.Error { + if e, ok := errors.Cause(e).(*integration.CustomError); ok { + return &gqlerror.Error{ + Message: e.UserMessage, + Path: graphql.GetFieldContext(ctx).Path(), } - return graphql.DefaultErrorPresenter(ctx, e) - }), - handler.ComplexityLimit(1000), - )) + } + return graphql.DefaultErrorPresenter(ctx, e) + }) + srv.Use(extension.FixedComplexityLimit(1000)) + + http.Handle("/", playground.Handler("GraphQL playground", "/query")) + http.Handle("/query", srv) log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) log.Fatal(http.ListenAndServe(":"+port, nil)) diff --git a/plugin/resolvergen/resolver.gotpl b/plugin/resolvergen/resolver.gotpl index 66d6efac25e..ab420050065 100644 --- a/plugin/resolvergen/resolver.gotpl +++ b/plugin/resolvergen/resolver.gotpl @@ -9,7 +9,6 @@ {{ reserveImport "errors" }} {{ reserveImport "bytes" }} -{{ reserveImport "github.com/99designs/gqlgen/handler" }} {{ reserveImport "github.com/vektah/gqlparser" }} {{ reserveImport "github.com/vektah/gqlparser/ast" }} {{ reserveImport "github.com/99designs/gqlgen/graphql" }} diff --git a/plugin/servergen/server.gotpl b/plugin/servergen/server.gotpl index fca71c53cda..85ec87fdbcf 100644 --- a/plugin/servergen/server.gotpl +++ b/plugin/servergen/server.gotpl @@ -2,7 +2,7 @@ {{ reserveImport "log" }} {{ reserveImport "net/http" }} {{ reserveImport "os" }} -{{ reserveImport "github.com/99designs/gqlgen/handler" }} +{{ reserveImport "github.com/99designs/gqlgen/graphql/handler" }} const defaultPort = "8080" @@ -12,8 +12,10 @@ func main() { port = defaultPort } + srv := handler.NewDefaultServer({{ lookupImport .ExecPackageName }}.NewExecutableSchema({{ lookupImport .ExecPackageName}}.Config{Resolvers: &{{ lookupImport .ResolverPackageName}}.Resolver{}})) + http.Handle("/", handler.Playground("GraphQL playground", "/query")) - http.Handle("/query", handler.GraphQL({{ lookupImport .ExecPackageName }}.NewExecutableSchema({{ lookupImport .ExecPackageName}}.Config{Resolvers: &{{ lookupImport .ResolverPackageName}}.Resolver{}}))) + http.Handle("/query", srv) log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) log.Fatal(http.ListenAndServe(":" + port, nil)) diff --git a/plugin/stubgen/stubs.gotpl b/plugin/stubgen/stubs.gotpl index c1e9b313149..63df84767ce 100644 --- a/plugin/stubgen/stubs.gotpl +++ b/plugin/stubgen/stubs.gotpl @@ -7,7 +7,6 @@ {{ reserveImport "errors" }} {{ reserveImport "bytes" }} -{{ reserveImport "github.com/99designs/gqlgen/handler" }} {{ reserveImport "github.com/vektah/gqlparser" }} {{ reserveImport "github.com/vektah/gqlparser/ast" }} {{ reserveImport "github.com/99designs/gqlgen/graphql" }} From d0836b72d5fe632808afff9254e415948ff11680 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Nov 2019 16:25:05 +1100 Subject: [PATCH 46/53] Expose APQ stats --- graphql/handler/executor.go | 18 ++++--- graphql/handler/extension/apq.go | 31 ++++++++++- graphql/handler/extension/apq_test.go | 75 ++++++++++++++++++++------- 3 files changed, 95 insertions(+), 29 deletions(-) diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index acc9f454c4b..43643a672b4 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -116,20 +116,22 @@ func (e executor) DispatchOperation(ctx context.Context, rc *graphql.OperationCo } func (e executor) CreateOperationContext(ctx context.Context, params *graphql.RawParams) (*graphql.OperationContext, gqlerror.List) { - for _, p := range e.operationParameterMutators { - if err := p.MutateOperationParameters(ctx, params); err != nil { - return nil, gqlerror.List{err} - } - } - rc := &graphql.OperationContext{ - RawQuery: params.Query, - OperationName: params.OperationName, DisableIntrospection: true, Recover: graphql.DefaultRecover, ResolverMiddleware: e.fieldMiddleware, Stats: graphql.Stats{OperationStart: graphql.GetStartTime(ctx)}, } + ctx = graphql.WithOperationContext(ctx, rc) + + for _, p := range e.operationParameterMutators { + if err := p.MutateOperationParameters(ctx, params); err != nil { + return nil, gqlerror.List{err} + } + } + + rc.RawQuery = params.Query + rc.OperationName = params.OperationName var listErr gqlerror.List rc.Doc, listErr = e.parseQuery(ctx, &rc.Stats, params.Query) diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index 80766fa4c80..c4e78835c14 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -22,6 +22,16 @@ type AutomaticPersistedQuery struct { Cache graphql.Cache } +type ApqStats struct { + // The hash of the incoming query + Hash string + + // SentQuery is true if the incoming request sent the full query + SentQuery bool +} + +const apqExtension = "APQ" + var _ graphql.OperationParameterMutator = AutomaticPersistedQuery{} func (a AutomaticPersistedQuery) ExtensionName() string { @@ -41,8 +51,8 @@ func (a AutomaticPersistedQuery) MutateOperationParameters(ctx context.Context, } var extension struct { - Sha256 string `json:"sha256Hash"` - Version int64 `json:"version"` + Sha256 string `mapstructure:"sha256Hash"` + Version int64 `mapstructure:"version"` } if err := mapstructure.Decode(rawParams.Extensions["persistedQuery"], &extension); err != nil { @@ -53,6 +63,7 @@ func (a AutomaticPersistedQuery) MutateOperationParameters(ctx context.Context, return gqlerror.Errorf("unsupported APQ version") } + fullQuery := false if rawParams.Query == "" { // client sent optimistic query hash without query string, get it from the cache query, ok := a.Cache.Get(extension.Sha256) @@ -66,11 +77,27 @@ func (a AutomaticPersistedQuery) MutateOperationParameters(ctx context.Context, return gqlerror.Errorf("provided APQ hash does not match query") } a.Cache.Add(extension.Sha256, rawParams.Query) + fullQuery = true } + graphql.GetOperationContext(ctx).Stats.SetExtension(apqExtension, &ApqStats{ + Hash: extension.Sha256, + SentQuery: fullQuery, + }) + return nil } +func GetApqStats(ctx context.Context) *ApqStats { + rc := graphql.GetOperationContext(ctx) + if rc == nil { + return nil + } + + s, _ := rc.Stats.GetExtension(apqExtension).(*ApqStats) + return s +} + func computeQueryHash(query string) string { b := sha256.Sum256([]byte(query)) return hex.EncodeToString(b[:]) diff --git a/graphql/handler/extension/apq_test.go b/graphql/handler/extension/apq_test.go index 824516260ae..66970c62e9c 100644 --- a/graphql/handler/extension/apq_test.go +++ b/graphql/handler/extension/apq_test.go @@ -1,53 +1,80 @@ -package extension +package extension_test import ( "context" + "net/http" "testing" "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/testserver" + "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/require" ) +func TestAPQIntegration(t *testing.T) { + h := testserver.New() + h.Use(&extension.AutomaticPersistedQuery{Cache: graphql.MapCache{}}) + h.AddTransport(&transport.POST{}) + + var stats *extension.ApqStats + h.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + stats = extension.GetApqStats(ctx) + return next(ctx) + }) + + resp := doRequest(h, "POST", "/graphql", `{"query":"{ name }","extensions":{"persistedQuery":{"version":1,"sha256Hash":"30166fc3298853f22709fce1e4a00e98f1b6a3160eaaaf9cb3b7db6a16073b07"}}}`) + require.Equal(t, http.StatusOK, resp.Code, resp.Body.String()) + require.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + require.NotNil(t, stats) + require.True(t, stats.SentQuery) + require.Equal(t, "30166fc3298853f22709fce1e4a00e98f1b6a3160eaaaf9cb3b7db6a16073b07", stats.Hash) +} + func TestAPQ(t *testing.T) { const query = "{ me { name } }" const hash = "b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88" t.Run("with query and no hash", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Query: "original query", } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(ctx, params) require.Nil(t, err) require.Equal(t, "original query", params.Query) }) t.Run("with hash miss and no query", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ - "sha256": hash, - "version": 1, + "sha256Hash": hash, + "version": 1, }, }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(ctx, params) require.Equal(t, err.Message, "PersistedQueryNotFound") }) t.Run("with hash miss and query", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Query: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ - "sha256": hash, - "version": 1, + "sha256Hash": hash, + "version": 1, }, }, } cache := graphql.MapCache{} - err := AutomaticPersistedQuery{cache}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{cache}.MutateOperationParameters(ctx, params) require.Nil(t, err) require.Equal(t, "{ me { name } }", params.Query) @@ -55,17 +82,18 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash miss and query", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Query: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ - "sha256": hash, - "version": 1, + "sha256Hash": hash, + "version": 1, }, }, } cache := graphql.MapCache{} - err := AutomaticPersistedQuery{cache}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{cache}.MutateOperationParameters(ctx, params) require.Nil(t, err) require.Equal(t, "{ me { name } }", params.Query) @@ -73,35 +101,38 @@ func TestAPQ(t *testing.T) { }) t.Run("with hash hit and no query", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ - "sha256": hash, - "version": 1, + "sha256Hash": hash, + "version": 1, }, }, } cache := graphql.MapCache{ hash: query, } - err := AutomaticPersistedQuery{cache}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{cache}.MutateOperationParameters(ctx, params) require.Nil(t, err) require.Equal(t, "{ me { name } }", params.Query) }) t.Run("with malformed extension payload", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": "asdf", }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(ctx, params) require.Equal(t, err.Message, "invalid APQ extension data") }) t.Run("with invalid extension version", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ @@ -109,22 +140,28 @@ func TestAPQ(t *testing.T) { }, }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(ctx, params) require.Equal(t, err.Message, "unsupported APQ version") }) t.Run("with hash mismatch", func(t *testing.T) { + ctx := newOC() params := &graphql.RawParams{ Query: query, Extensions: map[string]interface{}{ "persistedQuery": map[string]interface{}{ - "sha256": "badhash", - "version": 1, + "sha256Hash": "badhash", + "version": 1, }, }, } - err := AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(context.Background(), params) + err := extension.AutomaticPersistedQuery{graphql.MapCache{}}.MutateOperationParameters(ctx, params) require.Equal(t, err.Message, "provided APQ hash does not match query") }) } + +func newOC() context.Context { + oc := &graphql.OperationContext{} + return graphql.WithOperationContext(context.Background(), oc) +} From 458fa0deda7b9b45fe7b45d098bb82b15aa207d7 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Nov 2019 16:29:49 +1100 Subject: [PATCH 47/53] Add more interface assertions --- graphql/handler/apollotracing/tracer.go | 7 +++++-- graphql/handler/extension/apq.go | 5 ++++- graphql/handler/extension/complexity.go | 7 +++++-- graphql/handler/extension/introspection.go | 5 ++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index 27e739a5291..b4b0cb312f9 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -39,8 +39,11 @@ type ( } ) -var _ graphql.ResponseInterceptor = Tracer{} -var _ graphql.FieldInterceptor = Tracer{} +var _ interface { + graphql.HandlerExtension + graphql.ResponseInterceptor + graphql.FieldInterceptor +} = Tracer{} func (a Tracer) ExtensionName() string { return "ApolloTracing" diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index c4e78835c14..4511094527c 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -32,7 +32,10 @@ type ApqStats struct { const apqExtension = "APQ" -var _ graphql.OperationParameterMutator = AutomaticPersistedQuery{} +var _ interface { + graphql.OperationParameterMutator + graphql.HandlerExtension +} = AutomaticPersistedQuery{} func (a AutomaticPersistedQuery) ExtensionName() string { return "AutomaticPersistedQuery" diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index 83979978509..8fdb348252e 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -18,7 +18,10 @@ type ComplexityLimit struct { es graphql.ExecutableSchema } -var _ graphql.OperationContextMutator = &ComplexityLimit{} +var _ interface { + graphql.OperationContextMutator + graphql.HandlerExtension +} = &ComplexityLimit{} const complexityExtension = "ComplexityLimit" @@ -31,7 +34,7 @@ type ComplexityStats struct { } // FixedComplexityLimit sets a complexity limit that does not change -func FixedComplexityLimit(limit int) graphql.HandlerExtension { +func FixedComplexityLimit(limit int) *ComplexityLimit { return &ComplexityLimit{ Func: func(ctx context.Context, rc *graphql.OperationContext) int { return limit diff --git a/graphql/handler/extension/introspection.go b/graphql/handler/extension/introspection.go index 632ca26f0b1..6cfc8bace5a 100644 --- a/graphql/handler/extension/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -10,7 +10,10 @@ import ( // EnableIntrospection enables clients to reflect all of the types available on the graph. type Introspection struct{} -var _ graphql.OperationContextMutator = Introspection{} +var _ interface { + graphql.OperationContextMutator + graphql.HandlerExtension +} = Introspection{} func (c Introspection) ExtensionName() string { return "Introspection" From a13a0f5f83eb2c71dbcd658fe2abe263aca0fb2d Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Nov 2019 16:31:59 +1100 Subject: [PATCH 48/53] add docs on extension name conventions --- graphql/handler.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphql/handler.go b/graphql/handler.go index 8e4c0822363..e9c95b442ff 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -45,7 +45,9 @@ type ( // | +--------------------------------------------------------------------+ | // +------------------------------------------------------------------------+ HandlerExtension interface { + // ExtensionName should be a CamelCase string version of the extension which may be shown in stats and logging. ExtensionName() string + // Validate is called when adding an extension to the server, it allows validation against the servers schema. Validate(schema ExecutableSchema) error } From a339a0423ee7cf9562c1767664aad6f15e1b5677 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Nov 2019 16:36:56 +1100 Subject: [PATCH 49/53] panic if operation context is missing when requested --- graphql/context_operation.go | 2 +- graphql/context_operation_test.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/graphql/context_operation.go b/graphql/context_operation.go index 8d6142ec3ff..2265a82b8c4 100644 --- a/graphql/context_operation.go +++ b/graphql/context_operation.go @@ -55,7 +55,7 @@ func GetOperationContext(ctx context.Context) *OperationContext { if val, ok := ctx.Value(operationCtx).(*OperationContext); ok { return val } - return nil + panic("missing operation context") } func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context { diff --git a/graphql/context_operation_test.go b/graphql/context_operation_test.go index d590055bbd5..1086c237fc1 100644 --- a/graphql/context_operation_test.go +++ b/graphql/context_operation_test.go @@ -9,8 +9,6 @@ import ( ) func TestGetOperationContext(t *testing.T) { - require.Nil(t, GetOperationContext(context.Background())) - rc := &OperationContext{} require.Equal(t, rc, GetOperationContext(WithOperationContext(context.Background(), rc))) } From 14dbf1aae6d512f6be5affd0e29686f360eb5579 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Nov 2019 16:37:58 +1100 Subject: [PATCH 50/53] use new handler package in new test --- codegen/testserver/embedded_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/testserver/embedded_test.go b/codegen/testserver/embedded_test.go index 4075ab17c96..7760375fb7f 100644 --- a/codegen/testserver/embedded_test.go +++ b/codegen/testserver/embedded_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/handler" + "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" ) @@ -27,7 +27,7 @@ func TestEmbedded(t *testing.T) { return &EmbeddedCase3{&fakeUnexportedEmbeddedInterface{}}, nil } - c := client.New(handler.GraphQL( + c := client.New(handler.NewDefaultServer( NewExecutableSchema(Config{Resolvers: resolver}), )) From 922db1e3182f119f7c9608f71be4503ad69fad56 Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 28 Nov 2019 16:24:34 +0900 Subject: [PATCH 51/53] always return OperationContext for postpone process --- graphql/context_operation.go | 2 +- graphql/handler/apollotracing/tracer_test.go | 20 ++++++++++++++++++++ graphql/handler/executor.go | 8 ++++---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/graphql/context_operation.go b/graphql/context_operation.go index 2265a82b8c4..cf1a279ec7b 100644 --- a/graphql/context_operation.go +++ b/graphql/context_operation.go @@ -52,7 +52,7 @@ func GetRequestContext(ctx context.Context) *RequestContext { } func GetOperationContext(ctx context.Context) *OperationContext { - if val, ok := ctx.Value(operationCtx).(*OperationContext); ok { + if val, ok := ctx.Value(operationCtx).(*OperationContext); ok && val != nil { return val } panic("missing operation context") diff --git a/graphql/handler/apollotracing/tracer_test.go b/graphql/handler/apollotracing/tracer_test.go index a905e7ffdd2..f94070c33d2 100644 --- a/graphql/handler/apollotracing/tracer_test.go +++ b/graphql/handler/apollotracing/tracer_test.go @@ -8,10 +8,13 @@ import ( "testing" "github.com/99designs/gqlgen/graphql/handler/apollotracing" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/lru" "github.com/99designs/gqlgen/graphql/handler/testserver" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/gqlerror" ) func TestApolloTracing(t *testing.T) { @@ -48,7 +51,24 @@ func TestApolloTracing(t *testing.T) { require.EqualValues(t, "Query", tracing.Execution.Resolvers[0].ParentType) require.EqualValues(t, "name", tracing.Execution.Resolvers[0].FieldName) require.EqualValues(t, "String!", tracing.Execution.Resolvers[0].ReturnType) +} +func TestApolloTracing_withFail(t *testing.T) { + h := testserver.New() + h.AddTransport(transport.POST{}) + h.Use(extension.AutomaticPersistedQuery{Cache: lru.New(100)}) + h.Use(apollotracing.Tracer{}) + + resp := doRequest(h, "POST", "/graphql", `{"operationName":"A","extensions":{"persistedQuery":{"version":1,"sha256Hash":"338bbc16ac780daf81845339fbf0342061c1e9d2b702c96d3958a13a557083a6"}}}`) + assert.Equal(t, http.StatusUnprocessableEntity, resp.Code, resp.Body.String()) + b := resp.Body.Bytes() + t.Log(string(b)) + var respData struct { + Errors gqlerror.List + } + require.NoError(t, json.Unmarshal(b, &respData)) + require.Equal(t, 1, len(respData.Errors)) + require.Equal(t, "PersistedQueryNotFound", respData.Errors[0].Message) } func doRequest(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder { diff --git a/graphql/handler/executor.go b/graphql/handler/executor.go index 43643a672b4..e3b751a2f38 100644 --- a/graphql/handler/executor.go +++ b/graphql/handler/executor.go @@ -126,7 +126,7 @@ func (e executor) CreateOperationContext(ctx context.Context, params *graphql.Ra for _, p := range e.operationParameterMutators { if err := p.MutateOperationParameters(ctx, params); err != nil { - return nil, gqlerror.List{err} + return rc, gqlerror.List{err} } } @@ -136,18 +136,18 @@ func (e executor) CreateOperationContext(ctx context.Context, params *graphql.Ra var listErr gqlerror.List rc.Doc, listErr = e.parseQuery(ctx, &rc.Stats, params.Query) if len(listErr) != 0 { - return nil, listErr + return rc, listErr } rc.Operation = rc.Doc.Operations.ForName(params.OperationName) if rc.Operation == nil { - return nil, gqlerror.List{gqlerror.Errorf("operation %s not found", params.OperationName)} + return rc, gqlerror.List{gqlerror.Errorf("operation %s not found", params.OperationName)} } var err *gqlerror.Error rc.Variables, err = validator.VariableValues(e.server.es.Schema(), rc.Operation, params.Variables) if err != nil { - return nil, gqlerror.List{err} + return rc, gqlerror.List{err} } rc.Stats.Validation.End = graphql.Now() From dca9e4a5b04f34f1bba32d472c0075ee9d0ea476 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Thu, 28 Nov 2019 22:40:40 +1100 Subject: [PATCH 52/53] Add migration docs --- docs/content/recipes/migration-0.11.md | 110 +++++++++++++++++++++++++ docs/static/main.css | 4 + 2 files changed, 114 insertions(+) create mode 100644 docs/content/recipes/migration-0.11.md diff --git a/docs/content/recipes/migration-0.11.md b/docs/content/recipes/migration-0.11.md new file mode 100644 index 00000000000..5b82f1bef2c --- /dev/null +++ b/docs/content/recipes/migration-0.11.md @@ -0,0 +1,110 @@ +--- +title: "Migrating to 0.11" +description: Using the new graphql/handler package in gqlgen 0.11 +linkTitle: Migrating to 0.11 +menu: { main: { parent: 'recipes' } } +--- + +The handler package has grown organically for a long time, 0.11 is a large cleanup of the handler package to make it +more modular and easier to maintain once we get to 1.0. + + +### Transports + +Transports are the first thing that run, they handle decoding the incoming http request, and encoding the graphql +response. Supported transports are: + - GET + - JSON POST + - Multipart form + - Websockets + +new usage looks like this +```go +srv := New(es) + +srv.AddTransport(transport.Websocket{ + KeepAlivePingInterval: 10 * time.Second, +}) +srv.AddTransport(transport.Options{}) +srv.AddTransport(transport.GET{}) +srv.AddTransport(transport.POST{}) +srv.AddTransport(transport.MultipartForm{}) +```` + + +### New handler extension API + +The core of this changes the handler package to be a set of composable extensions. The extensions implement a set of optional interfaces: +- **OperationParameterMutator** runs before creating a OperationContext (formerly RequestContext). allows manipulating the raw query before parsing. +- **OperationContextMutator** runs after creating the OperationContext, but before executing the root resolver. +- **OperationInterceptor** runs for each incoming query after parsing and validation, for basic requests the writer will be invoked once, for subscriptions it will be invoked multiple times. +- **ResponseInterceptor** runs around each graphql operation response. This can be called many times for a single operation the case of subscriptions. +- **FieldInterceptor** runs around each field + +![Anatomy of a request@2x](https://user-images.githubusercontent.com/2247982/68181515-c8a27c00-ffeb-11e9-86f6-1673e7179ecb.png) + +Users of an extension should not need to know which extension points are being used by a given extension, they are added to the server simply by calling `Use(extension)`. + +There are a few convenience methods for defining middleware inline, instead of creating an extension +```go +srv := handler.New(es) +srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { + // this function will be called around every field. next() will evaluate the field and return + // its computed value. + return next(ctx) +}) +srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler { + // This function will be called around every operation, next() will return a function that when + // called will evaluate one response. Eventually next will return nil, signalling there are no + // more results to be returned by the server. + return next(ctx) +}) +srv.AroundResponses(func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { + // This function will be called around each response in the operation. next() will evaluate + // and return a single response. + return next(ctx) +}) +``` + + +Some of the features supported out of the box by handler extensions: + - APQ + - Query Complexity + - Error Presenters and Recover Func + - Introspection Query support + - Query AST cache + - Tracing API + +They can be `Use`'d like this: +```go +srv := handler.New(es) +srv.Use(extension.Introspection{}) +srv.Use(extension.AutomaticPersistedQuery{ + Cache: lru.New(100), +}) +srv.Use(apollotracing.Tracer{}) +``` + +### Default server + +We provide a set of default extensions and transports if you aren't ready to customize them yet. Simply: +```go +handler.NewDefaultServer(es) +``` + +### More contesistent naming + +As part of cleaning up the names the RequestContext has been renamed to OperationContext, as there can be multiple created during the lifecycle of a request. A new ResponseContext has also been created and error handling has been moved here. This allows each response in a subscription to have its own errors. I'm not sure what bugs this might have been causing before... + +### Removal of tracing + +Many of the old interfaces collapse down into just a few extension points: +![Anatomy of a request@2x (1)](https://user-images.githubusercontent.com/2247982/68181517-cb04d600-ffeb-11e9-9271-0295e6c4ff34.png) + +The tracing interface has also been removed, tracing stats are now measured in core (eg time to parse query) and made available on the operation/response contexts. Much of the old interface was designed so that users of a tracer dont need to know which extension points it was listening to, the new handler extensions have the same goal. + +### Backward compatibility + +There is a backwards compatibility layer that keeps most of the original interface in place. There are a few places where BC is known to be broken: + - ResponseMiddleware: The signature used to be `func(ctx context.Context, next func(ctx context.Context) []byte) []byte` and is now `func(ctx context.Context) *Response`. We could maintain BC by marshalling to json before and after, but the change is pretty easy to make and is likely to cause less issues. + - The Tracer interface has been removed, any tracers will need to be reimplemented against the new extension interface. diff --git a/docs/static/main.css b/docs/static/main.css index 0e26e83a766..4a13c4e8954 100644 --- a/docs/static/main.css +++ b/docs/static/main.css @@ -84,6 +84,10 @@ a { text-decoration: none; } +img { + max-width: 100%; +} + a:hover { text-decoration: underline; } From bac79c54bb58d0c7450a6e0f98371c6792ae3a3a Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Thu, 28 Nov 2019 22:49:19 +1100 Subject: [PATCH 53/53] force clean git checkout --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index db475111488..8567dd80fe9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,5 +28,6 @@ build: false deploy: false test_script: + - git clean -ffdx - go generate ./... - go test -timeout 20m ./...