github.com/Kartograf/gqlgen@v0.7.2/example/todo/generated.go (about)

     1  // Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
     2  
     3  package todo
     4  
     5  import (
     6  	"bytes"
     7  	"context"
     8  	"errors"
     9  	"strconv"
    10  	"sync"
    11  
    12  	"github.com/99designs/gqlgen/graphql"
    13  	"github.com/99designs/gqlgen/graphql/introspection"
    14  	"github.com/vektah/gqlparser"
    15  	"github.com/vektah/gqlparser/ast"
    16  )
    17  
    18  // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
    19  func NewExecutableSchema(cfg Config) graphql.ExecutableSchema {
    20  	return &executableSchema{
    21  		resolvers:  cfg.Resolvers,
    22  		directives: cfg.Directives,
    23  		complexity: cfg.Complexity,
    24  	}
    25  }
    26  
    27  type Config struct {
    28  	Resolvers  ResolverRoot
    29  	Directives DirectiveRoot
    30  	Complexity ComplexityRoot
    31  }
    32  
    33  type ResolverRoot interface {
    34  	MyMutation() MyMutationResolver
    35  	MyQuery() MyQueryResolver
    36  }
    37  
    38  type DirectiveRoot struct {
    39  	HasRole func(ctx context.Context, obj interface{}, next graphql.Resolver, role Role) (res interface{}, err error)
    40  }
    41  
    42  type ComplexityRoot struct {
    43  	MyMutation struct {
    44  		CreateTodo func(childComplexity int, todo TodoInput) int
    45  		UpdateTodo func(childComplexity int, id int, changes map[string]interface{}) int
    46  	}
    47  
    48  	MyQuery struct {
    49  		Todo     func(childComplexity int, id int) int
    50  		LastTodo func(childComplexity int) int
    51  		Todos    func(childComplexity int) int
    52  	}
    53  
    54  	Todo struct {
    55  		Id   func(childComplexity int) int
    56  		Text func(childComplexity int) int
    57  		Done func(childComplexity int) int
    58  	}
    59  }
    60  
    61  type MyMutationResolver interface {
    62  	CreateTodo(ctx context.Context, todo TodoInput) (Todo, error)
    63  	UpdateTodo(ctx context.Context, id int, changes map[string]interface{}) (*Todo, error)
    64  }
    65  type MyQueryResolver interface {
    66  	Todo(ctx context.Context, id int) (*Todo, error)
    67  	LastTodo(ctx context.Context) (*Todo, error)
    68  	Todos(ctx context.Context) ([]Todo, error)
    69  }
    70  
    71  func field_MyMutation_createTodo_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
    72  	args := map[string]interface{}{}
    73  	var arg0 TodoInput
    74  	if tmp, ok := rawArgs["todo"]; ok {
    75  		var err error
    76  		arg0, err = UnmarshalTodoInput(tmp)
    77  		if err != nil {
    78  			return nil, err
    79  		}
    80  	}
    81  	args["todo"] = arg0
    82  	return args, nil
    83  
    84  }
    85  
    86  func field_MyMutation_updateTodo_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
    87  	args := map[string]interface{}{}
    88  	var arg0 int
    89  	if tmp, ok := rawArgs["id"]; ok {
    90  		var err error
    91  		arg0, err = graphql.UnmarshalInt(tmp)
    92  		if err != nil {
    93  			return nil, err
    94  		}
    95  	}
    96  	args["id"] = arg0
    97  	var arg1 map[string]interface{}
    98  	if tmp, ok := rawArgs["changes"]; ok {
    99  		var err error
   100  		arg1 = tmp.(map[string]interface{})
   101  		if err != nil {
   102  			return nil, err
   103  		}
   104  	}
   105  	args["changes"] = arg1
   106  	return args, nil
   107  
   108  }
   109  
   110  func field_MyQuery_todo_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
   111  	args := map[string]interface{}{}
   112  	var arg0 int
   113  	if tmp, ok := rawArgs["id"]; ok {
   114  		var err error
   115  		arg0, err = graphql.UnmarshalInt(tmp)
   116  		if err != nil {
   117  			return nil, err
   118  		}
   119  	}
   120  	args["id"] = arg0
   121  	return args, nil
   122  
   123  }
   124  
   125  func field_MyQuery___type_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
   126  	args := map[string]interface{}{}
   127  	var arg0 string
   128  	if tmp, ok := rawArgs["name"]; ok {
   129  		var err error
   130  		arg0, err = graphql.UnmarshalString(tmp)
   131  		if err != nil {
   132  			return nil, err
   133  		}
   134  	}
   135  	args["name"] = arg0
   136  	return args, nil
   137  
   138  }
   139  
   140  func field___Type_fields_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
   141  	args := map[string]interface{}{}
   142  	var arg0 bool
   143  	if tmp, ok := rawArgs["includeDeprecated"]; ok {
   144  		var err error
   145  		arg0, err = graphql.UnmarshalBoolean(tmp)
   146  		if err != nil {
   147  			return nil, err
   148  		}
   149  	}
   150  	args["includeDeprecated"] = arg0
   151  	return args, nil
   152  
   153  }
   154  
   155  func field___Type_enumValues_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
   156  	args := map[string]interface{}{}
   157  	var arg0 bool
   158  	if tmp, ok := rawArgs["includeDeprecated"]; ok {
   159  		var err error
   160  		arg0, err = graphql.UnmarshalBoolean(tmp)
   161  		if err != nil {
   162  			return nil, err
   163  		}
   164  	}
   165  	args["includeDeprecated"] = arg0
   166  	return args, nil
   167  
   168  }
   169  
   170  func dir_hasRole_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
   171  	args := map[string]interface{}{}
   172  	var arg0 Role
   173  	if tmp, ok := rawArgs["role"]; ok {
   174  		var err error
   175  		err = (&arg0).UnmarshalGQL(tmp)
   176  		if err != nil {
   177  			return nil, err
   178  		}
   179  	}
   180  	args["role"] = arg0
   181  	return args, nil
   182  
   183  }
   184  
   185  type executableSchema struct {
   186  	resolvers  ResolverRoot
   187  	directives DirectiveRoot
   188  	complexity ComplexityRoot
   189  }
   190  
   191  func (e *executableSchema) Schema() *ast.Schema {
   192  	return parsedSchema
   193  }
   194  
   195  func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
   196  	switch typeName + "." + field {
   197  
   198  	case "MyMutation.createTodo":
   199  		if e.complexity.MyMutation.CreateTodo == nil {
   200  			break
   201  		}
   202  
   203  		args, err := field_MyMutation_createTodo_args(rawArgs)
   204  		if err != nil {
   205  			return 0, false
   206  		}
   207  
   208  		return e.complexity.MyMutation.CreateTodo(childComplexity, args["todo"].(TodoInput)), true
   209  
   210  	case "MyMutation.updateTodo":
   211  		if e.complexity.MyMutation.UpdateTodo == nil {
   212  			break
   213  		}
   214  
   215  		args, err := field_MyMutation_updateTodo_args(rawArgs)
   216  		if err != nil {
   217  			return 0, false
   218  		}
   219  
   220  		return e.complexity.MyMutation.UpdateTodo(childComplexity, args["id"].(int), args["changes"].(map[string]interface{})), true
   221  
   222  	case "MyQuery.todo":
   223  		if e.complexity.MyQuery.Todo == nil {
   224  			break
   225  		}
   226  
   227  		args, err := field_MyQuery_todo_args(rawArgs)
   228  		if err != nil {
   229  			return 0, false
   230  		}
   231  
   232  		return e.complexity.MyQuery.Todo(childComplexity, args["id"].(int)), true
   233  
   234  	case "MyQuery.lastTodo":
   235  		if e.complexity.MyQuery.LastTodo == nil {
   236  			break
   237  		}
   238  
   239  		return e.complexity.MyQuery.LastTodo(childComplexity), true
   240  
   241  	case "MyQuery.todos":
   242  		if e.complexity.MyQuery.Todos == nil {
   243  			break
   244  		}
   245  
   246  		return e.complexity.MyQuery.Todos(childComplexity), true
   247  
   248  	case "Todo.id":
   249  		if e.complexity.Todo.Id == nil {
   250  			break
   251  		}
   252  
   253  		return e.complexity.Todo.Id(childComplexity), true
   254  
   255  	case "Todo.text":
   256  		if e.complexity.Todo.Text == nil {
   257  			break
   258  		}
   259  
   260  		return e.complexity.Todo.Text(childComplexity), true
   261  
   262  	case "Todo.done":
   263  		if e.complexity.Todo.Done == nil {
   264  			break
   265  		}
   266  
   267  		return e.complexity.Todo.Done(childComplexity), true
   268  
   269  	}
   270  	return 0, false
   271  }
   272  
   273  func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
   274  	ec := executionContext{graphql.GetRequestContext(ctx), e}
   275  
   276  	buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
   277  		data := ec._MyQuery(ctx, op.SelectionSet)
   278  		var buf bytes.Buffer
   279  		data.MarshalGQL(&buf)
   280  		return buf.Bytes()
   281  	})
   282  
   283  	return &graphql.Response{
   284  		Data:       buf,
   285  		Errors:     ec.Errors,
   286  		Extensions: ec.Extensions}
   287  }
   288  
   289  func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
   290  	ec := executionContext{graphql.GetRequestContext(ctx), e}
   291  
   292  	buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
   293  		data := ec._MyMutation(ctx, op.SelectionSet)
   294  		var buf bytes.Buffer
   295  		data.MarshalGQL(&buf)
   296  		return buf.Bytes()
   297  	})
   298  
   299  	return &graphql.Response{
   300  		Data:       buf,
   301  		Errors:     ec.Errors,
   302  		Extensions: ec.Extensions,
   303  	}
   304  }
   305  
   306  func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {
   307  	return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported"))
   308  }
   309  
   310  type executionContext struct {
   311  	*graphql.RequestContext
   312  	*executableSchema
   313  }
   314  
   315  var myMutationImplementors = []string{"MyMutation"}
   316  
   317  // nolint: gocyclo, errcheck, gas, goconst
   318  func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
   319  	fields := graphql.CollectFields(ctx, sel, myMutationImplementors)
   320  
   321  	ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
   322  		Object: "MyMutation",
   323  	})
   324  
   325  	out := graphql.NewOrderedMap(len(fields))
   326  	invalid := false
   327  	for i, field := range fields {
   328  		out.Keys[i] = field.Alias
   329  
   330  		switch field.Name {
   331  		case "__typename":
   332  			out.Values[i] = graphql.MarshalString("MyMutation")
   333  		case "createTodo":
   334  			out.Values[i] = ec._MyMutation_createTodo(ctx, field)
   335  			if out.Values[i] == graphql.Null {
   336  				invalid = true
   337  			}
   338  		case "updateTodo":
   339  			out.Values[i] = ec._MyMutation_updateTodo(ctx, field)
   340  		default:
   341  			panic("unknown field " + strconv.Quote(field.Name))
   342  		}
   343  	}
   344  
   345  	if invalid {
   346  		return graphql.Null
   347  	}
   348  	return out
   349  }
   350  
   351  // nolint: vetshadow
   352  func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   353  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   354  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   355  	rawArgs := field.ArgumentMap(ec.Variables)
   356  	args, err := field_MyMutation_createTodo_args(rawArgs)
   357  	if err != nil {
   358  		ec.Error(ctx, err)
   359  		return graphql.Null
   360  	}
   361  	rctx := &graphql.ResolverContext{
   362  		Object: "MyMutation",
   363  		Args:   args,
   364  		Field:  field,
   365  	}
   366  	ctx = graphql.WithResolverContext(ctx, rctx)
   367  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   368  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   369  		ctx = rctx // use context from middleware stack in children
   370  		return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput))
   371  	})
   372  	if resTmp == nil {
   373  		if !ec.HasError(rctx) {
   374  			ec.Errorf(ctx, "must not be null")
   375  		}
   376  		return graphql.Null
   377  	}
   378  	res := resTmp.(Todo)
   379  	rctx.Result = res
   380  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   381  
   382  	return ec._Todo(ctx, field.Selections, &res)
   383  }
   384  
   385  // nolint: vetshadow
   386  func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   387  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   388  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   389  	rawArgs := field.ArgumentMap(ec.Variables)
   390  	args, err := field_MyMutation_updateTodo_args(rawArgs)
   391  	if err != nil {
   392  		ec.Error(ctx, err)
   393  		return graphql.Null
   394  	}
   395  	rctx := &graphql.ResolverContext{
   396  		Object: "MyMutation",
   397  		Args:   args,
   398  		Field:  field,
   399  	}
   400  	ctx = graphql.WithResolverContext(ctx, rctx)
   401  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   402  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   403  		ctx = rctx // use context from middleware stack in children
   404  		return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{}))
   405  	})
   406  	if resTmp == nil {
   407  		return graphql.Null
   408  	}
   409  	res := resTmp.(*Todo)
   410  	rctx.Result = res
   411  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   412  
   413  	if res == nil {
   414  		return graphql.Null
   415  	}
   416  
   417  	return ec._Todo(ctx, field.Selections, res)
   418  }
   419  
   420  var myQueryImplementors = []string{"MyQuery"}
   421  
   422  // nolint: gocyclo, errcheck, gas, goconst
   423  func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
   424  	fields := graphql.CollectFields(ctx, sel, myQueryImplementors)
   425  
   426  	ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
   427  		Object: "MyQuery",
   428  	})
   429  
   430  	var wg sync.WaitGroup
   431  	out := graphql.NewOrderedMap(len(fields))
   432  	invalid := false
   433  	for i, field := range fields {
   434  		out.Keys[i] = field.Alias
   435  
   436  		switch field.Name {
   437  		case "__typename":
   438  			out.Values[i] = graphql.MarshalString("MyQuery")
   439  		case "todo":
   440  			wg.Add(1)
   441  			go func(i int, field graphql.CollectedField) {
   442  				out.Values[i] = ec._MyQuery_todo(ctx, field)
   443  				wg.Done()
   444  			}(i, field)
   445  		case "lastTodo":
   446  			wg.Add(1)
   447  			go func(i int, field graphql.CollectedField) {
   448  				out.Values[i] = ec._MyQuery_lastTodo(ctx, field)
   449  				wg.Done()
   450  			}(i, field)
   451  		case "todos":
   452  			wg.Add(1)
   453  			go func(i int, field graphql.CollectedField) {
   454  				out.Values[i] = ec._MyQuery_todos(ctx, field)
   455  				if out.Values[i] == graphql.Null {
   456  					invalid = true
   457  				}
   458  				wg.Done()
   459  			}(i, field)
   460  		case "__type":
   461  			out.Values[i] = ec._MyQuery___type(ctx, field)
   462  		case "__schema":
   463  			out.Values[i] = ec._MyQuery___schema(ctx, field)
   464  		default:
   465  			panic("unknown field " + strconv.Quote(field.Name))
   466  		}
   467  	}
   468  	wg.Wait()
   469  	if invalid {
   470  		return graphql.Null
   471  	}
   472  	return out
   473  }
   474  
   475  // nolint: vetshadow
   476  func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   477  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   478  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   479  	rawArgs := field.ArgumentMap(ec.Variables)
   480  	args, err := field_MyQuery_todo_args(rawArgs)
   481  	if err != nil {
   482  		ec.Error(ctx, err)
   483  		return graphql.Null
   484  	}
   485  	rctx := &graphql.ResolverContext{
   486  		Object: "MyQuery",
   487  		Args:   args,
   488  		Field:  field,
   489  	}
   490  	ctx = graphql.WithResolverContext(ctx, rctx)
   491  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   492  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   493  		ctx = rctx // use context from middleware stack in children
   494  		return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int))
   495  	})
   496  	if resTmp == nil {
   497  		return graphql.Null
   498  	}
   499  	res := resTmp.(*Todo)
   500  	rctx.Result = res
   501  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   502  
   503  	if res == nil {
   504  		return graphql.Null
   505  	}
   506  
   507  	return ec._Todo(ctx, field.Selections, res)
   508  }
   509  
   510  // nolint: vetshadow
   511  func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   512  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   513  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   514  	rctx := &graphql.ResolverContext{
   515  		Object: "MyQuery",
   516  		Args:   nil,
   517  		Field:  field,
   518  	}
   519  	ctx = graphql.WithResolverContext(ctx, rctx)
   520  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   521  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   522  		ctx = rctx // use context from middleware stack in children
   523  		return ec.resolvers.MyQuery().LastTodo(rctx)
   524  	})
   525  	if resTmp == nil {
   526  		return graphql.Null
   527  	}
   528  	res := resTmp.(*Todo)
   529  	rctx.Result = res
   530  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   531  
   532  	if res == nil {
   533  		return graphql.Null
   534  	}
   535  
   536  	return ec._Todo(ctx, field.Selections, res)
   537  }
   538  
   539  // nolint: vetshadow
   540  func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   541  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   542  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   543  	rctx := &graphql.ResolverContext{
   544  		Object: "MyQuery",
   545  		Args:   nil,
   546  		Field:  field,
   547  	}
   548  	ctx = graphql.WithResolverContext(ctx, rctx)
   549  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   550  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   551  		ctx = rctx // use context from middleware stack in children
   552  		return ec.resolvers.MyQuery().Todos(rctx)
   553  	})
   554  	if resTmp == nil {
   555  		if !ec.HasError(rctx) {
   556  			ec.Errorf(ctx, "must not be null")
   557  		}
   558  		return graphql.Null
   559  	}
   560  	res := resTmp.([]Todo)
   561  	rctx.Result = res
   562  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   563  
   564  	arr1 := make(graphql.Array, len(res))
   565  	var wg sync.WaitGroup
   566  
   567  	isLen1 := len(res) == 1
   568  	if !isLen1 {
   569  		wg.Add(len(res))
   570  	}
   571  
   572  	for idx1 := range res {
   573  		idx1 := idx1
   574  		rctx := &graphql.ResolverContext{
   575  			Index:  &idx1,
   576  			Result: &res[idx1],
   577  		}
   578  		ctx := graphql.WithResolverContext(ctx, rctx)
   579  		f := func(idx1 int) {
   580  			if !isLen1 {
   581  				defer wg.Done()
   582  			}
   583  			arr1[idx1] = func() graphql.Marshaler {
   584  
   585  				return ec._Todo(ctx, field.Selections, &res[idx1])
   586  			}()
   587  		}
   588  		if isLen1 {
   589  			f(idx1)
   590  		} else {
   591  			go f(idx1)
   592  		}
   593  
   594  	}
   595  	wg.Wait()
   596  	return arr1
   597  }
   598  
   599  // nolint: vetshadow
   600  func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   601  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   602  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   603  	rawArgs := field.ArgumentMap(ec.Variables)
   604  	args, err := field_MyQuery___type_args(rawArgs)
   605  	if err != nil {
   606  		ec.Error(ctx, err)
   607  		return graphql.Null
   608  	}
   609  	rctx := &graphql.ResolverContext{
   610  		Object: "MyQuery",
   611  		Args:   args,
   612  		Field:  field,
   613  	}
   614  	ctx = graphql.WithResolverContext(ctx, rctx)
   615  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   616  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   617  		ctx = rctx // use context from middleware stack in children
   618  		return ec.introspectType(args["name"].(string))
   619  	})
   620  	if resTmp == nil {
   621  		return graphql.Null
   622  	}
   623  	res := resTmp.(*introspection.Type)
   624  	rctx.Result = res
   625  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   626  
   627  	if res == nil {
   628  		return graphql.Null
   629  	}
   630  
   631  	return ec.___Type(ctx, field.Selections, res)
   632  }
   633  
   634  // nolint: vetshadow
   635  func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler {
   636  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   637  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   638  	rctx := &graphql.ResolverContext{
   639  		Object: "MyQuery",
   640  		Args:   nil,
   641  		Field:  field,
   642  	}
   643  	ctx = graphql.WithResolverContext(ctx, rctx)
   644  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   645  	resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) {
   646  		ctx = rctx // use context from middleware stack in children
   647  		return ec.introspectSchema()
   648  	})
   649  	if resTmp == nil {
   650  		return graphql.Null
   651  	}
   652  	res := resTmp.(*introspection.Schema)
   653  	rctx.Result = res
   654  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   655  
   656  	if res == nil {
   657  		return graphql.Null
   658  	}
   659  
   660  	return ec.___Schema(ctx, field.Selections, res)
   661  }
   662  
   663  var todoImplementors = []string{"Todo"}
   664  
   665  // nolint: gocyclo, errcheck, gas, goconst
   666  func (ec *executionContext) _Todo(ctx context.Context, sel ast.SelectionSet, obj *Todo) graphql.Marshaler {
   667  	fields := graphql.CollectFields(ctx, sel, todoImplementors)
   668  
   669  	out := graphql.NewOrderedMap(len(fields))
   670  	invalid := false
   671  	for i, field := range fields {
   672  		out.Keys[i] = field.Alias
   673  
   674  		switch field.Name {
   675  		case "__typename":
   676  			out.Values[i] = graphql.MarshalString("Todo")
   677  		case "id":
   678  			out.Values[i] = ec._Todo_id(ctx, field, obj)
   679  			if out.Values[i] == graphql.Null {
   680  				invalid = true
   681  			}
   682  		case "text":
   683  			out.Values[i] = ec._Todo_text(ctx, field, obj)
   684  			if out.Values[i] == graphql.Null {
   685  				invalid = true
   686  			}
   687  		case "done":
   688  			out.Values[i] = ec._Todo_done(ctx, field, obj)
   689  			if out.Values[i] == graphql.Null {
   690  				invalid = true
   691  			}
   692  		default:
   693  			panic("unknown field " + strconv.Quote(field.Name))
   694  		}
   695  	}
   696  
   697  	if invalid {
   698  		return graphql.Null
   699  	}
   700  	return out
   701  }
   702  
   703  // nolint: vetshadow
   704  func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler {
   705  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   706  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   707  	rctx := &graphql.ResolverContext{
   708  		Object: "Todo",
   709  		Args:   nil,
   710  		Field:  field,
   711  	}
   712  	ctx = graphql.WithResolverContext(ctx, rctx)
   713  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   714  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   715  		ctx = rctx // use context from middleware stack in children
   716  		return obj.ID, nil
   717  	})
   718  	if resTmp == nil {
   719  		if !ec.HasError(rctx) {
   720  			ec.Errorf(ctx, "must not be null")
   721  		}
   722  		return graphql.Null
   723  	}
   724  	res := resTmp.(int)
   725  	rctx.Result = res
   726  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   727  	return graphql.MarshalInt(res)
   728  }
   729  
   730  // nolint: vetshadow
   731  func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler {
   732  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   733  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   734  	rctx := &graphql.ResolverContext{
   735  		Object: "Todo",
   736  		Args:   nil,
   737  		Field:  field,
   738  	}
   739  	ctx = graphql.WithResolverContext(ctx, rctx)
   740  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   741  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   742  		ctx = rctx // use context from middleware stack in children
   743  		return obj.Text, nil
   744  	})
   745  	if resTmp == nil {
   746  		if !ec.HasError(rctx) {
   747  			ec.Errorf(ctx, "must not be null")
   748  		}
   749  		return graphql.Null
   750  	}
   751  	res := resTmp.(string)
   752  	rctx.Result = res
   753  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   754  	return graphql.MarshalString(res)
   755  }
   756  
   757  // nolint: vetshadow
   758  func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler {
   759  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   760  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   761  	rctx := &graphql.ResolverContext{
   762  		Object: "Todo",
   763  		Args:   nil,
   764  		Field:  field,
   765  	}
   766  	ctx = graphql.WithResolverContext(ctx, rctx)
   767  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   768  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   769  		ctx = rctx // use context from middleware stack in children
   770  		return obj.Done, nil
   771  	})
   772  	if resTmp == nil {
   773  		if !ec.HasError(rctx) {
   774  			ec.Errorf(ctx, "must not be null")
   775  		}
   776  		return graphql.Null
   777  	}
   778  	res := resTmp.(bool)
   779  	rctx.Result = res
   780  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   781  	return graphql.MarshalBoolean(res)
   782  }
   783  
   784  var __DirectiveImplementors = []string{"__Directive"}
   785  
   786  // nolint: gocyclo, errcheck, gas, goconst
   787  func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler {
   788  	fields := graphql.CollectFields(ctx, sel, __DirectiveImplementors)
   789  
   790  	out := graphql.NewOrderedMap(len(fields))
   791  	invalid := false
   792  	for i, field := range fields {
   793  		out.Keys[i] = field.Alias
   794  
   795  		switch field.Name {
   796  		case "__typename":
   797  			out.Values[i] = graphql.MarshalString("__Directive")
   798  		case "name":
   799  			out.Values[i] = ec.___Directive_name(ctx, field, obj)
   800  			if out.Values[i] == graphql.Null {
   801  				invalid = true
   802  			}
   803  		case "description":
   804  			out.Values[i] = ec.___Directive_description(ctx, field, obj)
   805  		case "locations":
   806  			out.Values[i] = ec.___Directive_locations(ctx, field, obj)
   807  			if out.Values[i] == graphql.Null {
   808  				invalid = true
   809  			}
   810  		case "args":
   811  			out.Values[i] = ec.___Directive_args(ctx, field, obj)
   812  			if out.Values[i] == graphql.Null {
   813  				invalid = true
   814  			}
   815  		default:
   816  			panic("unknown field " + strconv.Quote(field.Name))
   817  		}
   818  	}
   819  
   820  	if invalid {
   821  		return graphql.Null
   822  	}
   823  	return out
   824  }
   825  
   826  // nolint: vetshadow
   827  func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler {
   828  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   829  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   830  	rctx := &graphql.ResolverContext{
   831  		Object: "__Directive",
   832  		Args:   nil,
   833  		Field:  field,
   834  	}
   835  	ctx = graphql.WithResolverContext(ctx, rctx)
   836  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   837  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   838  		ctx = rctx // use context from middleware stack in children
   839  		return obj.Name, nil
   840  	})
   841  	if resTmp == nil {
   842  		if !ec.HasError(rctx) {
   843  			ec.Errorf(ctx, "must not be null")
   844  		}
   845  		return graphql.Null
   846  	}
   847  	res := resTmp.(string)
   848  	rctx.Result = res
   849  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   850  	return graphql.MarshalString(res)
   851  }
   852  
   853  // nolint: vetshadow
   854  func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler {
   855  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   856  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   857  	rctx := &graphql.ResolverContext{
   858  		Object: "__Directive",
   859  		Args:   nil,
   860  		Field:  field,
   861  	}
   862  	ctx = graphql.WithResolverContext(ctx, rctx)
   863  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   864  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   865  		ctx = rctx // use context from middleware stack in children
   866  		return obj.Description, nil
   867  	})
   868  	if resTmp == nil {
   869  		return graphql.Null
   870  	}
   871  	res := resTmp.(string)
   872  	rctx.Result = res
   873  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   874  	return graphql.MarshalString(res)
   875  }
   876  
   877  // nolint: vetshadow
   878  func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler {
   879  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   880  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   881  	rctx := &graphql.ResolverContext{
   882  		Object: "__Directive",
   883  		Args:   nil,
   884  		Field:  field,
   885  	}
   886  	ctx = graphql.WithResolverContext(ctx, rctx)
   887  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   888  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   889  		ctx = rctx // use context from middleware stack in children
   890  		return obj.Locations, nil
   891  	})
   892  	if resTmp == nil {
   893  		if !ec.HasError(rctx) {
   894  			ec.Errorf(ctx, "must not be null")
   895  		}
   896  		return graphql.Null
   897  	}
   898  	res := resTmp.([]string)
   899  	rctx.Result = res
   900  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   901  
   902  	arr1 := make(graphql.Array, len(res))
   903  
   904  	for idx1 := range res {
   905  		arr1[idx1] = func() graphql.Marshaler {
   906  			return graphql.MarshalString(res[idx1])
   907  		}()
   908  	}
   909  
   910  	return arr1
   911  }
   912  
   913  // nolint: vetshadow
   914  func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler {
   915  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
   916  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
   917  	rctx := &graphql.ResolverContext{
   918  		Object: "__Directive",
   919  		Args:   nil,
   920  		Field:  field,
   921  	}
   922  	ctx = graphql.WithResolverContext(ctx, rctx)
   923  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
   924  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   925  		ctx = rctx // use context from middleware stack in children
   926  		return obj.Args, nil
   927  	})
   928  	if resTmp == nil {
   929  		if !ec.HasError(rctx) {
   930  			ec.Errorf(ctx, "must not be null")
   931  		}
   932  		return graphql.Null
   933  	}
   934  	res := resTmp.([]introspection.InputValue)
   935  	rctx.Result = res
   936  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
   937  
   938  	arr1 := make(graphql.Array, len(res))
   939  	var wg sync.WaitGroup
   940  
   941  	isLen1 := len(res) == 1
   942  	if !isLen1 {
   943  		wg.Add(len(res))
   944  	}
   945  
   946  	for idx1 := range res {
   947  		idx1 := idx1
   948  		rctx := &graphql.ResolverContext{
   949  			Index:  &idx1,
   950  			Result: &res[idx1],
   951  		}
   952  		ctx := graphql.WithResolverContext(ctx, rctx)
   953  		f := func(idx1 int) {
   954  			if !isLen1 {
   955  				defer wg.Done()
   956  			}
   957  			arr1[idx1] = func() graphql.Marshaler {
   958  
   959  				return ec.___InputValue(ctx, field.Selections, &res[idx1])
   960  			}()
   961  		}
   962  		if isLen1 {
   963  			f(idx1)
   964  		} else {
   965  			go f(idx1)
   966  		}
   967  
   968  	}
   969  	wg.Wait()
   970  	return arr1
   971  }
   972  
   973  var __EnumValueImplementors = []string{"__EnumValue"}
   974  
   975  // nolint: gocyclo, errcheck, gas, goconst
   976  func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {
   977  	fields := graphql.CollectFields(ctx, sel, __EnumValueImplementors)
   978  
   979  	out := graphql.NewOrderedMap(len(fields))
   980  	invalid := false
   981  	for i, field := range fields {
   982  		out.Keys[i] = field.Alias
   983  
   984  		switch field.Name {
   985  		case "__typename":
   986  			out.Values[i] = graphql.MarshalString("__EnumValue")
   987  		case "name":
   988  			out.Values[i] = ec.___EnumValue_name(ctx, field, obj)
   989  			if out.Values[i] == graphql.Null {
   990  				invalid = true
   991  			}
   992  		case "description":
   993  			out.Values[i] = ec.___EnumValue_description(ctx, field, obj)
   994  		case "isDeprecated":
   995  			out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)
   996  			if out.Values[i] == graphql.Null {
   997  				invalid = true
   998  			}
   999  		case "deprecationReason":
  1000  			out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)
  1001  		default:
  1002  			panic("unknown field " + strconv.Quote(field.Name))
  1003  		}
  1004  	}
  1005  
  1006  	if invalid {
  1007  		return graphql.Null
  1008  	}
  1009  	return out
  1010  }
  1011  
  1012  // nolint: vetshadow
  1013  func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler {
  1014  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1015  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1016  	rctx := &graphql.ResolverContext{
  1017  		Object: "__EnumValue",
  1018  		Args:   nil,
  1019  		Field:  field,
  1020  	}
  1021  	ctx = graphql.WithResolverContext(ctx, rctx)
  1022  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1023  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1024  		ctx = rctx // use context from middleware stack in children
  1025  		return obj.Name, nil
  1026  	})
  1027  	if resTmp == nil {
  1028  		if !ec.HasError(rctx) {
  1029  			ec.Errorf(ctx, "must not be null")
  1030  		}
  1031  		return graphql.Null
  1032  	}
  1033  	res := resTmp.(string)
  1034  	rctx.Result = res
  1035  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1036  	return graphql.MarshalString(res)
  1037  }
  1038  
  1039  // nolint: vetshadow
  1040  func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler {
  1041  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1042  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1043  	rctx := &graphql.ResolverContext{
  1044  		Object: "__EnumValue",
  1045  		Args:   nil,
  1046  		Field:  field,
  1047  	}
  1048  	ctx = graphql.WithResolverContext(ctx, rctx)
  1049  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1050  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1051  		ctx = rctx // use context from middleware stack in children
  1052  		return obj.Description, nil
  1053  	})
  1054  	if resTmp == nil {
  1055  		return graphql.Null
  1056  	}
  1057  	res := resTmp.(string)
  1058  	rctx.Result = res
  1059  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1060  	return graphql.MarshalString(res)
  1061  }
  1062  
  1063  // nolint: vetshadow
  1064  func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler {
  1065  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1066  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1067  	rctx := &graphql.ResolverContext{
  1068  		Object: "__EnumValue",
  1069  		Args:   nil,
  1070  		Field:  field,
  1071  	}
  1072  	ctx = graphql.WithResolverContext(ctx, rctx)
  1073  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1074  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1075  		ctx = rctx // use context from middleware stack in children
  1076  		return obj.IsDeprecated(), nil
  1077  	})
  1078  	if resTmp == nil {
  1079  		if !ec.HasError(rctx) {
  1080  			ec.Errorf(ctx, "must not be null")
  1081  		}
  1082  		return graphql.Null
  1083  	}
  1084  	res := resTmp.(bool)
  1085  	rctx.Result = res
  1086  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1087  	return graphql.MarshalBoolean(res)
  1088  }
  1089  
  1090  // nolint: vetshadow
  1091  func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler {
  1092  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1093  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1094  	rctx := &graphql.ResolverContext{
  1095  		Object: "__EnumValue",
  1096  		Args:   nil,
  1097  		Field:  field,
  1098  	}
  1099  	ctx = graphql.WithResolverContext(ctx, rctx)
  1100  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1101  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1102  		ctx = rctx // use context from middleware stack in children
  1103  		return obj.DeprecationReason(), nil
  1104  	})
  1105  	if resTmp == nil {
  1106  		return graphql.Null
  1107  	}
  1108  	res := resTmp.(*string)
  1109  	rctx.Result = res
  1110  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1111  
  1112  	if res == nil {
  1113  		return graphql.Null
  1114  	}
  1115  	return graphql.MarshalString(*res)
  1116  }
  1117  
  1118  var __FieldImplementors = []string{"__Field"}
  1119  
  1120  // nolint: gocyclo, errcheck, gas, goconst
  1121  func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler {
  1122  	fields := graphql.CollectFields(ctx, sel, __FieldImplementors)
  1123  
  1124  	out := graphql.NewOrderedMap(len(fields))
  1125  	invalid := false
  1126  	for i, field := range fields {
  1127  		out.Keys[i] = field.Alias
  1128  
  1129  		switch field.Name {
  1130  		case "__typename":
  1131  			out.Values[i] = graphql.MarshalString("__Field")
  1132  		case "name":
  1133  			out.Values[i] = ec.___Field_name(ctx, field, obj)
  1134  			if out.Values[i] == graphql.Null {
  1135  				invalid = true
  1136  			}
  1137  		case "description":
  1138  			out.Values[i] = ec.___Field_description(ctx, field, obj)
  1139  		case "args":
  1140  			out.Values[i] = ec.___Field_args(ctx, field, obj)
  1141  			if out.Values[i] == graphql.Null {
  1142  				invalid = true
  1143  			}
  1144  		case "type":
  1145  			out.Values[i] = ec.___Field_type(ctx, field, obj)
  1146  			if out.Values[i] == graphql.Null {
  1147  				invalid = true
  1148  			}
  1149  		case "isDeprecated":
  1150  			out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj)
  1151  			if out.Values[i] == graphql.Null {
  1152  				invalid = true
  1153  			}
  1154  		case "deprecationReason":
  1155  			out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj)
  1156  		default:
  1157  			panic("unknown field " + strconv.Quote(field.Name))
  1158  		}
  1159  	}
  1160  
  1161  	if invalid {
  1162  		return graphql.Null
  1163  	}
  1164  	return out
  1165  }
  1166  
  1167  // nolint: vetshadow
  1168  func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler {
  1169  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1170  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1171  	rctx := &graphql.ResolverContext{
  1172  		Object: "__Field",
  1173  		Args:   nil,
  1174  		Field:  field,
  1175  	}
  1176  	ctx = graphql.WithResolverContext(ctx, rctx)
  1177  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1178  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1179  		ctx = rctx // use context from middleware stack in children
  1180  		return obj.Name, nil
  1181  	})
  1182  	if resTmp == nil {
  1183  		if !ec.HasError(rctx) {
  1184  			ec.Errorf(ctx, "must not be null")
  1185  		}
  1186  		return graphql.Null
  1187  	}
  1188  	res := resTmp.(string)
  1189  	rctx.Result = res
  1190  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1191  	return graphql.MarshalString(res)
  1192  }
  1193  
  1194  // nolint: vetshadow
  1195  func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler {
  1196  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1197  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1198  	rctx := &graphql.ResolverContext{
  1199  		Object: "__Field",
  1200  		Args:   nil,
  1201  		Field:  field,
  1202  	}
  1203  	ctx = graphql.WithResolverContext(ctx, rctx)
  1204  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1205  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1206  		ctx = rctx // use context from middleware stack in children
  1207  		return obj.Description, nil
  1208  	})
  1209  	if resTmp == nil {
  1210  		return graphql.Null
  1211  	}
  1212  	res := resTmp.(string)
  1213  	rctx.Result = res
  1214  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1215  	return graphql.MarshalString(res)
  1216  }
  1217  
  1218  // nolint: vetshadow
  1219  func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler {
  1220  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1221  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1222  	rctx := &graphql.ResolverContext{
  1223  		Object: "__Field",
  1224  		Args:   nil,
  1225  		Field:  field,
  1226  	}
  1227  	ctx = graphql.WithResolverContext(ctx, rctx)
  1228  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1229  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1230  		ctx = rctx // use context from middleware stack in children
  1231  		return obj.Args, nil
  1232  	})
  1233  	if resTmp == nil {
  1234  		if !ec.HasError(rctx) {
  1235  			ec.Errorf(ctx, "must not be null")
  1236  		}
  1237  		return graphql.Null
  1238  	}
  1239  	res := resTmp.([]introspection.InputValue)
  1240  	rctx.Result = res
  1241  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1242  
  1243  	arr1 := make(graphql.Array, len(res))
  1244  	var wg sync.WaitGroup
  1245  
  1246  	isLen1 := len(res) == 1
  1247  	if !isLen1 {
  1248  		wg.Add(len(res))
  1249  	}
  1250  
  1251  	for idx1 := range res {
  1252  		idx1 := idx1
  1253  		rctx := &graphql.ResolverContext{
  1254  			Index:  &idx1,
  1255  			Result: &res[idx1],
  1256  		}
  1257  		ctx := graphql.WithResolverContext(ctx, rctx)
  1258  		f := func(idx1 int) {
  1259  			if !isLen1 {
  1260  				defer wg.Done()
  1261  			}
  1262  			arr1[idx1] = func() graphql.Marshaler {
  1263  
  1264  				return ec.___InputValue(ctx, field.Selections, &res[idx1])
  1265  			}()
  1266  		}
  1267  		if isLen1 {
  1268  			f(idx1)
  1269  		} else {
  1270  			go f(idx1)
  1271  		}
  1272  
  1273  	}
  1274  	wg.Wait()
  1275  	return arr1
  1276  }
  1277  
  1278  // nolint: vetshadow
  1279  func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler {
  1280  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1281  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1282  	rctx := &graphql.ResolverContext{
  1283  		Object: "__Field",
  1284  		Args:   nil,
  1285  		Field:  field,
  1286  	}
  1287  	ctx = graphql.WithResolverContext(ctx, rctx)
  1288  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1289  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1290  		ctx = rctx // use context from middleware stack in children
  1291  		return obj.Type, nil
  1292  	})
  1293  	if resTmp == nil {
  1294  		if !ec.HasError(rctx) {
  1295  			ec.Errorf(ctx, "must not be null")
  1296  		}
  1297  		return graphql.Null
  1298  	}
  1299  	res := resTmp.(*introspection.Type)
  1300  	rctx.Result = res
  1301  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1302  
  1303  	if res == nil {
  1304  		if !ec.HasError(rctx) {
  1305  			ec.Errorf(ctx, "must not be null")
  1306  		}
  1307  		return graphql.Null
  1308  	}
  1309  
  1310  	return ec.___Type(ctx, field.Selections, res)
  1311  }
  1312  
  1313  // nolint: vetshadow
  1314  func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler {
  1315  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1316  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1317  	rctx := &graphql.ResolverContext{
  1318  		Object: "__Field",
  1319  		Args:   nil,
  1320  		Field:  field,
  1321  	}
  1322  	ctx = graphql.WithResolverContext(ctx, rctx)
  1323  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1324  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1325  		ctx = rctx // use context from middleware stack in children
  1326  		return obj.IsDeprecated(), nil
  1327  	})
  1328  	if resTmp == nil {
  1329  		if !ec.HasError(rctx) {
  1330  			ec.Errorf(ctx, "must not be null")
  1331  		}
  1332  		return graphql.Null
  1333  	}
  1334  	res := resTmp.(bool)
  1335  	rctx.Result = res
  1336  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1337  	return graphql.MarshalBoolean(res)
  1338  }
  1339  
  1340  // nolint: vetshadow
  1341  func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler {
  1342  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1343  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1344  	rctx := &graphql.ResolverContext{
  1345  		Object: "__Field",
  1346  		Args:   nil,
  1347  		Field:  field,
  1348  	}
  1349  	ctx = graphql.WithResolverContext(ctx, rctx)
  1350  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1351  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1352  		ctx = rctx // use context from middleware stack in children
  1353  		return obj.DeprecationReason(), nil
  1354  	})
  1355  	if resTmp == nil {
  1356  		return graphql.Null
  1357  	}
  1358  	res := resTmp.(*string)
  1359  	rctx.Result = res
  1360  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1361  
  1362  	if res == nil {
  1363  		return graphql.Null
  1364  	}
  1365  	return graphql.MarshalString(*res)
  1366  }
  1367  
  1368  var __InputValueImplementors = []string{"__InputValue"}
  1369  
  1370  // nolint: gocyclo, errcheck, gas, goconst
  1371  func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler {
  1372  	fields := graphql.CollectFields(ctx, sel, __InputValueImplementors)
  1373  
  1374  	out := graphql.NewOrderedMap(len(fields))
  1375  	invalid := false
  1376  	for i, field := range fields {
  1377  		out.Keys[i] = field.Alias
  1378  
  1379  		switch field.Name {
  1380  		case "__typename":
  1381  			out.Values[i] = graphql.MarshalString("__InputValue")
  1382  		case "name":
  1383  			out.Values[i] = ec.___InputValue_name(ctx, field, obj)
  1384  			if out.Values[i] == graphql.Null {
  1385  				invalid = true
  1386  			}
  1387  		case "description":
  1388  			out.Values[i] = ec.___InputValue_description(ctx, field, obj)
  1389  		case "type":
  1390  			out.Values[i] = ec.___InputValue_type(ctx, field, obj)
  1391  			if out.Values[i] == graphql.Null {
  1392  				invalid = true
  1393  			}
  1394  		case "defaultValue":
  1395  			out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj)
  1396  		default:
  1397  			panic("unknown field " + strconv.Quote(field.Name))
  1398  		}
  1399  	}
  1400  
  1401  	if invalid {
  1402  		return graphql.Null
  1403  	}
  1404  	return out
  1405  }
  1406  
  1407  // nolint: vetshadow
  1408  func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler {
  1409  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1410  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1411  	rctx := &graphql.ResolverContext{
  1412  		Object: "__InputValue",
  1413  		Args:   nil,
  1414  		Field:  field,
  1415  	}
  1416  	ctx = graphql.WithResolverContext(ctx, rctx)
  1417  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1418  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1419  		ctx = rctx // use context from middleware stack in children
  1420  		return obj.Name, nil
  1421  	})
  1422  	if resTmp == nil {
  1423  		if !ec.HasError(rctx) {
  1424  			ec.Errorf(ctx, "must not be null")
  1425  		}
  1426  		return graphql.Null
  1427  	}
  1428  	res := resTmp.(string)
  1429  	rctx.Result = res
  1430  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1431  	return graphql.MarshalString(res)
  1432  }
  1433  
  1434  // nolint: vetshadow
  1435  func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler {
  1436  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1437  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1438  	rctx := &graphql.ResolverContext{
  1439  		Object: "__InputValue",
  1440  		Args:   nil,
  1441  		Field:  field,
  1442  	}
  1443  	ctx = graphql.WithResolverContext(ctx, rctx)
  1444  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1445  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1446  		ctx = rctx // use context from middleware stack in children
  1447  		return obj.Description, nil
  1448  	})
  1449  	if resTmp == nil {
  1450  		return graphql.Null
  1451  	}
  1452  	res := resTmp.(string)
  1453  	rctx.Result = res
  1454  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1455  	return graphql.MarshalString(res)
  1456  }
  1457  
  1458  // nolint: vetshadow
  1459  func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler {
  1460  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1461  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1462  	rctx := &graphql.ResolverContext{
  1463  		Object: "__InputValue",
  1464  		Args:   nil,
  1465  		Field:  field,
  1466  	}
  1467  	ctx = graphql.WithResolverContext(ctx, rctx)
  1468  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1469  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1470  		ctx = rctx // use context from middleware stack in children
  1471  		return obj.Type, nil
  1472  	})
  1473  	if resTmp == nil {
  1474  		if !ec.HasError(rctx) {
  1475  			ec.Errorf(ctx, "must not be null")
  1476  		}
  1477  		return graphql.Null
  1478  	}
  1479  	res := resTmp.(*introspection.Type)
  1480  	rctx.Result = res
  1481  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1482  
  1483  	if res == nil {
  1484  		if !ec.HasError(rctx) {
  1485  			ec.Errorf(ctx, "must not be null")
  1486  		}
  1487  		return graphql.Null
  1488  	}
  1489  
  1490  	return ec.___Type(ctx, field.Selections, res)
  1491  }
  1492  
  1493  // nolint: vetshadow
  1494  func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler {
  1495  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1496  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1497  	rctx := &graphql.ResolverContext{
  1498  		Object: "__InputValue",
  1499  		Args:   nil,
  1500  		Field:  field,
  1501  	}
  1502  	ctx = graphql.WithResolverContext(ctx, rctx)
  1503  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1504  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1505  		ctx = rctx // use context from middleware stack in children
  1506  		return obj.DefaultValue, nil
  1507  	})
  1508  	if resTmp == nil {
  1509  		return graphql.Null
  1510  	}
  1511  	res := resTmp.(*string)
  1512  	rctx.Result = res
  1513  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1514  
  1515  	if res == nil {
  1516  		return graphql.Null
  1517  	}
  1518  	return graphql.MarshalString(*res)
  1519  }
  1520  
  1521  var __SchemaImplementors = []string{"__Schema"}
  1522  
  1523  // nolint: gocyclo, errcheck, gas, goconst
  1524  func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {
  1525  	fields := graphql.CollectFields(ctx, sel, __SchemaImplementors)
  1526  
  1527  	out := graphql.NewOrderedMap(len(fields))
  1528  	invalid := false
  1529  	for i, field := range fields {
  1530  		out.Keys[i] = field.Alias
  1531  
  1532  		switch field.Name {
  1533  		case "__typename":
  1534  			out.Values[i] = graphql.MarshalString("__Schema")
  1535  		case "types":
  1536  			out.Values[i] = ec.___Schema_types(ctx, field, obj)
  1537  			if out.Values[i] == graphql.Null {
  1538  				invalid = true
  1539  			}
  1540  		case "queryType":
  1541  			out.Values[i] = ec.___Schema_queryType(ctx, field, obj)
  1542  			if out.Values[i] == graphql.Null {
  1543  				invalid = true
  1544  			}
  1545  		case "mutationType":
  1546  			out.Values[i] = ec.___Schema_mutationType(ctx, field, obj)
  1547  		case "subscriptionType":
  1548  			out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)
  1549  		case "directives":
  1550  			out.Values[i] = ec.___Schema_directives(ctx, field, obj)
  1551  			if out.Values[i] == graphql.Null {
  1552  				invalid = true
  1553  			}
  1554  		default:
  1555  			panic("unknown field " + strconv.Quote(field.Name))
  1556  		}
  1557  	}
  1558  
  1559  	if invalid {
  1560  		return graphql.Null
  1561  	}
  1562  	return out
  1563  }
  1564  
  1565  // nolint: vetshadow
  1566  func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler {
  1567  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1568  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1569  	rctx := &graphql.ResolverContext{
  1570  		Object: "__Schema",
  1571  		Args:   nil,
  1572  		Field:  field,
  1573  	}
  1574  	ctx = graphql.WithResolverContext(ctx, rctx)
  1575  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1576  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1577  		ctx = rctx // use context from middleware stack in children
  1578  		return obj.Types(), nil
  1579  	})
  1580  	if resTmp == nil {
  1581  		if !ec.HasError(rctx) {
  1582  			ec.Errorf(ctx, "must not be null")
  1583  		}
  1584  		return graphql.Null
  1585  	}
  1586  	res := resTmp.([]introspection.Type)
  1587  	rctx.Result = res
  1588  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1589  
  1590  	arr1 := make(graphql.Array, len(res))
  1591  	var wg sync.WaitGroup
  1592  
  1593  	isLen1 := len(res) == 1
  1594  	if !isLen1 {
  1595  		wg.Add(len(res))
  1596  	}
  1597  
  1598  	for idx1 := range res {
  1599  		idx1 := idx1
  1600  		rctx := &graphql.ResolverContext{
  1601  			Index:  &idx1,
  1602  			Result: &res[idx1],
  1603  		}
  1604  		ctx := graphql.WithResolverContext(ctx, rctx)
  1605  		f := func(idx1 int) {
  1606  			if !isLen1 {
  1607  				defer wg.Done()
  1608  			}
  1609  			arr1[idx1] = func() graphql.Marshaler {
  1610  
  1611  				return ec.___Type(ctx, field.Selections, &res[idx1])
  1612  			}()
  1613  		}
  1614  		if isLen1 {
  1615  			f(idx1)
  1616  		} else {
  1617  			go f(idx1)
  1618  		}
  1619  
  1620  	}
  1621  	wg.Wait()
  1622  	return arr1
  1623  }
  1624  
  1625  // nolint: vetshadow
  1626  func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler {
  1627  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1628  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1629  	rctx := &graphql.ResolverContext{
  1630  		Object: "__Schema",
  1631  		Args:   nil,
  1632  		Field:  field,
  1633  	}
  1634  	ctx = graphql.WithResolverContext(ctx, rctx)
  1635  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1636  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1637  		ctx = rctx // use context from middleware stack in children
  1638  		return obj.QueryType(), nil
  1639  	})
  1640  	if resTmp == nil {
  1641  		if !ec.HasError(rctx) {
  1642  			ec.Errorf(ctx, "must not be null")
  1643  		}
  1644  		return graphql.Null
  1645  	}
  1646  	res := resTmp.(*introspection.Type)
  1647  	rctx.Result = res
  1648  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1649  
  1650  	if res == nil {
  1651  		if !ec.HasError(rctx) {
  1652  			ec.Errorf(ctx, "must not be null")
  1653  		}
  1654  		return graphql.Null
  1655  	}
  1656  
  1657  	return ec.___Type(ctx, field.Selections, res)
  1658  }
  1659  
  1660  // nolint: vetshadow
  1661  func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler {
  1662  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1663  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1664  	rctx := &graphql.ResolverContext{
  1665  		Object: "__Schema",
  1666  		Args:   nil,
  1667  		Field:  field,
  1668  	}
  1669  	ctx = graphql.WithResolverContext(ctx, rctx)
  1670  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1671  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1672  		ctx = rctx // use context from middleware stack in children
  1673  		return obj.MutationType(), nil
  1674  	})
  1675  	if resTmp == nil {
  1676  		return graphql.Null
  1677  	}
  1678  	res := resTmp.(*introspection.Type)
  1679  	rctx.Result = res
  1680  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1681  
  1682  	if res == nil {
  1683  		return graphql.Null
  1684  	}
  1685  
  1686  	return ec.___Type(ctx, field.Selections, res)
  1687  }
  1688  
  1689  // nolint: vetshadow
  1690  func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler {
  1691  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1692  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1693  	rctx := &graphql.ResolverContext{
  1694  		Object: "__Schema",
  1695  		Args:   nil,
  1696  		Field:  field,
  1697  	}
  1698  	ctx = graphql.WithResolverContext(ctx, rctx)
  1699  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1700  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1701  		ctx = rctx // use context from middleware stack in children
  1702  		return obj.SubscriptionType(), nil
  1703  	})
  1704  	if resTmp == nil {
  1705  		return graphql.Null
  1706  	}
  1707  	res := resTmp.(*introspection.Type)
  1708  	rctx.Result = res
  1709  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1710  
  1711  	if res == nil {
  1712  		return graphql.Null
  1713  	}
  1714  
  1715  	return ec.___Type(ctx, field.Selections, res)
  1716  }
  1717  
  1718  // nolint: vetshadow
  1719  func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler {
  1720  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1721  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1722  	rctx := &graphql.ResolverContext{
  1723  		Object: "__Schema",
  1724  		Args:   nil,
  1725  		Field:  field,
  1726  	}
  1727  	ctx = graphql.WithResolverContext(ctx, rctx)
  1728  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1729  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1730  		ctx = rctx // use context from middleware stack in children
  1731  		return obj.Directives(), nil
  1732  	})
  1733  	if resTmp == nil {
  1734  		if !ec.HasError(rctx) {
  1735  			ec.Errorf(ctx, "must not be null")
  1736  		}
  1737  		return graphql.Null
  1738  	}
  1739  	res := resTmp.([]introspection.Directive)
  1740  	rctx.Result = res
  1741  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1742  
  1743  	arr1 := make(graphql.Array, len(res))
  1744  	var wg sync.WaitGroup
  1745  
  1746  	isLen1 := len(res) == 1
  1747  	if !isLen1 {
  1748  		wg.Add(len(res))
  1749  	}
  1750  
  1751  	for idx1 := range res {
  1752  		idx1 := idx1
  1753  		rctx := &graphql.ResolverContext{
  1754  			Index:  &idx1,
  1755  			Result: &res[idx1],
  1756  		}
  1757  		ctx := graphql.WithResolverContext(ctx, rctx)
  1758  		f := func(idx1 int) {
  1759  			if !isLen1 {
  1760  				defer wg.Done()
  1761  			}
  1762  			arr1[idx1] = func() graphql.Marshaler {
  1763  
  1764  				return ec.___Directive(ctx, field.Selections, &res[idx1])
  1765  			}()
  1766  		}
  1767  		if isLen1 {
  1768  			f(idx1)
  1769  		} else {
  1770  			go f(idx1)
  1771  		}
  1772  
  1773  	}
  1774  	wg.Wait()
  1775  	return arr1
  1776  }
  1777  
  1778  var __TypeImplementors = []string{"__Type"}
  1779  
  1780  // nolint: gocyclo, errcheck, gas, goconst
  1781  func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler {
  1782  	fields := graphql.CollectFields(ctx, sel, __TypeImplementors)
  1783  
  1784  	out := graphql.NewOrderedMap(len(fields))
  1785  	invalid := false
  1786  	for i, field := range fields {
  1787  		out.Keys[i] = field.Alias
  1788  
  1789  		switch field.Name {
  1790  		case "__typename":
  1791  			out.Values[i] = graphql.MarshalString("__Type")
  1792  		case "kind":
  1793  			out.Values[i] = ec.___Type_kind(ctx, field, obj)
  1794  			if out.Values[i] == graphql.Null {
  1795  				invalid = true
  1796  			}
  1797  		case "name":
  1798  			out.Values[i] = ec.___Type_name(ctx, field, obj)
  1799  		case "description":
  1800  			out.Values[i] = ec.___Type_description(ctx, field, obj)
  1801  		case "fields":
  1802  			out.Values[i] = ec.___Type_fields(ctx, field, obj)
  1803  		case "interfaces":
  1804  			out.Values[i] = ec.___Type_interfaces(ctx, field, obj)
  1805  		case "possibleTypes":
  1806  			out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj)
  1807  		case "enumValues":
  1808  			out.Values[i] = ec.___Type_enumValues(ctx, field, obj)
  1809  		case "inputFields":
  1810  			out.Values[i] = ec.___Type_inputFields(ctx, field, obj)
  1811  		case "ofType":
  1812  			out.Values[i] = ec.___Type_ofType(ctx, field, obj)
  1813  		default:
  1814  			panic("unknown field " + strconv.Quote(field.Name))
  1815  		}
  1816  	}
  1817  
  1818  	if invalid {
  1819  		return graphql.Null
  1820  	}
  1821  	return out
  1822  }
  1823  
  1824  // nolint: vetshadow
  1825  func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  1826  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1827  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1828  	rctx := &graphql.ResolverContext{
  1829  		Object: "__Type",
  1830  		Args:   nil,
  1831  		Field:  field,
  1832  	}
  1833  	ctx = graphql.WithResolverContext(ctx, rctx)
  1834  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1835  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1836  		ctx = rctx // use context from middleware stack in children
  1837  		return obj.Kind(), nil
  1838  	})
  1839  	if resTmp == nil {
  1840  		if !ec.HasError(rctx) {
  1841  			ec.Errorf(ctx, "must not be null")
  1842  		}
  1843  		return graphql.Null
  1844  	}
  1845  	res := resTmp.(string)
  1846  	rctx.Result = res
  1847  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1848  	return graphql.MarshalString(res)
  1849  }
  1850  
  1851  // nolint: vetshadow
  1852  func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  1853  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1854  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1855  	rctx := &graphql.ResolverContext{
  1856  		Object: "__Type",
  1857  		Args:   nil,
  1858  		Field:  field,
  1859  	}
  1860  	ctx = graphql.WithResolverContext(ctx, rctx)
  1861  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1862  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1863  		ctx = rctx // use context from middleware stack in children
  1864  		return obj.Name(), nil
  1865  	})
  1866  	if resTmp == nil {
  1867  		return graphql.Null
  1868  	}
  1869  	res := resTmp.(*string)
  1870  	rctx.Result = res
  1871  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1872  
  1873  	if res == nil {
  1874  		return graphql.Null
  1875  	}
  1876  	return graphql.MarshalString(*res)
  1877  }
  1878  
  1879  // nolint: vetshadow
  1880  func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  1881  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1882  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1883  	rctx := &graphql.ResolverContext{
  1884  		Object: "__Type",
  1885  		Args:   nil,
  1886  		Field:  field,
  1887  	}
  1888  	ctx = graphql.WithResolverContext(ctx, rctx)
  1889  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1890  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1891  		ctx = rctx // use context from middleware stack in children
  1892  		return obj.Description(), nil
  1893  	})
  1894  	if resTmp == nil {
  1895  		return graphql.Null
  1896  	}
  1897  	res := resTmp.(string)
  1898  	rctx.Result = res
  1899  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1900  	return graphql.MarshalString(res)
  1901  }
  1902  
  1903  // nolint: vetshadow
  1904  func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  1905  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1906  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1907  	rawArgs := field.ArgumentMap(ec.Variables)
  1908  	args, err := field___Type_fields_args(rawArgs)
  1909  	if err != nil {
  1910  		ec.Error(ctx, err)
  1911  		return graphql.Null
  1912  	}
  1913  	rctx := &graphql.ResolverContext{
  1914  		Object: "__Type",
  1915  		Args:   args,
  1916  		Field:  field,
  1917  	}
  1918  	ctx = graphql.WithResolverContext(ctx, rctx)
  1919  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1920  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1921  		ctx = rctx // use context from middleware stack in children
  1922  		return obj.Fields(args["includeDeprecated"].(bool)), nil
  1923  	})
  1924  	if resTmp == nil {
  1925  		return graphql.Null
  1926  	}
  1927  	res := resTmp.([]introspection.Field)
  1928  	rctx.Result = res
  1929  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1930  
  1931  	arr1 := make(graphql.Array, len(res))
  1932  	var wg sync.WaitGroup
  1933  
  1934  	isLen1 := len(res) == 1
  1935  	if !isLen1 {
  1936  		wg.Add(len(res))
  1937  	}
  1938  
  1939  	for idx1 := range res {
  1940  		idx1 := idx1
  1941  		rctx := &graphql.ResolverContext{
  1942  			Index:  &idx1,
  1943  			Result: &res[idx1],
  1944  		}
  1945  		ctx := graphql.WithResolverContext(ctx, rctx)
  1946  		f := func(idx1 int) {
  1947  			if !isLen1 {
  1948  				defer wg.Done()
  1949  			}
  1950  			arr1[idx1] = func() graphql.Marshaler {
  1951  
  1952  				return ec.___Field(ctx, field.Selections, &res[idx1])
  1953  			}()
  1954  		}
  1955  		if isLen1 {
  1956  			f(idx1)
  1957  		} else {
  1958  			go f(idx1)
  1959  		}
  1960  
  1961  	}
  1962  	wg.Wait()
  1963  	return arr1
  1964  }
  1965  
  1966  // nolint: vetshadow
  1967  func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  1968  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  1969  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  1970  	rctx := &graphql.ResolverContext{
  1971  		Object: "__Type",
  1972  		Args:   nil,
  1973  		Field:  field,
  1974  	}
  1975  	ctx = graphql.WithResolverContext(ctx, rctx)
  1976  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  1977  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  1978  		ctx = rctx // use context from middleware stack in children
  1979  		return obj.Interfaces(), nil
  1980  	})
  1981  	if resTmp == nil {
  1982  		return graphql.Null
  1983  	}
  1984  	res := resTmp.([]introspection.Type)
  1985  	rctx.Result = res
  1986  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  1987  
  1988  	arr1 := make(graphql.Array, len(res))
  1989  	var wg sync.WaitGroup
  1990  
  1991  	isLen1 := len(res) == 1
  1992  	if !isLen1 {
  1993  		wg.Add(len(res))
  1994  	}
  1995  
  1996  	for idx1 := range res {
  1997  		idx1 := idx1
  1998  		rctx := &graphql.ResolverContext{
  1999  			Index:  &idx1,
  2000  			Result: &res[idx1],
  2001  		}
  2002  		ctx := graphql.WithResolverContext(ctx, rctx)
  2003  		f := func(idx1 int) {
  2004  			if !isLen1 {
  2005  				defer wg.Done()
  2006  			}
  2007  			arr1[idx1] = func() graphql.Marshaler {
  2008  
  2009  				return ec.___Type(ctx, field.Selections, &res[idx1])
  2010  			}()
  2011  		}
  2012  		if isLen1 {
  2013  			f(idx1)
  2014  		} else {
  2015  			go f(idx1)
  2016  		}
  2017  
  2018  	}
  2019  	wg.Wait()
  2020  	return arr1
  2021  }
  2022  
  2023  // nolint: vetshadow
  2024  func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  2025  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  2026  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  2027  	rctx := &graphql.ResolverContext{
  2028  		Object: "__Type",
  2029  		Args:   nil,
  2030  		Field:  field,
  2031  	}
  2032  	ctx = graphql.WithResolverContext(ctx, rctx)
  2033  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  2034  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  2035  		ctx = rctx // use context from middleware stack in children
  2036  		return obj.PossibleTypes(), nil
  2037  	})
  2038  	if resTmp == nil {
  2039  		return graphql.Null
  2040  	}
  2041  	res := resTmp.([]introspection.Type)
  2042  	rctx.Result = res
  2043  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  2044  
  2045  	arr1 := make(graphql.Array, len(res))
  2046  	var wg sync.WaitGroup
  2047  
  2048  	isLen1 := len(res) == 1
  2049  	if !isLen1 {
  2050  		wg.Add(len(res))
  2051  	}
  2052  
  2053  	for idx1 := range res {
  2054  		idx1 := idx1
  2055  		rctx := &graphql.ResolverContext{
  2056  			Index:  &idx1,
  2057  			Result: &res[idx1],
  2058  		}
  2059  		ctx := graphql.WithResolverContext(ctx, rctx)
  2060  		f := func(idx1 int) {
  2061  			if !isLen1 {
  2062  				defer wg.Done()
  2063  			}
  2064  			arr1[idx1] = func() graphql.Marshaler {
  2065  
  2066  				return ec.___Type(ctx, field.Selections, &res[idx1])
  2067  			}()
  2068  		}
  2069  		if isLen1 {
  2070  			f(idx1)
  2071  		} else {
  2072  			go f(idx1)
  2073  		}
  2074  
  2075  	}
  2076  	wg.Wait()
  2077  	return arr1
  2078  }
  2079  
  2080  // nolint: vetshadow
  2081  func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  2082  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  2083  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  2084  	rawArgs := field.ArgumentMap(ec.Variables)
  2085  	args, err := field___Type_enumValues_args(rawArgs)
  2086  	if err != nil {
  2087  		ec.Error(ctx, err)
  2088  		return graphql.Null
  2089  	}
  2090  	rctx := &graphql.ResolverContext{
  2091  		Object: "__Type",
  2092  		Args:   args,
  2093  		Field:  field,
  2094  	}
  2095  	ctx = graphql.WithResolverContext(ctx, rctx)
  2096  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  2097  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  2098  		ctx = rctx // use context from middleware stack in children
  2099  		return obj.EnumValues(args["includeDeprecated"].(bool)), nil
  2100  	})
  2101  	if resTmp == nil {
  2102  		return graphql.Null
  2103  	}
  2104  	res := resTmp.([]introspection.EnumValue)
  2105  	rctx.Result = res
  2106  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  2107  
  2108  	arr1 := make(graphql.Array, len(res))
  2109  	var wg sync.WaitGroup
  2110  
  2111  	isLen1 := len(res) == 1
  2112  	if !isLen1 {
  2113  		wg.Add(len(res))
  2114  	}
  2115  
  2116  	for idx1 := range res {
  2117  		idx1 := idx1
  2118  		rctx := &graphql.ResolverContext{
  2119  			Index:  &idx1,
  2120  			Result: &res[idx1],
  2121  		}
  2122  		ctx := graphql.WithResolverContext(ctx, rctx)
  2123  		f := func(idx1 int) {
  2124  			if !isLen1 {
  2125  				defer wg.Done()
  2126  			}
  2127  			arr1[idx1] = func() graphql.Marshaler {
  2128  
  2129  				return ec.___EnumValue(ctx, field.Selections, &res[idx1])
  2130  			}()
  2131  		}
  2132  		if isLen1 {
  2133  			f(idx1)
  2134  		} else {
  2135  			go f(idx1)
  2136  		}
  2137  
  2138  	}
  2139  	wg.Wait()
  2140  	return arr1
  2141  }
  2142  
  2143  // nolint: vetshadow
  2144  func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  2145  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  2146  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  2147  	rctx := &graphql.ResolverContext{
  2148  		Object: "__Type",
  2149  		Args:   nil,
  2150  		Field:  field,
  2151  	}
  2152  	ctx = graphql.WithResolverContext(ctx, rctx)
  2153  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  2154  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  2155  		ctx = rctx // use context from middleware stack in children
  2156  		return obj.InputFields(), nil
  2157  	})
  2158  	if resTmp == nil {
  2159  		return graphql.Null
  2160  	}
  2161  	res := resTmp.([]introspection.InputValue)
  2162  	rctx.Result = res
  2163  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  2164  
  2165  	arr1 := make(graphql.Array, len(res))
  2166  	var wg sync.WaitGroup
  2167  
  2168  	isLen1 := len(res) == 1
  2169  	if !isLen1 {
  2170  		wg.Add(len(res))
  2171  	}
  2172  
  2173  	for idx1 := range res {
  2174  		idx1 := idx1
  2175  		rctx := &graphql.ResolverContext{
  2176  			Index:  &idx1,
  2177  			Result: &res[idx1],
  2178  		}
  2179  		ctx := graphql.WithResolverContext(ctx, rctx)
  2180  		f := func(idx1 int) {
  2181  			if !isLen1 {
  2182  				defer wg.Done()
  2183  			}
  2184  			arr1[idx1] = func() graphql.Marshaler {
  2185  
  2186  				return ec.___InputValue(ctx, field.Selections, &res[idx1])
  2187  			}()
  2188  		}
  2189  		if isLen1 {
  2190  			f(idx1)
  2191  		} else {
  2192  			go f(idx1)
  2193  		}
  2194  
  2195  	}
  2196  	wg.Wait()
  2197  	return arr1
  2198  }
  2199  
  2200  // nolint: vetshadow
  2201  func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler {
  2202  	ctx = ec.Tracer.StartFieldExecution(ctx, field)
  2203  	defer func() { ec.Tracer.EndFieldExecution(ctx) }()
  2204  	rctx := &graphql.ResolverContext{
  2205  		Object: "__Type",
  2206  		Args:   nil,
  2207  		Field:  field,
  2208  	}
  2209  	ctx = graphql.WithResolverContext(ctx, rctx)
  2210  	ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
  2211  	resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
  2212  		ctx = rctx // use context from middleware stack in children
  2213  		return obj.OfType(), nil
  2214  	})
  2215  	if resTmp == nil {
  2216  		return graphql.Null
  2217  	}
  2218  	res := resTmp.(*introspection.Type)
  2219  	rctx.Result = res
  2220  	ctx = ec.Tracer.StartFieldChildExecution(ctx)
  2221  
  2222  	if res == nil {
  2223  		return graphql.Null
  2224  	}
  2225  
  2226  	return ec.___Type(ctx, field.Selections, res)
  2227  }
  2228  
  2229  func UnmarshalTodoInput(v interface{}) (TodoInput, error) {
  2230  	var it TodoInput
  2231  	var asMap = v.(map[string]interface{})
  2232  
  2233  	for k, v := range asMap {
  2234  		switch k {
  2235  		case "text":
  2236  			var err error
  2237  			it.Text, err = graphql.UnmarshalString(v)
  2238  			if err != nil {
  2239  				return it, err
  2240  			}
  2241  		case "done":
  2242  			var err error
  2243  			var ptr1 bool
  2244  			if v != nil {
  2245  				ptr1, err = graphql.UnmarshalBoolean(v)
  2246  				it.Done = &ptr1
  2247  			}
  2248  
  2249  			if err != nil {
  2250  				return it, err
  2251  			}
  2252  		}
  2253  	}
  2254  
  2255  	return it, nil
  2256  }
  2257  
  2258  func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) {
  2259  	defer func() {
  2260  		if r := recover(); r != nil {
  2261  			ec.Error(ctx, ec.Recover(ctx, r))
  2262  			ret = nil
  2263  		}
  2264  	}()
  2265  	rctx := graphql.GetResolverContext(ctx)
  2266  	for _, d := range rctx.Field.Definition.Directives {
  2267  		switch d.Name {
  2268  		case "hasRole":
  2269  			if ec.directives.HasRole != nil {
  2270  				rawArgs := d.ArgumentMap(ec.Variables)
  2271  				args, err := dir_hasRole_args(rawArgs)
  2272  				if err != nil {
  2273  					ec.Error(ctx, err)
  2274  					return nil
  2275  				}
  2276  				n := next
  2277  				next = func(ctx context.Context) (interface{}, error) {
  2278  					return ec.directives.HasRole(ctx, obj, n, args["role"].(Role))
  2279  				}
  2280  			}
  2281  		}
  2282  	}
  2283  	res, err := ec.ResolverMiddleware(ctx, next)
  2284  	if err != nil {
  2285  		ec.Error(ctx, err)
  2286  		return nil
  2287  	}
  2288  	return res
  2289  }
  2290  
  2291  func (ec *executionContext) introspectSchema() (*introspection.Schema, error) {
  2292  	if ec.DisableIntrospection {
  2293  		return nil, errors.New("introspection disabled")
  2294  	}
  2295  	return introspection.WrapSchema(parsedSchema), nil
  2296  }
  2297  
  2298  func (ec *executionContext) introspectType(name string) (*introspection.Type, error) {
  2299  	if ec.DisableIntrospection {
  2300  		return nil, errors.New("introspection disabled")
  2301  	}
  2302  	return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil
  2303  }
  2304  
  2305  var parsedSchema = gqlparser.MustLoadSchema(
  2306  	&ast.Source{Name: "schema.graphql", Input: `schema {
  2307      query: MyQuery
  2308      mutation: MyMutation
  2309  }
  2310  
  2311  type MyQuery {
  2312      todo(id: Int!): Todo
  2313      lastTodo: Todo
  2314      todos: [Todo!]!
  2315  }
  2316  
  2317  type MyMutation {
  2318      createTodo(todo: TodoInput!): Todo!
  2319      updateTodo(id: Int!, changes: Map!): Todo
  2320  }
  2321  
  2322  type Todo {
  2323      id: Int!
  2324      text: String!
  2325      done: Boolean! @hasRole(role: OWNER) # only the owner can see if a todo is done
  2326  }
  2327  
  2328  "Passed to createTodo to create a new todo"
  2329  input TodoInput {
  2330      "The body text"
  2331      text: String!
  2332      "Is it done already?"
  2333      done: Boolean
  2334  }
  2335  
  2336  scalar Map
  2337  
  2338  "Prevents access to a field if the user doesnt have the matching role"
  2339  directive @hasRole(role: Role!) on FIELD_DEFINITION
  2340  
  2341  enum Role {
  2342      ADMIN
  2343      OWNER
  2344  }
  2345  `},
  2346  )