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