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