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