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