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