github.com/jepp2078/gqlgen@v0.7.2/example/starwars/generated.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 3 package starwars 4 5 import ( 6 "bytes" 7 "context" 8 "errors" 9 "fmt" 10 "strconv" 11 "sync" 12 "time" 13 14 "github.com/99designs/gqlgen/graphql" 15 "github.com/99designs/gqlgen/graphql/introspection" 16 "github.com/vektah/gqlparser" 17 "github.com/vektah/gqlparser/ast" 18 ) 19 20 // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. 21 func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { 22 return &executableSchema{ 23 resolvers: cfg.Resolvers, 24 directives: cfg.Directives, 25 complexity: cfg.Complexity, 26 } 27 } 28 29 type Config struct { 30 Resolvers ResolverRoot 31 Directives DirectiveRoot 32 Complexity ComplexityRoot 33 } 34 35 type ResolverRoot interface { 36 Droid() DroidResolver 37 FriendsConnection() FriendsConnectionResolver 38 Human() HumanResolver 39 Mutation() MutationResolver 40 Query() QueryResolver 41 Starship() StarshipResolver 42 } 43 44 type DirectiveRoot struct { 45 } 46 47 type ComplexityRoot struct { 48 Droid struct { 49 Id func(childComplexity int) int 50 Name func(childComplexity int) int 51 Friends func(childComplexity int) int 52 FriendsConnection func(childComplexity int, first *int, after *string) int 53 AppearsIn func(childComplexity int) int 54 PrimaryFunction func(childComplexity int) int 55 } 56 57 FriendsConnection struct { 58 TotalCount func(childComplexity int) int 59 Edges func(childComplexity int) int 60 Friends func(childComplexity int) int 61 PageInfo func(childComplexity int) int 62 } 63 64 FriendsEdge struct { 65 Cursor func(childComplexity int) int 66 Node func(childComplexity int) int 67 } 68 69 Human struct { 70 Id func(childComplexity int) int 71 Name func(childComplexity int) int 72 Height func(childComplexity int, unit LengthUnit) int 73 Mass func(childComplexity int) int 74 Friends func(childComplexity int) int 75 FriendsConnection func(childComplexity int, first *int, after *string) int 76 AppearsIn func(childComplexity int) int 77 Starships func(childComplexity int) int 78 } 79 80 Mutation struct { 81 CreateReview func(childComplexity int, episode Episode, review Review) int 82 } 83 84 PageInfo struct { 85 StartCursor func(childComplexity int) int 86 EndCursor func(childComplexity int) int 87 HasNextPage func(childComplexity int) int 88 } 89 90 Query struct { 91 Hero func(childComplexity int, episode *Episode) int 92 Reviews func(childComplexity int, episode Episode, since *time.Time) int 93 Search func(childComplexity int, text string) int 94 Character func(childComplexity int, id string) int 95 Droid func(childComplexity int, id string) int 96 Human func(childComplexity int, id string) int 97 Starship func(childComplexity int, id string) int 98 } 99 100 Review struct { 101 Stars func(childComplexity int) int 102 Commentary func(childComplexity int) int 103 Time func(childComplexity int) int 104 } 105 106 Starship struct { 107 Id func(childComplexity int) int 108 Name func(childComplexity int) int 109 Length func(childComplexity int, unit *LengthUnit) int 110 History func(childComplexity int) int 111 } 112 } 113 114 type DroidResolver interface { 115 Friends(ctx context.Context, obj *Droid) ([]Character, error) 116 FriendsConnection(ctx context.Context, obj *Droid, first *int, after *string) (FriendsConnection, error) 117 } 118 type FriendsConnectionResolver interface { 119 Edges(ctx context.Context, obj *FriendsConnection) ([]FriendsEdge, error) 120 Friends(ctx context.Context, obj *FriendsConnection) ([]Character, error) 121 } 122 type HumanResolver interface { 123 Friends(ctx context.Context, obj *Human) ([]Character, error) 124 FriendsConnection(ctx context.Context, obj *Human, first *int, after *string) (FriendsConnection, error) 125 126 Starships(ctx context.Context, obj *Human) ([]Starship, error) 127 } 128 type MutationResolver interface { 129 CreateReview(ctx context.Context, episode Episode, review Review) (*Review, error) 130 } 131 type QueryResolver interface { 132 Hero(ctx context.Context, episode *Episode) (Character, error) 133 Reviews(ctx context.Context, episode Episode, since *time.Time) ([]Review, error) 134 Search(ctx context.Context, text string) ([]SearchResult, error) 135 Character(ctx context.Context, id string) (Character, error) 136 Droid(ctx context.Context, id string) (*Droid, error) 137 Human(ctx context.Context, id string) (*Human, error) 138 Starship(ctx context.Context, id string) (*Starship, error) 139 } 140 type StarshipResolver interface { 141 Length(ctx context.Context, obj *Starship, unit *LengthUnit) (float64, error) 142 } 143 144 func field_Droid_friendsConnection_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 145 args := map[string]interface{}{} 146 var arg0 *int 147 if tmp, ok := rawArgs["first"]; ok { 148 var err error 149 var ptr1 int 150 if tmp != nil { 151 ptr1, err = graphql.UnmarshalInt(tmp) 152 arg0 = &ptr1 153 } 154 155 if err != nil { 156 return nil, err 157 } 158 } 159 args["first"] = arg0 160 var arg1 *string 161 if tmp, ok := rawArgs["after"]; ok { 162 var err error 163 var ptr1 string 164 if tmp != nil { 165 ptr1, err = graphql.UnmarshalID(tmp) 166 arg1 = &ptr1 167 } 168 169 if err != nil { 170 return nil, err 171 } 172 } 173 args["after"] = arg1 174 return args, nil 175 176 } 177 178 func field_Human_height_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 179 args := map[string]interface{}{} 180 var arg0 LengthUnit 181 if tmp, ok := rawArgs["unit"]; ok { 182 var err error 183 err = (&arg0).UnmarshalGQL(tmp) 184 if err != nil { 185 return nil, err 186 } 187 } 188 args["unit"] = arg0 189 return args, nil 190 191 } 192 193 func field_Human_friendsConnection_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 194 args := map[string]interface{}{} 195 var arg0 *int 196 if tmp, ok := rawArgs["first"]; ok { 197 var err error 198 var ptr1 int 199 if tmp != nil { 200 ptr1, err = graphql.UnmarshalInt(tmp) 201 arg0 = &ptr1 202 } 203 204 if err != nil { 205 return nil, err 206 } 207 } 208 args["first"] = arg0 209 var arg1 *string 210 if tmp, ok := rawArgs["after"]; ok { 211 var err error 212 var ptr1 string 213 if tmp != nil { 214 ptr1, err = graphql.UnmarshalID(tmp) 215 arg1 = &ptr1 216 } 217 218 if err != nil { 219 return nil, err 220 } 221 } 222 args["after"] = arg1 223 return args, nil 224 225 } 226 227 func field_Mutation_createReview_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 228 args := map[string]interface{}{} 229 var arg0 Episode 230 if tmp, ok := rawArgs["episode"]; ok { 231 var err error 232 err = (&arg0).UnmarshalGQL(tmp) 233 if err != nil { 234 return nil, err 235 } 236 } 237 args["episode"] = arg0 238 var arg1 Review 239 if tmp, ok := rawArgs["review"]; ok { 240 var err error 241 arg1, err = UnmarshalReviewInput(tmp) 242 if err != nil { 243 return nil, err 244 } 245 } 246 args["review"] = arg1 247 return args, nil 248 249 } 250 251 func field_Query_hero_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 252 args := map[string]interface{}{} 253 var arg0 *Episode 254 if tmp, ok := rawArgs["episode"]; ok { 255 var err error 256 var ptr1 Episode 257 if tmp != nil { 258 err = (&ptr1).UnmarshalGQL(tmp) 259 arg0 = &ptr1 260 } 261 262 if err != nil { 263 return nil, err 264 } 265 } 266 args["episode"] = arg0 267 return args, nil 268 269 } 270 271 func field_Query_reviews_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 272 args := map[string]interface{}{} 273 var arg0 Episode 274 if tmp, ok := rawArgs["episode"]; ok { 275 var err error 276 err = (&arg0).UnmarshalGQL(tmp) 277 if err != nil { 278 return nil, err 279 } 280 } 281 args["episode"] = arg0 282 var arg1 *time.Time 283 if tmp, ok := rawArgs["since"]; ok { 284 var err error 285 var ptr1 time.Time 286 if tmp != nil { 287 ptr1, err = graphql.UnmarshalTime(tmp) 288 arg1 = &ptr1 289 } 290 291 if err != nil { 292 return nil, err 293 } 294 } 295 args["since"] = arg1 296 return args, nil 297 298 } 299 300 func field_Query_search_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 301 args := map[string]interface{}{} 302 var arg0 string 303 if tmp, ok := rawArgs["text"]; ok { 304 var err error 305 arg0, err = graphql.UnmarshalString(tmp) 306 if err != nil { 307 return nil, err 308 } 309 } 310 args["text"] = arg0 311 return args, nil 312 313 } 314 315 func field_Query_character_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 316 args := map[string]interface{}{} 317 var arg0 string 318 if tmp, ok := rawArgs["id"]; ok { 319 var err error 320 arg0, err = graphql.UnmarshalID(tmp) 321 if err != nil { 322 return nil, err 323 } 324 } 325 args["id"] = arg0 326 return args, nil 327 328 } 329 330 func field_Query_droid_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 331 args := map[string]interface{}{} 332 var arg0 string 333 if tmp, ok := rawArgs["id"]; ok { 334 var err error 335 arg0, err = graphql.UnmarshalID(tmp) 336 if err != nil { 337 return nil, err 338 } 339 } 340 args["id"] = arg0 341 return args, nil 342 343 } 344 345 func field_Query_human_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 346 args := map[string]interface{}{} 347 var arg0 string 348 if tmp, ok := rawArgs["id"]; ok { 349 var err error 350 arg0, err = graphql.UnmarshalID(tmp) 351 if err != nil { 352 return nil, err 353 } 354 } 355 args["id"] = arg0 356 return args, nil 357 358 } 359 360 func field_Query_starship_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 361 args := map[string]interface{}{} 362 var arg0 string 363 if tmp, ok := rawArgs["id"]; ok { 364 var err error 365 arg0, err = graphql.UnmarshalID(tmp) 366 if err != nil { 367 return nil, err 368 } 369 } 370 args["id"] = arg0 371 return args, nil 372 373 } 374 375 func field_Query___type_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 376 args := map[string]interface{}{} 377 var arg0 string 378 if tmp, ok := rawArgs["name"]; ok { 379 var err error 380 arg0, err = graphql.UnmarshalString(tmp) 381 if err != nil { 382 return nil, err 383 } 384 } 385 args["name"] = arg0 386 return args, nil 387 388 } 389 390 func field_Starship_length_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 391 args := map[string]interface{}{} 392 var arg0 *LengthUnit 393 if tmp, ok := rawArgs["unit"]; ok { 394 var err error 395 var ptr1 LengthUnit 396 if tmp != nil { 397 err = (&ptr1).UnmarshalGQL(tmp) 398 arg0 = &ptr1 399 } 400 401 if err != nil { 402 return nil, err 403 } 404 } 405 args["unit"] = arg0 406 return args, nil 407 408 } 409 410 func field___Type_fields_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 411 args := map[string]interface{}{} 412 var arg0 bool 413 if tmp, ok := rawArgs["includeDeprecated"]; ok { 414 var err error 415 arg0, err = graphql.UnmarshalBoolean(tmp) 416 if err != nil { 417 return nil, err 418 } 419 } 420 args["includeDeprecated"] = arg0 421 return args, nil 422 423 } 424 425 func field___Type_enumValues_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 426 args := map[string]interface{}{} 427 var arg0 bool 428 if tmp, ok := rawArgs["includeDeprecated"]; ok { 429 var err error 430 arg0, err = graphql.UnmarshalBoolean(tmp) 431 if err != nil { 432 return nil, err 433 } 434 } 435 args["includeDeprecated"] = arg0 436 return args, nil 437 438 } 439 440 type executableSchema struct { 441 resolvers ResolverRoot 442 directives DirectiveRoot 443 complexity ComplexityRoot 444 } 445 446 func (e *executableSchema) Schema() *ast.Schema { 447 return parsedSchema 448 } 449 450 func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { 451 switch typeName + "." + field { 452 453 case "Droid.id": 454 if e.complexity.Droid.Id == nil { 455 break 456 } 457 458 return e.complexity.Droid.Id(childComplexity), true 459 460 case "Droid.name": 461 if e.complexity.Droid.Name == nil { 462 break 463 } 464 465 return e.complexity.Droid.Name(childComplexity), true 466 467 case "Droid.friends": 468 if e.complexity.Droid.Friends == nil { 469 break 470 } 471 472 return e.complexity.Droid.Friends(childComplexity), true 473 474 case "Droid.friendsConnection": 475 if e.complexity.Droid.FriendsConnection == nil { 476 break 477 } 478 479 args, err := field_Droid_friendsConnection_args(rawArgs) 480 if err != nil { 481 return 0, false 482 } 483 484 return e.complexity.Droid.FriendsConnection(childComplexity, args["first"].(*int), args["after"].(*string)), true 485 486 case "Droid.appearsIn": 487 if e.complexity.Droid.AppearsIn == nil { 488 break 489 } 490 491 return e.complexity.Droid.AppearsIn(childComplexity), true 492 493 case "Droid.primaryFunction": 494 if e.complexity.Droid.PrimaryFunction == nil { 495 break 496 } 497 498 return e.complexity.Droid.PrimaryFunction(childComplexity), true 499 500 case "FriendsConnection.totalCount": 501 if e.complexity.FriendsConnection.TotalCount == nil { 502 break 503 } 504 505 return e.complexity.FriendsConnection.TotalCount(childComplexity), true 506 507 case "FriendsConnection.edges": 508 if e.complexity.FriendsConnection.Edges == nil { 509 break 510 } 511 512 return e.complexity.FriendsConnection.Edges(childComplexity), true 513 514 case "FriendsConnection.friends": 515 if e.complexity.FriendsConnection.Friends == nil { 516 break 517 } 518 519 return e.complexity.FriendsConnection.Friends(childComplexity), true 520 521 case "FriendsConnection.pageInfo": 522 if e.complexity.FriendsConnection.PageInfo == nil { 523 break 524 } 525 526 return e.complexity.FriendsConnection.PageInfo(childComplexity), true 527 528 case "FriendsEdge.cursor": 529 if e.complexity.FriendsEdge.Cursor == nil { 530 break 531 } 532 533 return e.complexity.FriendsEdge.Cursor(childComplexity), true 534 535 case "FriendsEdge.node": 536 if e.complexity.FriendsEdge.Node == nil { 537 break 538 } 539 540 return e.complexity.FriendsEdge.Node(childComplexity), true 541 542 case "Human.id": 543 if e.complexity.Human.Id == nil { 544 break 545 } 546 547 return e.complexity.Human.Id(childComplexity), true 548 549 case "Human.name": 550 if e.complexity.Human.Name == nil { 551 break 552 } 553 554 return e.complexity.Human.Name(childComplexity), true 555 556 case "Human.height": 557 if e.complexity.Human.Height == nil { 558 break 559 } 560 561 args, err := field_Human_height_args(rawArgs) 562 if err != nil { 563 return 0, false 564 } 565 566 return e.complexity.Human.Height(childComplexity, args["unit"].(LengthUnit)), true 567 568 case "Human.mass": 569 if e.complexity.Human.Mass == nil { 570 break 571 } 572 573 return e.complexity.Human.Mass(childComplexity), true 574 575 case "Human.friends": 576 if e.complexity.Human.Friends == nil { 577 break 578 } 579 580 return e.complexity.Human.Friends(childComplexity), true 581 582 case "Human.friendsConnection": 583 if e.complexity.Human.FriendsConnection == nil { 584 break 585 } 586 587 args, err := field_Human_friendsConnection_args(rawArgs) 588 if err != nil { 589 return 0, false 590 } 591 592 return e.complexity.Human.FriendsConnection(childComplexity, args["first"].(*int), args["after"].(*string)), true 593 594 case "Human.appearsIn": 595 if e.complexity.Human.AppearsIn == nil { 596 break 597 } 598 599 return e.complexity.Human.AppearsIn(childComplexity), true 600 601 case "Human.starships": 602 if e.complexity.Human.Starships == nil { 603 break 604 } 605 606 return e.complexity.Human.Starships(childComplexity), true 607 608 case "Mutation.createReview": 609 if e.complexity.Mutation.CreateReview == nil { 610 break 611 } 612 613 args, err := field_Mutation_createReview_args(rawArgs) 614 if err != nil { 615 return 0, false 616 } 617 618 return e.complexity.Mutation.CreateReview(childComplexity, args["episode"].(Episode), args["review"].(Review)), true 619 620 case "PageInfo.startCursor": 621 if e.complexity.PageInfo.StartCursor == nil { 622 break 623 } 624 625 return e.complexity.PageInfo.StartCursor(childComplexity), true 626 627 case "PageInfo.endCursor": 628 if e.complexity.PageInfo.EndCursor == nil { 629 break 630 } 631 632 return e.complexity.PageInfo.EndCursor(childComplexity), true 633 634 case "PageInfo.hasNextPage": 635 if e.complexity.PageInfo.HasNextPage == nil { 636 break 637 } 638 639 return e.complexity.PageInfo.HasNextPage(childComplexity), true 640 641 case "Query.hero": 642 if e.complexity.Query.Hero == nil { 643 break 644 } 645 646 args, err := field_Query_hero_args(rawArgs) 647 if err != nil { 648 return 0, false 649 } 650 651 return e.complexity.Query.Hero(childComplexity, args["episode"].(*Episode)), true 652 653 case "Query.reviews": 654 if e.complexity.Query.Reviews == nil { 655 break 656 } 657 658 args, err := field_Query_reviews_args(rawArgs) 659 if err != nil { 660 return 0, false 661 } 662 663 return e.complexity.Query.Reviews(childComplexity, args["episode"].(Episode), args["since"].(*time.Time)), true 664 665 case "Query.search": 666 if e.complexity.Query.Search == nil { 667 break 668 } 669 670 args, err := field_Query_search_args(rawArgs) 671 if err != nil { 672 return 0, false 673 } 674 675 return e.complexity.Query.Search(childComplexity, args["text"].(string)), true 676 677 case "Query.character": 678 if e.complexity.Query.Character == nil { 679 break 680 } 681 682 args, err := field_Query_character_args(rawArgs) 683 if err != nil { 684 return 0, false 685 } 686 687 return e.complexity.Query.Character(childComplexity, args["id"].(string)), true 688 689 case "Query.droid": 690 if e.complexity.Query.Droid == nil { 691 break 692 } 693 694 args, err := field_Query_droid_args(rawArgs) 695 if err != nil { 696 return 0, false 697 } 698 699 return e.complexity.Query.Droid(childComplexity, args["id"].(string)), true 700 701 case "Query.human": 702 if e.complexity.Query.Human == nil { 703 break 704 } 705 706 args, err := field_Query_human_args(rawArgs) 707 if err != nil { 708 return 0, false 709 } 710 711 return e.complexity.Query.Human(childComplexity, args["id"].(string)), true 712 713 case "Query.starship": 714 if e.complexity.Query.Starship == nil { 715 break 716 } 717 718 args, err := field_Query_starship_args(rawArgs) 719 if err != nil { 720 return 0, false 721 } 722 723 return e.complexity.Query.Starship(childComplexity, args["id"].(string)), true 724 725 case "Review.stars": 726 if e.complexity.Review.Stars == nil { 727 break 728 } 729 730 return e.complexity.Review.Stars(childComplexity), true 731 732 case "Review.commentary": 733 if e.complexity.Review.Commentary == nil { 734 break 735 } 736 737 return e.complexity.Review.Commentary(childComplexity), true 738 739 case "Review.time": 740 if e.complexity.Review.Time == nil { 741 break 742 } 743 744 return e.complexity.Review.Time(childComplexity), true 745 746 case "Starship.id": 747 if e.complexity.Starship.Id == nil { 748 break 749 } 750 751 return e.complexity.Starship.Id(childComplexity), true 752 753 case "Starship.name": 754 if e.complexity.Starship.Name == nil { 755 break 756 } 757 758 return e.complexity.Starship.Name(childComplexity), true 759 760 case "Starship.length": 761 if e.complexity.Starship.Length == nil { 762 break 763 } 764 765 args, err := field_Starship_length_args(rawArgs) 766 if err != nil { 767 return 0, false 768 } 769 770 return e.complexity.Starship.Length(childComplexity, args["unit"].(*LengthUnit)), true 771 772 case "Starship.history": 773 if e.complexity.Starship.History == nil { 774 break 775 } 776 777 return e.complexity.Starship.History(childComplexity), true 778 779 } 780 return 0, false 781 } 782 783 func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { 784 ec := executionContext{graphql.GetRequestContext(ctx), e} 785 786 buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { 787 data := ec._Query(ctx, op.SelectionSet) 788 var buf bytes.Buffer 789 data.MarshalGQL(&buf) 790 return buf.Bytes() 791 }) 792 793 return &graphql.Response{ 794 Data: buf, 795 Errors: ec.Errors, 796 Extensions: ec.Extensions} 797 } 798 799 func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { 800 ec := executionContext{graphql.GetRequestContext(ctx), e} 801 802 buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { 803 data := ec._Mutation(ctx, op.SelectionSet) 804 var buf bytes.Buffer 805 data.MarshalGQL(&buf) 806 return buf.Bytes() 807 }) 808 809 return &graphql.Response{ 810 Data: buf, 811 Errors: ec.Errors, 812 Extensions: ec.Extensions, 813 } 814 } 815 816 func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { 817 return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) 818 } 819 820 type executionContext struct { 821 *graphql.RequestContext 822 *executableSchema 823 } 824 825 var droidImplementors = []string{"Droid", "Character"} 826 827 // nolint: gocyclo, errcheck, gas, goconst 828 func (ec *executionContext) _Droid(ctx context.Context, sel ast.SelectionSet, obj *Droid) graphql.Marshaler { 829 fields := graphql.CollectFields(ctx, sel, droidImplementors) 830 831 var wg sync.WaitGroup 832 out := graphql.NewOrderedMap(len(fields)) 833 invalid := false 834 for i, field := range fields { 835 out.Keys[i] = field.Alias 836 837 switch field.Name { 838 case "__typename": 839 out.Values[i] = graphql.MarshalString("Droid") 840 case "id": 841 out.Values[i] = ec._Droid_id(ctx, field, obj) 842 if out.Values[i] == graphql.Null { 843 invalid = true 844 } 845 case "name": 846 out.Values[i] = ec._Droid_name(ctx, field, obj) 847 if out.Values[i] == graphql.Null { 848 invalid = true 849 } 850 case "friends": 851 wg.Add(1) 852 go func(i int, field graphql.CollectedField) { 853 out.Values[i] = ec._Droid_friends(ctx, field, obj) 854 wg.Done() 855 }(i, field) 856 case "friendsConnection": 857 wg.Add(1) 858 go func(i int, field graphql.CollectedField) { 859 out.Values[i] = ec._Droid_friendsConnection(ctx, field, obj) 860 if out.Values[i] == graphql.Null { 861 invalid = true 862 } 863 wg.Done() 864 }(i, field) 865 case "appearsIn": 866 out.Values[i] = ec._Droid_appearsIn(ctx, field, obj) 867 if out.Values[i] == graphql.Null { 868 invalid = true 869 } 870 case "primaryFunction": 871 out.Values[i] = ec._Droid_primaryFunction(ctx, field, obj) 872 default: 873 panic("unknown field " + strconv.Quote(field.Name)) 874 } 875 } 876 wg.Wait() 877 if invalid { 878 return graphql.Null 879 } 880 return out 881 } 882 883 // nolint: vetshadow 884 func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *Droid) graphql.Marshaler { 885 ctx = ec.Tracer.StartFieldExecution(ctx, field) 886 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 887 rctx := &graphql.ResolverContext{ 888 Object: "Droid", 889 Args: nil, 890 Field: field, 891 } 892 ctx = graphql.WithResolverContext(ctx, rctx) 893 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 894 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 895 ctx = rctx // use context from middleware stack in children 896 return obj.ID, nil 897 }) 898 if resTmp == nil { 899 if !ec.HasError(rctx) { 900 ec.Errorf(ctx, "must not be null") 901 } 902 return graphql.Null 903 } 904 res := resTmp.(string) 905 rctx.Result = res 906 ctx = ec.Tracer.StartFieldChildExecution(ctx) 907 return graphql.MarshalID(res) 908 } 909 910 // nolint: vetshadow 911 func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *Droid) graphql.Marshaler { 912 ctx = ec.Tracer.StartFieldExecution(ctx, field) 913 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 914 rctx := &graphql.ResolverContext{ 915 Object: "Droid", 916 Args: nil, 917 Field: field, 918 } 919 ctx = graphql.WithResolverContext(ctx, rctx) 920 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 921 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 922 ctx = rctx // use context from middleware stack in children 923 return obj.Name, nil 924 }) 925 if resTmp == nil { 926 if !ec.HasError(rctx) { 927 ec.Errorf(ctx, "must not be null") 928 } 929 return graphql.Null 930 } 931 res := resTmp.(string) 932 rctx.Result = res 933 ctx = ec.Tracer.StartFieldChildExecution(ctx) 934 return graphql.MarshalString(res) 935 } 936 937 // nolint: vetshadow 938 func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *Droid) graphql.Marshaler { 939 ctx = ec.Tracer.StartFieldExecution(ctx, field) 940 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 941 rctx := &graphql.ResolverContext{ 942 Object: "Droid", 943 Args: nil, 944 Field: field, 945 } 946 ctx = graphql.WithResolverContext(ctx, rctx) 947 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 948 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 949 ctx = rctx // use context from middleware stack in children 950 return ec.resolvers.Droid().Friends(rctx, obj) 951 }) 952 if resTmp == nil { 953 return graphql.Null 954 } 955 res := resTmp.([]Character) 956 rctx.Result = res 957 ctx = ec.Tracer.StartFieldChildExecution(ctx) 958 959 arr1 := make(graphql.Array, len(res)) 960 var wg sync.WaitGroup 961 962 isLen1 := len(res) == 1 963 if !isLen1 { 964 wg.Add(len(res)) 965 } 966 967 for idx1 := range res { 968 idx1 := idx1 969 rctx := &graphql.ResolverContext{ 970 Index: &idx1, 971 Result: &res[idx1], 972 } 973 ctx := graphql.WithResolverContext(ctx, rctx) 974 f := func(idx1 int) { 975 if !isLen1 { 976 defer wg.Done() 977 } 978 arr1[idx1] = func() graphql.Marshaler { 979 980 return ec._Character(ctx, field.Selections, &res[idx1]) 981 }() 982 } 983 if isLen1 { 984 f(idx1) 985 } else { 986 go f(idx1) 987 } 988 989 } 990 wg.Wait() 991 return arr1 992 } 993 994 // nolint: vetshadow 995 func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *Droid) graphql.Marshaler { 996 ctx = ec.Tracer.StartFieldExecution(ctx, field) 997 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 998 rawArgs := field.ArgumentMap(ec.Variables) 999 args, err := field_Droid_friendsConnection_args(rawArgs) 1000 if err != nil { 1001 ec.Error(ctx, err) 1002 return graphql.Null 1003 } 1004 rctx := &graphql.ResolverContext{ 1005 Object: "Droid", 1006 Args: args, 1007 Field: field, 1008 } 1009 ctx = graphql.WithResolverContext(ctx, rctx) 1010 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1011 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1012 ctx = rctx // use context from middleware stack in children 1013 return ec.resolvers.Droid().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) 1014 }) 1015 if resTmp == nil { 1016 if !ec.HasError(rctx) { 1017 ec.Errorf(ctx, "must not be null") 1018 } 1019 return graphql.Null 1020 } 1021 res := resTmp.(FriendsConnection) 1022 rctx.Result = res 1023 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1024 1025 return ec._FriendsConnection(ctx, field.Selections, &res) 1026 } 1027 1028 // nolint: vetshadow 1029 func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *Droid) graphql.Marshaler { 1030 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1031 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1032 rctx := &graphql.ResolverContext{ 1033 Object: "Droid", 1034 Args: nil, 1035 Field: field, 1036 } 1037 ctx = graphql.WithResolverContext(ctx, rctx) 1038 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1039 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1040 ctx = rctx // use context from middleware stack in children 1041 return obj.AppearsIn, nil 1042 }) 1043 if resTmp == nil { 1044 if !ec.HasError(rctx) { 1045 ec.Errorf(ctx, "must not be null") 1046 } 1047 return graphql.Null 1048 } 1049 res := resTmp.([]Episode) 1050 rctx.Result = res 1051 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1052 1053 arr1 := make(graphql.Array, len(res)) 1054 1055 for idx1 := range res { 1056 arr1[idx1] = func() graphql.Marshaler { 1057 return res[idx1] 1058 }() 1059 } 1060 1061 return arr1 1062 } 1063 1064 // nolint: vetshadow 1065 func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *Droid) graphql.Marshaler { 1066 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1067 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1068 rctx := &graphql.ResolverContext{ 1069 Object: "Droid", 1070 Args: nil, 1071 Field: field, 1072 } 1073 ctx = graphql.WithResolverContext(ctx, rctx) 1074 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1075 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1076 ctx = rctx // use context from middleware stack in children 1077 return obj.PrimaryFunction, nil 1078 }) 1079 if resTmp == nil { 1080 return graphql.Null 1081 } 1082 res := resTmp.(string) 1083 rctx.Result = res 1084 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1085 return graphql.MarshalString(res) 1086 } 1087 1088 var friendsConnectionImplementors = []string{"FriendsConnection"} 1089 1090 // nolint: gocyclo, errcheck, gas, goconst 1091 func (ec *executionContext) _FriendsConnection(ctx context.Context, sel ast.SelectionSet, obj *FriendsConnection) graphql.Marshaler { 1092 fields := graphql.CollectFields(ctx, sel, friendsConnectionImplementors) 1093 1094 var wg sync.WaitGroup 1095 out := graphql.NewOrderedMap(len(fields)) 1096 invalid := false 1097 for i, field := range fields { 1098 out.Keys[i] = field.Alias 1099 1100 switch field.Name { 1101 case "__typename": 1102 out.Values[i] = graphql.MarshalString("FriendsConnection") 1103 case "totalCount": 1104 out.Values[i] = ec._FriendsConnection_totalCount(ctx, field, obj) 1105 if out.Values[i] == graphql.Null { 1106 invalid = true 1107 } 1108 case "edges": 1109 wg.Add(1) 1110 go func(i int, field graphql.CollectedField) { 1111 out.Values[i] = ec._FriendsConnection_edges(ctx, field, obj) 1112 wg.Done() 1113 }(i, field) 1114 case "friends": 1115 wg.Add(1) 1116 go func(i int, field graphql.CollectedField) { 1117 out.Values[i] = ec._FriendsConnection_friends(ctx, field, obj) 1118 wg.Done() 1119 }(i, field) 1120 case "pageInfo": 1121 out.Values[i] = ec._FriendsConnection_pageInfo(ctx, field, obj) 1122 if out.Values[i] == graphql.Null { 1123 invalid = true 1124 } 1125 default: 1126 panic("unknown field " + strconv.Quote(field.Name)) 1127 } 1128 } 1129 wg.Wait() 1130 if invalid { 1131 return graphql.Null 1132 } 1133 return out 1134 } 1135 1136 // nolint: vetshadow 1137 func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *FriendsConnection) graphql.Marshaler { 1138 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1139 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1140 rctx := &graphql.ResolverContext{ 1141 Object: "FriendsConnection", 1142 Args: nil, 1143 Field: field, 1144 } 1145 ctx = graphql.WithResolverContext(ctx, rctx) 1146 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1147 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1148 ctx = rctx // use context from middleware stack in children 1149 return obj.TotalCount(), nil 1150 }) 1151 if resTmp == nil { 1152 if !ec.HasError(rctx) { 1153 ec.Errorf(ctx, "must not be null") 1154 } 1155 return graphql.Null 1156 } 1157 res := resTmp.(int) 1158 rctx.Result = res 1159 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1160 return graphql.MarshalInt(res) 1161 } 1162 1163 // nolint: vetshadow 1164 func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *FriendsConnection) graphql.Marshaler { 1165 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1166 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1167 rctx := &graphql.ResolverContext{ 1168 Object: "FriendsConnection", 1169 Args: nil, 1170 Field: field, 1171 } 1172 ctx = graphql.WithResolverContext(ctx, rctx) 1173 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1174 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1175 ctx = rctx // use context from middleware stack in children 1176 return ec.resolvers.FriendsConnection().Edges(rctx, obj) 1177 }) 1178 if resTmp == nil { 1179 return graphql.Null 1180 } 1181 res := resTmp.([]FriendsEdge) 1182 rctx.Result = res 1183 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1184 1185 arr1 := make(graphql.Array, len(res)) 1186 var wg sync.WaitGroup 1187 1188 isLen1 := len(res) == 1 1189 if !isLen1 { 1190 wg.Add(len(res)) 1191 } 1192 1193 for idx1 := range res { 1194 idx1 := idx1 1195 rctx := &graphql.ResolverContext{ 1196 Index: &idx1, 1197 Result: &res[idx1], 1198 } 1199 ctx := graphql.WithResolverContext(ctx, rctx) 1200 f := func(idx1 int) { 1201 if !isLen1 { 1202 defer wg.Done() 1203 } 1204 arr1[idx1] = func() graphql.Marshaler { 1205 1206 return ec._FriendsEdge(ctx, field.Selections, &res[idx1]) 1207 }() 1208 } 1209 if isLen1 { 1210 f(idx1) 1211 } else { 1212 go f(idx1) 1213 } 1214 1215 } 1216 wg.Wait() 1217 return arr1 1218 } 1219 1220 // nolint: vetshadow 1221 func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *FriendsConnection) graphql.Marshaler { 1222 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1223 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1224 rctx := &graphql.ResolverContext{ 1225 Object: "FriendsConnection", 1226 Args: nil, 1227 Field: field, 1228 } 1229 ctx = graphql.WithResolverContext(ctx, rctx) 1230 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1231 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1232 ctx = rctx // use context from middleware stack in children 1233 return ec.resolvers.FriendsConnection().Friends(rctx, obj) 1234 }) 1235 if resTmp == nil { 1236 return graphql.Null 1237 } 1238 res := resTmp.([]Character) 1239 rctx.Result = res 1240 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1241 1242 arr1 := make(graphql.Array, len(res)) 1243 var wg sync.WaitGroup 1244 1245 isLen1 := len(res) == 1 1246 if !isLen1 { 1247 wg.Add(len(res)) 1248 } 1249 1250 for idx1 := range res { 1251 idx1 := idx1 1252 rctx := &graphql.ResolverContext{ 1253 Index: &idx1, 1254 Result: &res[idx1], 1255 } 1256 ctx := graphql.WithResolverContext(ctx, rctx) 1257 f := func(idx1 int) { 1258 if !isLen1 { 1259 defer wg.Done() 1260 } 1261 arr1[idx1] = func() graphql.Marshaler { 1262 1263 return ec._Character(ctx, field.Selections, &res[idx1]) 1264 }() 1265 } 1266 if isLen1 { 1267 f(idx1) 1268 } else { 1269 go f(idx1) 1270 } 1271 1272 } 1273 wg.Wait() 1274 return arr1 1275 } 1276 1277 // nolint: vetshadow 1278 func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *FriendsConnection) graphql.Marshaler { 1279 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1280 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1281 rctx := &graphql.ResolverContext{ 1282 Object: "FriendsConnection", 1283 Args: nil, 1284 Field: field, 1285 } 1286 ctx = graphql.WithResolverContext(ctx, rctx) 1287 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1288 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1289 ctx = rctx // use context from middleware stack in children 1290 return obj.PageInfo(), nil 1291 }) 1292 if resTmp == nil { 1293 if !ec.HasError(rctx) { 1294 ec.Errorf(ctx, "must not be null") 1295 } 1296 return graphql.Null 1297 } 1298 res := resTmp.(PageInfo) 1299 rctx.Result = res 1300 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1301 1302 return ec._PageInfo(ctx, field.Selections, &res) 1303 } 1304 1305 var friendsEdgeImplementors = []string{"FriendsEdge"} 1306 1307 // nolint: gocyclo, errcheck, gas, goconst 1308 func (ec *executionContext) _FriendsEdge(ctx context.Context, sel ast.SelectionSet, obj *FriendsEdge) graphql.Marshaler { 1309 fields := graphql.CollectFields(ctx, sel, friendsEdgeImplementors) 1310 1311 out := graphql.NewOrderedMap(len(fields)) 1312 invalid := false 1313 for i, field := range fields { 1314 out.Keys[i] = field.Alias 1315 1316 switch field.Name { 1317 case "__typename": 1318 out.Values[i] = graphql.MarshalString("FriendsEdge") 1319 case "cursor": 1320 out.Values[i] = ec._FriendsEdge_cursor(ctx, field, obj) 1321 if out.Values[i] == graphql.Null { 1322 invalid = true 1323 } 1324 case "node": 1325 out.Values[i] = ec._FriendsEdge_node(ctx, field, obj) 1326 default: 1327 panic("unknown field " + strconv.Quote(field.Name)) 1328 } 1329 } 1330 1331 if invalid { 1332 return graphql.Null 1333 } 1334 return out 1335 } 1336 1337 // nolint: vetshadow 1338 func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *FriendsEdge) graphql.Marshaler { 1339 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1340 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1341 rctx := &graphql.ResolverContext{ 1342 Object: "FriendsEdge", 1343 Args: nil, 1344 Field: field, 1345 } 1346 ctx = graphql.WithResolverContext(ctx, rctx) 1347 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1348 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1349 ctx = rctx // use context from middleware stack in children 1350 return obj.Cursor, nil 1351 }) 1352 if resTmp == nil { 1353 if !ec.HasError(rctx) { 1354 ec.Errorf(ctx, "must not be null") 1355 } 1356 return graphql.Null 1357 } 1358 res := resTmp.(string) 1359 rctx.Result = res 1360 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1361 return graphql.MarshalID(res) 1362 } 1363 1364 // nolint: vetshadow 1365 func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *FriendsEdge) graphql.Marshaler { 1366 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1367 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1368 rctx := &graphql.ResolverContext{ 1369 Object: "FriendsEdge", 1370 Args: nil, 1371 Field: field, 1372 } 1373 ctx = graphql.WithResolverContext(ctx, rctx) 1374 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1375 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1376 ctx = rctx // use context from middleware stack in children 1377 return obj.Node, nil 1378 }) 1379 if resTmp == nil { 1380 return graphql.Null 1381 } 1382 res := resTmp.(Character) 1383 rctx.Result = res 1384 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1385 1386 return ec._Character(ctx, field.Selections, &res) 1387 } 1388 1389 var humanImplementors = []string{"Human", "Character"} 1390 1391 // nolint: gocyclo, errcheck, gas, goconst 1392 func (ec *executionContext) _Human(ctx context.Context, sel ast.SelectionSet, obj *Human) graphql.Marshaler { 1393 fields := graphql.CollectFields(ctx, sel, humanImplementors) 1394 1395 var wg sync.WaitGroup 1396 out := graphql.NewOrderedMap(len(fields)) 1397 invalid := false 1398 for i, field := range fields { 1399 out.Keys[i] = field.Alias 1400 1401 switch field.Name { 1402 case "__typename": 1403 out.Values[i] = graphql.MarshalString("Human") 1404 case "id": 1405 out.Values[i] = ec._Human_id(ctx, field, obj) 1406 if out.Values[i] == graphql.Null { 1407 invalid = true 1408 } 1409 case "name": 1410 out.Values[i] = ec._Human_name(ctx, field, obj) 1411 if out.Values[i] == graphql.Null { 1412 invalid = true 1413 } 1414 case "height": 1415 out.Values[i] = ec._Human_height(ctx, field, obj) 1416 if out.Values[i] == graphql.Null { 1417 invalid = true 1418 } 1419 case "mass": 1420 out.Values[i] = ec._Human_mass(ctx, field, obj) 1421 case "friends": 1422 wg.Add(1) 1423 go func(i int, field graphql.CollectedField) { 1424 out.Values[i] = ec._Human_friends(ctx, field, obj) 1425 wg.Done() 1426 }(i, field) 1427 case "friendsConnection": 1428 wg.Add(1) 1429 go func(i int, field graphql.CollectedField) { 1430 out.Values[i] = ec._Human_friendsConnection(ctx, field, obj) 1431 if out.Values[i] == graphql.Null { 1432 invalid = true 1433 } 1434 wg.Done() 1435 }(i, field) 1436 case "appearsIn": 1437 out.Values[i] = ec._Human_appearsIn(ctx, field, obj) 1438 if out.Values[i] == graphql.Null { 1439 invalid = true 1440 } 1441 case "starships": 1442 wg.Add(1) 1443 go func(i int, field graphql.CollectedField) { 1444 out.Values[i] = ec._Human_starships(ctx, field, obj) 1445 wg.Done() 1446 }(i, field) 1447 default: 1448 panic("unknown field " + strconv.Quote(field.Name)) 1449 } 1450 } 1451 wg.Wait() 1452 if invalid { 1453 return graphql.Null 1454 } 1455 return out 1456 } 1457 1458 // nolint: vetshadow 1459 func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1460 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1461 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1462 rctx := &graphql.ResolverContext{ 1463 Object: "Human", 1464 Args: nil, 1465 Field: field, 1466 } 1467 ctx = graphql.WithResolverContext(ctx, rctx) 1468 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1469 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1470 ctx = rctx // use context from middleware stack in children 1471 return obj.ID, nil 1472 }) 1473 if resTmp == nil { 1474 if !ec.HasError(rctx) { 1475 ec.Errorf(ctx, "must not be null") 1476 } 1477 return graphql.Null 1478 } 1479 res := resTmp.(string) 1480 rctx.Result = res 1481 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1482 return graphql.MarshalID(res) 1483 } 1484 1485 // nolint: vetshadow 1486 func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1487 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1488 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1489 rctx := &graphql.ResolverContext{ 1490 Object: "Human", 1491 Args: nil, 1492 Field: field, 1493 } 1494 ctx = graphql.WithResolverContext(ctx, rctx) 1495 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1496 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1497 ctx = rctx // use context from middleware stack in children 1498 return obj.Name, nil 1499 }) 1500 if resTmp == nil { 1501 if !ec.HasError(rctx) { 1502 ec.Errorf(ctx, "must not be null") 1503 } 1504 return graphql.Null 1505 } 1506 res := resTmp.(string) 1507 rctx.Result = res 1508 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1509 return graphql.MarshalString(res) 1510 } 1511 1512 // nolint: vetshadow 1513 func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1514 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1515 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1516 rawArgs := field.ArgumentMap(ec.Variables) 1517 args, err := field_Human_height_args(rawArgs) 1518 if err != nil { 1519 ec.Error(ctx, err) 1520 return graphql.Null 1521 } 1522 rctx := &graphql.ResolverContext{ 1523 Object: "Human", 1524 Args: args, 1525 Field: field, 1526 } 1527 ctx = graphql.WithResolverContext(ctx, rctx) 1528 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1529 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1530 ctx = rctx // use context from middleware stack in children 1531 return obj.Height(args["unit"].(LengthUnit)), nil 1532 }) 1533 if resTmp == nil { 1534 if !ec.HasError(rctx) { 1535 ec.Errorf(ctx, "must not be null") 1536 } 1537 return graphql.Null 1538 } 1539 res := resTmp.(float64) 1540 rctx.Result = res 1541 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1542 return graphql.MarshalFloat(res) 1543 } 1544 1545 // nolint: vetshadow 1546 func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1547 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1548 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1549 rctx := &graphql.ResolverContext{ 1550 Object: "Human", 1551 Args: nil, 1552 Field: field, 1553 } 1554 ctx = graphql.WithResolverContext(ctx, rctx) 1555 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1556 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1557 ctx = rctx // use context from middleware stack in children 1558 return obj.Mass, nil 1559 }) 1560 if resTmp == nil { 1561 return graphql.Null 1562 } 1563 res := resTmp.(float64) 1564 rctx.Result = res 1565 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1566 return graphql.MarshalFloat(res) 1567 } 1568 1569 // nolint: vetshadow 1570 func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1571 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1572 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1573 rctx := &graphql.ResolverContext{ 1574 Object: "Human", 1575 Args: nil, 1576 Field: field, 1577 } 1578 ctx = graphql.WithResolverContext(ctx, rctx) 1579 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1580 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1581 ctx = rctx // use context from middleware stack in children 1582 return ec.resolvers.Human().Friends(rctx, obj) 1583 }) 1584 if resTmp == nil { 1585 return graphql.Null 1586 } 1587 res := resTmp.([]Character) 1588 rctx.Result = res 1589 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1590 1591 arr1 := make(graphql.Array, len(res)) 1592 var wg sync.WaitGroup 1593 1594 isLen1 := len(res) == 1 1595 if !isLen1 { 1596 wg.Add(len(res)) 1597 } 1598 1599 for idx1 := range res { 1600 idx1 := idx1 1601 rctx := &graphql.ResolverContext{ 1602 Index: &idx1, 1603 Result: &res[idx1], 1604 } 1605 ctx := graphql.WithResolverContext(ctx, rctx) 1606 f := func(idx1 int) { 1607 if !isLen1 { 1608 defer wg.Done() 1609 } 1610 arr1[idx1] = func() graphql.Marshaler { 1611 1612 return ec._Character(ctx, field.Selections, &res[idx1]) 1613 }() 1614 } 1615 if isLen1 { 1616 f(idx1) 1617 } else { 1618 go f(idx1) 1619 } 1620 1621 } 1622 wg.Wait() 1623 return arr1 1624 } 1625 1626 // nolint: vetshadow 1627 func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1628 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1629 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1630 rawArgs := field.ArgumentMap(ec.Variables) 1631 args, err := field_Human_friendsConnection_args(rawArgs) 1632 if err != nil { 1633 ec.Error(ctx, err) 1634 return graphql.Null 1635 } 1636 rctx := &graphql.ResolverContext{ 1637 Object: "Human", 1638 Args: args, 1639 Field: field, 1640 } 1641 ctx = graphql.WithResolverContext(ctx, rctx) 1642 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1643 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1644 ctx = rctx // use context from middleware stack in children 1645 return ec.resolvers.Human().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) 1646 }) 1647 if resTmp == nil { 1648 if !ec.HasError(rctx) { 1649 ec.Errorf(ctx, "must not be null") 1650 } 1651 return graphql.Null 1652 } 1653 res := resTmp.(FriendsConnection) 1654 rctx.Result = res 1655 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1656 1657 return ec._FriendsConnection(ctx, field.Selections, &res) 1658 } 1659 1660 // nolint: vetshadow 1661 func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1662 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1663 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1664 rctx := &graphql.ResolverContext{ 1665 Object: "Human", 1666 Args: nil, 1667 Field: field, 1668 } 1669 ctx = graphql.WithResolverContext(ctx, rctx) 1670 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1671 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1672 ctx = rctx // use context from middleware stack in children 1673 return obj.AppearsIn, nil 1674 }) 1675 if resTmp == nil { 1676 if !ec.HasError(rctx) { 1677 ec.Errorf(ctx, "must not be null") 1678 } 1679 return graphql.Null 1680 } 1681 res := resTmp.([]Episode) 1682 rctx.Result = res 1683 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1684 1685 arr1 := make(graphql.Array, len(res)) 1686 1687 for idx1 := range res { 1688 arr1[idx1] = func() graphql.Marshaler { 1689 return res[idx1] 1690 }() 1691 } 1692 1693 return arr1 1694 } 1695 1696 // nolint: vetshadow 1697 func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *Human) graphql.Marshaler { 1698 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1699 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1700 rctx := &graphql.ResolverContext{ 1701 Object: "Human", 1702 Args: nil, 1703 Field: field, 1704 } 1705 ctx = graphql.WithResolverContext(ctx, rctx) 1706 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1707 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1708 ctx = rctx // use context from middleware stack in children 1709 return ec.resolvers.Human().Starships(rctx, obj) 1710 }) 1711 if resTmp == nil { 1712 return graphql.Null 1713 } 1714 res := resTmp.([]Starship) 1715 rctx.Result = res 1716 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1717 1718 arr1 := make(graphql.Array, len(res)) 1719 var wg sync.WaitGroup 1720 1721 isLen1 := len(res) == 1 1722 if !isLen1 { 1723 wg.Add(len(res)) 1724 } 1725 1726 for idx1 := range res { 1727 idx1 := idx1 1728 rctx := &graphql.ResolverContext{ 1729 Index: &idx1, 1730 Result: &res[idx1], 1731 } 1732 ctx := graphql.WithResolverContext(ctx, rctx) 1733 f := func(idx1 int) { 1734 if !isLen1 { 1735 defer wg.Done() 1736 } 1737 arr1[idx1] = func() graphql.Marshaler { 1738 1739 return ec._Starship(ctx, field.Selections, &res[idx1]) 1740 }() 1741 } 1742 if isLen1 { 1743 f(idx1) 1744 } else { 1745 go f(idx1) 1746 } 1747 1748 } 1749 wg.Wait() 1750 return arr1 1751 } 1752 1753 var mutationImplementors = []string{"Mutation"} 1754 1755 // nolint: gocyclo, errcheck, gas, goconst 1756 func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 1757 fields := graphql.CollectFields(ctx, sel, mutationImplementors) 1758 1759 ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ 1760 Object: "Mutation", 1761 }) 1762 1763 out := graphql.NewOrderedMap(len(fields)) 1764 invalid := false 1765 for i, field := range fields { 1766 out.Keys[i] = field.Alias 1767 1768 switch field.Name { 1769 case "__typename": 1770 out.Values[i] = graphql.MarshalString("Mutation") 1771 case "createReview": 1772 out.Values[i] = ec._Mutation_createReview(ctx, field) 1773 default: 1774 panic("unknown field " + strconv.Quote(field.Name)) 1775 } 1776 } 1777 1778 if invalid { 1779 return graphql.Null 1780 } 1781 return out 1782 } 1783 1784 // nolint: vetshadow 1785 func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 1786 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1787 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1788 rawArgs := field.ArgumentMap(ec.Variables) 1789 args, err := field_Mutation_createReview_args(rawArgs) 1790 if err != nil { 1791 ec.Error(ctx, err) 1792 return graphql.Null 1793 } 1794 rctx := &graphql.ResolverContext{ 1795 Object: "Mutation", 1796 Args: args, 1797 Field: field, 1798 } 1799 ctx = graphql.WithResolverContext(ctx, rctx) 1800 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1801 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 1802 ctx = rctx // use context from middleware stack in children 1803 return ec.resolvers.Mutation().CreateReview(rctx, args["episode"].(Episode), args["review"].(Review)) 1804 }) 1805 if resTmp == nil { 1806 return graphql.Null 1807 } 1808 res := resTmp.(*Review) 1809 rctx.Result = res 1810 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1811 1812 if res == nil { 1813 return graphql.Null 1814 } 1815 1816 return ec._Review(ctx, field.Selections, res) 1817 } 1818 1819 var pageInfoImplementors = []string{"PageInfo"} 1820 1821 // nolint: gocyclo, errcheck, gas, goconst 1822 func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *PageInfo) graphql.Marshaler { 1823 fields := graphql.CollectFields(ctx, sel, pageInfoImplementors) 1824 1825 out := graphql.NewOrderedMap(len(fields)) 1826 invalid := false 1827 for i, field := range fields { 1828 out.Keys[i] = field.Alias 1829 1830 switch field.Name { 1831 case "__typename": 1832 out.Values[i] = graphql.MarshalString("PageInfo") 1833 case "startCursor": 1834 out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) 1835 if out.Values[i] == graphql.Null { 1836 invalid = true 1837 } 1838 case "endCursor": 1839 out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) 1840 if out.Values[i] == graphql.Null { 1841 invalid = true 1842 } 1843 case "hasNextPage": 1844 out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) 1845 if out.Values[i] == graphql.Null { 1846 invalid = true 1847 } 1848 default: 1849 panic("unknown field " + strconv.Quote(field.Name)) 1850 } 1851 } 1852 1853 if invalid { 1854 return graphql.Null 1855 } 1856 return out 1857 } 1858 1859 // nolint: vetshadow 1860 func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *PageInfo) graphql.Marshaler { 1861 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1862 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1863 rctx := &graphql.ResolverContext{ 1864 Object: "PageInfo", 1865 Args: nil, 1866 Field: field, 1867 } 1868 ctx = graphql.WithResolverContext(ctx, rctx) 1869 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1870 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1871 ctx = rctx // use context from middleware stack in children 1872 return obj.StartCursor, nil 1873 }) 1874 if resTmp == nil { 1875 if !ec.HasError(rctx) { 1876 ec.Errorf(ctx, "must not be null") 1877 } 1878 return graphql.Null 1879 } 1880 res := resTmp.(string) 1881 rctx.Result = res 1882 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1883 return graphql.MarshalID(res) 1884 } 1885 1886 // nolint: vetshadow 1887 func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *PageInfo) graphql.Marshaler { 1888 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1889 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1890 rctx := &graphql.ResolverContext{ 1891 Object: "PageInfo", 1892 Args: nil, 1893 Field: field, 1894 } 1895 ctx = graphql.WithResolverContext(ctx, rctx) 1896 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1897 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1898 ctx = rctx // use context from middleware stack in children 1899 return obj.EndCursor, nil 1900 }) 1901 if resTmp == nil { 1902 if !ec.HasError(rctx) { 1903 ec.Errorf(ctx, "must not be null") 1904 } 1905 return graphql.Null 1906 } 1907 res := resTmp.(string) 1908 rctx.Result = res 1909 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1910 return graphql.MarshalID(res) 1911 } 1912 1913 // nolint: vetshadow 1914 func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *PageInfo) graphql.Marshaler { 1915 ctx = ec.Tracer.StartFieldExecution(ctx, field) 1916 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 1917 rctx := &graphql.ResolverContext{ 1918 Object: "PageInfo", 1919 Args: nil, 1920 Field: field, 1921 } 1922 ctx = graphql.WithResolverContext(ctx, rctx) 1923 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 1924 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1925 ctx = rctx // use context from middleware stack in children 1926 return obj.HasNextPage, nil 1927 }) 1928 if resTmp == nil { 1929 if !ec.HasError(rctx) { 1930 ec.Errorf(ctx, "must not be null") 1931 } 1932 return graphql.Null 1933 } 1934 res := resTmp.(bool) 1935 rctx.Result = res 1936 ctx = ec.Tracer.StartFieldChildExecution(ctx) 1937 return graphql.MarshalBoolean(res) 1938 } 1939 1940 var queryImplementors = []string{"Query"} 1941 1942 // nolint: gocyclo, errcheck, gas, goconst 1943 func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 1944 fields := graphql.CollectFields(ctx, sel, queryImplementors) 1945 1946 ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ 1947 Object: "Query", 1948 }) 1949 1950 var wg sync.WaitGroup 1951 out := graphql.NewOrderedMap(len(fields)) 1952 invalid := false 1953 for i, field := range fields { 1954 out.Keys[i] = field.Alias 1955 1956 switch field.Name { 1957 case "__typename": 1958 out.Values[i] = graphql.MarshalString("Query") 1959 case "hero": 1960 wg.Add(1) 1961 go func(i int, field graphql.CollectedField) { 1962 out.Values[i] = ec._Query_hero(ctx, field) 1963 wg.Done() 1964 }(i, field) 1965 case "reviews": 1966 wg.Add(1) 1967 go func(i int, field graphql.CollectedField) { 1968 out.Values[i] = ec._Query_reviews(ctx, field) 1969 if out.Values[i] == graphql.Null { 1970 invalid = true 1971 } 1972 wg.Done() 1973 }(i, field) 1974 case "search": 1975 wg.Add(1) 1976 go func(i int, field graphql.CollectedField) { 1977 out.Values[i] = ec._Query_search(ctx, field) 1978 if out.Values[i] == graphql.Null { 1979 invalid = true 1980 } 1981 wg.Done() 1982 }(i, field) 1983 case "character": 1984 wg.Add(1) 1985 go func(i int, field graphql.CollectedField) { 1986 out.Values[i] = ec._Query_character(ctx, field) 1987 wg.Done() 1988 }(i, field) 1989 case "droid": 1990 wg.Add(1) 1991 go func(i int, field graphql.CollectedField) { 1992 out.Values[i] = ec._Query_droid(ctx, field) 1993 wg.Done() 1994 }(i, field) 1995 case "human": 1996 wg.Add(1) 1997 go func(i int, field graphql.CollectedField) { 1998 out.Values[i] = ec._Query_human(ctx, field) 1999 wg.Done() 2000 }(i, field) 2001 case "starship": 2002 wg.Add(1) 2003 go func(i int, field graphql.CollectedField) { 2004 out.Values[i] = ec._Query_starship(ctx, field) 2005 wg.Done() 2006 }(i, field) 2007 case "__type": 2008 out.Values[i] = ec._Query___type(ctx, field) 2009 case "__schema": 2010 out.Values[i] = ec._Query___schema(ctx, field) 2011 default: 2012 panic("unknown field " + strconv.Quote(field.Name)) 2013 } 2014 } 2015 wg.Wait() 2016 if invalid { 2017 return graphql.Null 2018 } 2019 return out 2020 } 2021 2022 // nolint: vetshadow 2023 func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2024 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2025 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2026 rawArgs := field.ArgumentMap(ec.Variables) 2027 args, err := field_Query_hero_args(rawArgs) 2028 if err != nil { 2029 ec.Error(ctx, err) 2030 return graphql.Null 2031 } 2032 rctx := &graphql.ResolverContext{ 2033 Object: "Query", 2034 Args: args, 2035 Field: field, 2036 } 2037 ctx = graphql.WithResolverContext(ctx, rctx) 2038 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2039 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2040 ctx = rctx // use context from middleware stack in children 2041 return ec.resolvers.Query().Hero(rctx, args["episode"].(*Episode)) 2042 }) 2043 if resTmp == nil { 2044 return graphql.Null 2045 } 2046 res := resTmp.(Character) 2047 rctx.Result = res 2048 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2049 2050 return ec._Character(ctx, field.Selections, &res) 2051 } 2052 2053 // nolint: vetshadow 2054 func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2055 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2056 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2057 rawArgs := field.ArgumentMap(ec.Variables) 2058 args, err := field_Query_reviews_args(rawArgs) 2059 if err != nil { 2060 ec.Error(ctx, err) 2061 return graphql.Null 2062 } 2063 rctx := &graphql.ResolverContext{ 2064 Object: "Query", 2065 Args: args, 2066 Field: field, 2067 } 2068 ctx = graphql.WithResolverContext(ctx, rctx) 2069 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2070 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2071 ctx = rctx // use context from middleware stack in children 2072 return ec.resolvers.Query().Reviews(rctx, args["episode"].(Episode), args["since"].(*time.Time)) 2073 }) 2074 if resTmp == nil { 2075 if !ec.HasError(rctx) { 2076 ec.Errorf(ctx, "must not be null") 2077 } 2078 return graphql.Null 2079 } 2080 res := resTmp.([]Review) 2081 rctx.Result = res 2082 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2083 2084 arr1 := make(graphql.Array, len(res)) 2085 var wg sync.WaitGroup 2086 2087 isLen1 := len(res) == 1 2088 if !isLen1 { 2089 wg.Add(len(res)) 2090 } 2091 2092 for idx1 := range res { 2093 idx1 := idx1 2094 rctx := &graphql.ResolverContext{ 2095 Index: &idx1, 2096 Result: &res[idx1], 2097 } 2098 ctx := graphql.WithResolverContext(ctx, rctx) 2099 f := func(idx1 int) { 2100 if !isLen1 { 2101 defer wg.Done() 2102 } 2103 arr1[idx1] = func() graphql.Marshaler { 2104 2105 return ec._Review(ctx, field.Selections, &res[idx1]) 2106 }() 2107 } 2108 if isLen1 { 2109 f(idx1) 2110 } else { 2111 go f(idx1) 2112 } 2113 2114 } 2115 wg.Wait() 2116 return arr1 2117 } 2118 2119 // nolint: vetshadow 2120 func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2121 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2122 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2123 rawArgs := field.ArgumentMap(ec.Variables) 2124 args, err := field_Query_search_args(rawArgs) 2125 if err != nil { 2126 ec.Error(ctx, err) 2127 return graphql.Null 2128 } 2129 rctx := &graphql.ResolverContext{ 2130 Object: "Query", 2131 Args: args, 2132 Field: field, 2133 } 2134 ctx = graphql.WithResolverContext(ctx, rctx) 2135 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2136 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2137 ctx = rctx // use context from middleware stack in children 2138 return ec.resolvers.Query().Search(rctx, args["text"].(string)) 2139 }) 2140 if resTmp == nil { 2141 if !ec.HasError(rctx) { 2142 ec.Errorf(ctx, "must not be null") 2143 } 2144 return graphql.Null 2145 } 2146 res := resTmp.([]SearchResult) 2147 rctx.Result = res 2148 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2149 2150 arr1 := make(graphql.Array, len(res)) 2151 var wg sync.WaitGroup 2152 2153 isLen1 := len(res) == 1 2154 if !isLen1 { 2155 wg.Add(len(res)) 2156 } 2157 2158 for idx1 := range res { 2159 idx1 := idx1 2160 rctx := &graphql.ResolverContext{ 2161 Index: &idx1, 2162 Result: &res[idx1], 2163 } 2164 ctx := graphql.WithResolverContext(ctx, rctx) 2165 f := func(idx1 int) { 2166 if !isLen1 { 2167 defer wg.Done() 2168 } 2169 arr1[idx1] = func() graphql.Marshaler { 2170 2171 return ec._SearchResult(ctx, field.Selections, &res[idx1]) 2172 }() 2173 } 2174 if isLen1 { 2175 f(idx1) 2176 } else { 2177 go f(idx1) 2178 } 2179 2180 } 2181 wg.Wait() 2182 return arr1 2183 } 2184 2185 // nolint: vetshadow 2186 func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2187 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2188 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2189 rawArgs := field.ArgumentMap(ec.Variables) 2190 args, err := field_Query_character_args(rawArgs) 2191 if err != nil { 2192 ec.Error(ctx, err) 2193 return graphql.Null 2194 } 2195 rctx := &graphql.ResolverContext{ 2196 Object: "Query", 2197 Args: args, 2198 Field: field, 2199 } 2200 ctx = graphql.WithResolverContext(ctx, rctx) 2201 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2202 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2203 ctx = rctx // use context from middleware stack in children 2204 return ec.resolvers.Query().Character(rctx, args["id"].(string)) 2205 }) 2206 if resTmp == nil { 2207 return graphql.Null 2208 } 2209 res := resTmp.(Character) 2210 rctx.Result = res 2211 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2212 2213 return ec._Character(ctx, field.Selections, &res) 2214 } 2215 2216 // nolint: vetshadow 2217 func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2218 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2219 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2220 rawArgs := field.ArgumentMap(ec.Variables) 2221 args, err := field_Query_droid_args(rawArgs) 2222 if err != nil { 2223 ec.Error(ctx, err) 2224 return graphql.Null 2225 } 2226 rctx := &graphql.ResolverContext{ 2227 Object: "Query", 2228 Args: args, 2229 Field: field, 2230 } 2231 ctx = graphql.WithResolverContext(ctx, rctx) 2232 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2233 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2234 ctx = rctx // use context from middleware stack in children 2235 return ec.resolvers.Query().Droid(rctx, args["id"].(string)) 2236 }) 2237 if resTmp == nil { 2238 return graphql.Null 2239 } 2240 res := resTmp.(*Droid) 2241 rctx.Result = res 2242 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2243 2244 if res == nil { 2245 return graphql.Null 2246 } 2247 2248 return ec._Droid(ctx, field.Selections, res) 2249 } 2250 2251 // nolint: vetshadow 2252 func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2253 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2254 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2255 rawArgs := field.ArgumentMap(ec.Variables) 2256 args, err := field_Query_human_args(rawArgs) 2257 if err != nil { 2258 ec.Error(ctx, err) 2259 return graphql.Null 2260 } 2261 rctx := &graphql.ResolverContext{ 2262 Object: "Query", 2263 Args: args, 2264 Field: field, 2265 } 2266 ctx = graphql.WithResolverContext(ctx, rctx) 2267 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2268 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2269 ctx = rctx // use context from middleware stack in children 2270 return ec.resolvers.Query().Human(rctx, args["id"].(string)) 2271 }) 2272 if resTmp == nil { 2273 return graphql.Null 2274 } 2275 res := resTmp.(*Human) 2276 rctx.Result = res 2277 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2278 2279 if res == nil { 2280 return graphql.Null 2281 } 2282 2283 return ec._Human(ctx, field.Selections, res) 2284 } 2285 2286 // nolint: vetshadow 2287 func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2288 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2289 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2290 rawArgs := field.ArgumentMap(ec.Variables) 2291 args, err := field_Query_starship_args(rawArgs) 2292 if err != nil { 2293 ec.Error(ctx, err) 2294 return graphql.Null 2295 } 2296 rctx := &graphql.ResolverContext{ 2297 Object: "Query", 2298 Args: args, 2299 Field: field, 2300 } 2301 ctx = graphql.WithResolverContext(ctx, rctx) 2302 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2303 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2304 ctx = rctx // use context from middleware stack in children 2305 return ec.resolvers.Query().Starship(rctx, args["id"].(string)) 2306 }) 2307 if resTmp == nil { 2308 return graphql.Null 2309 } 2310 res := resTmp.(*Starship) 2311 rctx.Result = res 2312 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2313 2314 if res == nil { 2315 return graphql.Null 2316 } 2317 2318 return ec._Starship(ctx, field.Selections, res) 2319 } 2320 2321 // nolint: vetshadow 2322 func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2323 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2324 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2325 rawArgs := field.ArgumentMap(ec.Variables) 2326 args, err := field_Query___type_args(rawArgs) 2327 if err != nil { 2328 ec.Error(ctx, err) 2329 return graphql.Null 2330 } 2331 rctx := &graphql.ResolverContext{ 2332 Object: "Query", 2333 Args: args, 2334 Field: field, 2335 } 2336 ctx = graphql.WithResolverContext(ctx, rctx) 2337 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2338 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2339 ctx = rctx // use context from middleware stack in children 2340 return ec.introspectType(args["name"].(string)) 2341 }) 2342 if resTmp == nil { 2343 return graphql.Null 2344 } 2345 res := resTmp.(*introspection.Type) 2346 rctx.Result = res 2347 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2348 2349 if res == nil { 2350 return graphql.Null 2351 } 2352 2353 return ec.___Type(ctx, field.Selections, res) 2354 } 2355 2356 // nolint: vetshadow 2357 func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 2358 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2359 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2360 rctx := &graphql.ResolverContext{ 2361 Object: "Query", 2362 Args: nil, 2363 Field: field, 2364 } 2365 ctx = graphql.WithResolverContext(ctx, rctx) 2366 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2367 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 2368 ctx = rctx // use context from middleware stack in children 2369 return ec.introspectSchema() 2370 }) 2371 if resTmp == nil { 2372 return graphql.Null 2373 } 2374 res := resTmp.(*introspection.Schema) 2375 rctx.Result = res 2376 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2377 2378 if res == nil { 2379 return graphql.Null 2380 } 2381 2382 return ec.___Schema(ctx, field.Selections, res) 2383 } 2384 2385 var reviewImplementors = []string{"Review"} 2386 2387 // nolint: gocyclo, errcheck, gas, goconst 2388 func (ec *executionContext) _Review(ctx context.Context, sel ast.SelectionSet, obj *Review) graphql.Marshaler { 2389 fields := graphql.CollectFields(ctx, sel, reviewImplementors) 2390 2391 out := graphql.NewOrderedMap(len(fields)) 2392 invalid := false 2393 for i, field := range fields { 2394 out.Keys[i] = field.Alias 2395 2396 switch field.Name { 2397 case "__typename": 2398 out.Values[i] = graphql.MarshalString("Review") 2399 case "stars": 2400 out.Values[i] = ec._Review_stars(ctx, field, obj) 2401 if out.Values[i] == graphql.Null { 2402 invalid = true 2403 } 2404 case "commentary": 2405 out.Values[i] = ec._Review_commentary(ctx, field, obj) 2406 case "time": 2407 out.Values[i] = ec._Review_time(ctx, field, obj) 2408 default: 2409 panic("unknown field " + strconv.Quote(field.Name)) 2410 } 2411 } 2412 2413 if invalid { 2414 return graphql.Null 2415 } 2416 return out 2417 } 2418 2419 // nolint: vetshadow 2420 func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *Review) graphql.Marshaler { 2421 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2422 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2423 rctx := &graphql.ResolverContext{ 2424 Object: "Review", 2425 Args: nil, 2426 Field: field, 2427 } 2428 ctx = graphql.WithResolverContext(ctx, rctx) 2429 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2430 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2431 ctx = rctx // use context from middleware stack in children 2432 return obj.Stars, nil 2433 }) 2434 if resTmp == nil { 2435 if !ec.HasError(rctx) { 2436 ec.Errorf(ctx, "must not be null") 2437 } 2438 return graphql.Null 2439 } 2440 res := resTmp.(int) 2441 rctx.Result = res 2442 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2443 return graphql.MarshalInt(res) 2444 } 2445 2446 // nolint: vetshadow 2447 func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *Review) graphql.Marshaler { 2448 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2449 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2450 rctx := &graphql.ResolverContext{ 2451 Object: "Review", 2452 Args: nil, 2453 Field: field, 2454 } 2455 ctx = graphql.WithResolverContext(ctx, rctx) 2456 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2457 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2458 ctx = rctx // use context from middleware stack in children 2459 return obj.Commentary, nil 2460 }) 2461 if resTmp == nil { 2462 return graphql.Null 2463 } 2464 res := resTmp.(*string) 2465 rctx.Result = res 2466 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2467 2468 if res == nil { 2469 return graphql.Null 2470 } 2471 return graphql.MarshalString(*res) 2472 } 2473 2474 // nolint: vetshadow 2475 func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *Review) graphql.Marshaler { 2476 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2477 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2478 rctx := &graphql.ResolverContext{ 2479 Object: "Review", 2480 Args: nil, 2481 Field: field, 2482 } 2483 ctx = graphql.WithResolverContext(ctx, rctx) 2484 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2485 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2486 ctx = rctx // use context from middleware stack in children 2487 return obj.Time, nil 2488 }) 2489 if resTmp == nil { 2490 return graphql.Null 2491 } 2492 res := resTmp.(time.Time) 2493 rctx.Result = res 2494 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2495 return graphql.MarshalTime(res) 2496 } 2497 2498 var starshipImplementors = []string{"Starship"} 2499 2500 // nolint: gocyclo, errcheck, gas, goconst 2501 func (ec *executionContext) _Starship(ctx context.Context, sel ast.SelectionSet, obj *Starship) graphql.Marshaler { 2502 fields := graphql.CollectFields(ctx, sel, starshipImplementors) 2503 2504 var wg sync.WaitGroup 2505 out := graphql.NewOrderedMap(len(fields)) 2506 invalid := false 2507 for i, field := range fields { 2508 out.Keys[i] = field.Alias 2509 2510 switch field.Name { 2511 case "__typename": 2512 out.Values[i] = graphql.MarshalString("Starship") 2513 case "id": 2514 out.Values[i] = ec._Starship_id(ctx, field, obj) 2515 if out.Values[i] == graphql.Null { 2516 invalid = true 2517 } 2518 case "name": 2519 out.Values[i] = ec._Starship_name(ctx, field, obj) 2520 if out.Values[i] == graphql.Null { 2521 invalid = true 2522 } 2523 case "length": 2524 wg.Add(1) 2525 go func(i int, field graphql.CollectedField) { 2526 out.Values[i] = ec._Starship_length(ctx, field, obj) 2527 if out.Values[i] == graphql.Null { 2528 invalid = true 2529 } 2530 wg.Done() 2531 }(i, field) 2532 case "history": 2533 out.Values[i] = ec._Starship_history(ctx, field, obj) 2534 if out.Values[i] == graphql.Null { 2535 invalid = true 2536 } 2537 default: 2538 panic("unknown field " + strconv.Quote(field.Name)) 2539 } 2540 } 2541 wg.Wait() 2542 if invalid { 2543 return graphql.Null 2544 } 2545 return out 2546 } 2547 2548 // nolint: vetshadow 2549 func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *Starship) graphql.Marshaler { 2550 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2551 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2552 rctx := &graphql.ResolverContext{ 2553 Object: "Starship", 2554 Args: nil, 2555 Field: field, 2556 } 2557 ctx = graphql.WithResolverContext(ctx, rctx) 2558 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2559 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2560 ctx = rctx // use context from middleware stack in children 2561 return obj.ID, nil 2562 }) 2563 if resTmp == nil { 2564 if !ec.HasError(rctx) { 2565 ec.Errorf(ctx, "must not be null") 2566 } 2567 return graphql.Null 2568 } 2569 res := resTmp.(string) 2570 rctx.Result = res 2571 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2572 return graphql.MarshalID(res) 2573 } 2574 2575 // nolint: vetshadow 2576 func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *Starship) graphql.Marshaler { 2577 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2578 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2579 rctx := &graphql.ResolverContext{ 2580 Object: "Starship", 2581 Args: nil, 2582 Field: field, 2583 } 2584 ctx = graphql.WithResolverContext(ctx, rctx) 2585 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2586 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2587 ctx = rctx // use context from middleware stack in children 2588 return obj.Name, nil 2589 }) 2590 if resTmp == nil { 2591 if !ec.HasError(rctx) { 2592 ec.Errorf(ctx, "must not be null") 2593 } 2594 return graphql.Null 2595 } 2596 res := resTmp.(string) 2597 rctx.Result = res 2598 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2599 return graphql.MarshalString(res) 2600 } 2601 2602 // nolint: vetshadow 2603 func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *Starship) graphql.Marshaler { 2604 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2605 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2606 rawArgs := field.ArgumentMap(ec.Variables) 2607 args, err := field_Starship_length_args(rawArgs) 2608 if err != nil { 2609 ec.Error(ctx, err) 2610 return graphql.Null 2611 } 2612 rctx := &graphql.ResolverContext{ 2613 Object: "Starship", 2614 Args: args, 2615 Field: field, 2616 } 2617 ctx = graphql.WithResolverContext(ctx, rctx) 2618 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2619 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2620 ctx = rctx // use context from middleware stack in children 2621 return ec.resolvers.Starship().Length(rctx, obj, args["unit"].(*LengthUnit)) 2622 }) 2623 if resTmp == nil { 2624 if !ec.HasError(rctx) { 2625 ec.Errorf(ctx, "must not be null") 2626 } 2627 return graphql.Null 2628 } 2629 res := resTmp.(float64) 2630 rctx.Result = res 2631 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2632 return graphql.MarshalFloat(res) 2633 } 2634 2635 // nolint: vetshadow 2636 func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *Starship) graphql.Marshaler { 2637 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2638 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2639 rctx := &graphql.ResolverContext{ 2640 Object: "Starship", 2641 Args: nil, 2642 Field: field, 2643 } 2644 ctx = graphql.WithResolverContext(ctx, rctx) 2645 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2646 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2647 ctx = rctx // use context from middleware stack in children 2648 return obj.History, nil 2649 }) 2650 if resTmp == nil { 2651 if !ec.HasError(rctx) { 2652 ec.Errorf(ctx, "must not be null") 2653 } 2654 return graphql.Null 2655 } 2656 res := resTmp.([][]int) 2657 rctx.Result = res 2658 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2659 2660 arr1 := make(graphql.Array, len(res)) 2661 2662 for idx1 := range res { 2663 arr1[idx1] = func() graphql.Marshaler { 2664 2665 arr2 := make(graphql.Array, len(res[idx1])) 2666 2667 for idx2 := range res[idx1] { 2668 arr2[idx2] = func() graphql.Marshaler { 2669 return graphql.MarshalInt(res[idx1][idx2]) 2670 }() 2671 } 2672 2673 return arr2 2674 }() 2675 } 2676 2677 return arr1 2678 } 2679 2680 var __DirectiveImplementors = []string{"__Directive"} 2681 2682 // nolint: gocyclo, errcheck, gas, goconst 2683 func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { 2684 fields := graphql.CollectFields(ctx, sel, __DirectiveImplementors) 2685 2686 out := graphql.NewOrderedMap(len(fields)) 2687 invalid := false 2688 for i, field := range fields { 2689 out.Keys[i] = field.Alias 2690 2691 switch field.Name { 2692 case "__typename": 2693 out.Values[i] = graphql.MarshalString("__Directive") 2694 case "name": 2695 out.Values[i] = ec.___Directive_name(ctx, field, obj) 2696 if out.Values[i] == graphql.Null { 2697 invalid = true 2698 } 2699 case "description": 2700 out.Values[i] = ec.___Directive_description(ctx, field, obj) 2701 case "locations": 2702 out.Values[i] = ec.___Directive_locations(ctx, field, obj) 2703 if out.Values[i] == graphql.Null { 2704 invalid = true 2705 } 2706 case "args": 2707 out.Values[i] = ec.___Directive_args(ctx, field, obj) 2708 if out.Values[i] == graphql.Null { 2709 invalid = true 2710 } 2711 default: 2712 panic("unknown field " + strconv.Quote(field.Name)) 2713 } 2714 } 2715 2716 if invalid { 2717 return graphql.Null 2718 } 2719 return out 2720 } 2721 2722 // nolint: vetshadow 2723 func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 2724 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2725 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2726 rctx := &graphql.ResolverContext{ 2727 Object: "__Directive", 2728 Args: nil, 2729 Field: field, 2730 } 2731 ctx = graphql.WithResolverContext(ctx, rctx) 2732 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2733 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2734 ctx = rctx // use context from middleware stack in children 2735 return obj.Name, nil 2736 }) 2737 if resTmp == nil { 2738 if !ec.HasError(rctx) { 2739 ec.Errorf(ctx, "must not be null") 2740 } 2741 return graphql.Null 2742 } 2743 res := resTmp.(string) 2744 rctx.Result = res 2745 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2746 return graphql.MarshalString(res) 2747 } 2748 2749 // nolint: vetshadow 2750 func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 2751 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2752 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2753 rctx := &graphql.ResolverContext{ 2754 Object: "__Directive", 2755 Args: nil, 2756 Field: field, 2757 } 2758 ctx = graphql.WithResolverContext(ctx, rctx) 2759 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2760 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2761 ctx = rctx // use context from middleware stack in children 2762 return obj.Description, nil 2763 }) 2764 if resTmp == nil { 2765 return graphql.Null 2766 } 2767 res := resTmp.(string) 2768 rctx.Result = res 2769 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2770 return graphql.MarshalString(res) 2771 } 2772 2773 // nolint: vetshadow 2774 func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 2775 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2776 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2777 rctx := &graphql.ResolverContext{ 2778 Object: "__Directive", 2779 Args: nil, 2780 Field: field, 2781 } 2782 ctx = graphql.WithResolverContext(ctx, rctx) 2783 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2784 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2785 ctx = rctx // use context from middleware stack in children 2786 return obj.Locations, nil 2787 }) 2788 if resTmp == nil { 2789 if !ec.HasError(rctx) { 2790 ec.Errorf(ctx, "must not be null") 2791 } 2792 return graphql.Null 2793 } 2794 res := resTmp.([]string) 2795 rctx.Result = res 2796 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2797 2798 arr1 := make(graphql.Array, len(res)) 2799 2800 for idx1 := range res { 2801 arr1[idx1] = func() graphql.Marshaler { 2802 return graphql.MarshalString(res[idx1]) 2803 }() 2804 } 2805 2806 return arr1 2807 } 2808 2809 // nolint: vetshadow 2810 func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 2811 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2812 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2813 rctx := &graphql.ResolverContext{ 2814 Object: "__Directive", 2815 Args: nil, 2816 Field: field, 2817 } 2818 ctx = graphql.WithResolverContext(ctx, rctx) 2819 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2820 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2821 ctx = rctx // use context from middleware stack in children 2822 return obj.Args, nil 2823 }) 2824 if resTmp == nil { 2825 if !ec.HasError(rctx) { 2826 ec.Errorf(ctx, "must not be null") 2827 } 2828 return graphql.Null 2829 } 2830 res := resTmp.([]introspection.InputValue) 2831 rctx.Result = res 2832 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2833 2834 arr1 := make(graphql.Array, len(res)) 2835 var wg sync.WaitGroup 2836 2837 isLen1 := len(res) == 1 2838 if !isLen1 { 2839 wg.Add(len(res)) 2840 } 2841 2842 for idx1 := range res { 2843 idx1 := idx1 2844 rctx := &graphql.ResolverContext{ 2845 Index: &idx1, 2846 Result: &res[idx1], 2847 } 2848 ctx := graphql.WithResolverContext(ctx, rctx) 2849 f := func(idx1 int) { 2850 if !isLen1 { 2851 defer wg.Done() 2852 } 2853 arr1[idx1] = func() graphql.Marshaler { 2854 2855 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 2856 }() 2857 } 2858 if isLen1 { 2859 f(idx1) 2860 } else { 2861 go f(idx1) 2862 } 2863 2864 } 2865 wg.Wait() 2866 return arr1 2867 } 2868 2869 var __EnumValueImplementors = []string{"__EnumValue"} 2870 2871 // nolint: gocyclo, errcheck, gas, goconst 2872 func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { 2873 fields := graphql.CollectFields(ctx, sel, __EnumValueImplementors) 2874 2875 out := graphql.NewOrderedMap(len(fields)) 2876 invalid := false 2877 for i, field := range fields { 2878 out.Keys[i] = field.Alias 2879 2880 switch field.Name { 2881 case "__typename": 2882 out.Values[i] = graphql.MarshalString("__EnumValue") 2883 case "name": 2884 out.Values[i] = ec.___EnumValue_name(ctx, field, obj) 2885 if out.Values[i] == graphql.Null { 2886 invalid = true 2887 } 2888 case "description": 2889 out.Values[i] = ec.___EnumValue_description(ctx, field, obj) 2890 case "isDeprecated": 2891 out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) 2892 if out.Values[i] == graphql.Null { 2893 invalid = true 2894 } 2895 case "deprecationReason": 2896 out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) 2897 default: 2898 panic("unknown field " + strconv.Quote(field.Name)) 2899 } 2900 } 2901 2902 if invalid { 2903 return graphql.Null 2904 } 2905 return out 2906 } 2907 2908 // nolint: vetshadow 2909 func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 2910 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2911 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2912 rctx := &graphql.ResolverContext{ 2913 Object: "__EnumValue", 2914 Args: nil, 2915 Field: field, 2916 } 2917 ctx = graphql.WithResolverContext(ctx, rctx) 2918 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2919 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2920 ctx = rctx // use context from middleware stack in children 2921 return obj.Name, nil 2922 }) 2923 if resTmp == nil { 2924 if !ec.HasError(rctx) { 2925 ec.Errorf(ctx, "must not be null") 2926 } 2927 return graphql.Null 2928 } 2929 res := resTmp.(string) 2930 rctx.Result = res 2931 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2932 return graphql.MarshalString(res) 2933 } 2934 2935 // nolint: vetshadow 2936 func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 2937 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2938 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2939 rctx := &graphql.ResolverContext{ 2940 Object: "__EnumValue", 2941 Args: nil, 2942 Field: field, 2943 } 2944 ctx = graphql.WithResolverContext(ctx, rctx) 2945 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2946 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2947 ctx = rctx // use context from middleware stack in children 2948 return obj.Description, nil 2949 }) 2950 if resTmp == nil { 2951 return graphql.Null 2952 } 2953 res := resTmp.(string) 2954 rctx.Result = res 2955 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2956 return graphql.MarshalString(res) 2957 } 2958 2959 // nolint: vetshadow 2960 func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 2961 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2962 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2963 rctx := &graphql.ResolverContext{ 2964 Object: "__EnumValue", 2965 Args: nil, 2966 Field: field, 2967 } 2968 ctx = graphql.WithResolverContext(ctx, rctx) 2969 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2970 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2971 ctx = rctx // use context from middleware stack in children 2972 return obj.IsDeprecated(), nil 2973 }) 2974 if resTmp == nil { 2975 if !ec.HasError(rctx) { 2976 ec.Errorf(ctx, "must not be null") 2977 } 2978 return graphql.Null 2979 } 2980 res := resTmp.(bool) 2981 rctx.Result = res 2982 ctx = ec.Tracer.StartFieldChildExecution(ctx) 2983 return graphql.MarshalBoolean(res) 2984 } 2985 2986 // nolint: vetshadow 2987 func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 2988 ctx = ec.Tracer.StartFieldExecution(ctx, field) 2989 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 2990 rctx := &graphql.ResolverContext{ 2991 Object: "__EnumValue", 2992 Args: nil, 2993 Field: field, 2994 } 2995 ctx = graphql.WithResolverContext(ctx, rctx) 2996 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 2997 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 2998 ctx = rctx // use context from middleware stack in children 2999 return obj.DeprecationReason(), nil 3000 }) 3001 if resTmp == nil { 3002 return graphql.Null 3003 } 3004 res := resTmp.(*string) 3005 rctx.Result = res 3006 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3007 3008 if res == nil { 3009 return graphql.Null 3010 } 3011 return graphql.MarshalString(*res) 3012 } 3013 3014 var __FieldImplementors = []string{"__Field"} 3015 3016 // nolint: gocyclo, errcheck, gas, goconst 3017 func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { 3018 fields := graphql.CollectFields(ctx, sel, __FieldImplementors) 3019 3020 out := graphql.NewOrderedMap(len(fields)) 3021 invalid := false 3022 for i, field := range fields { 3023 out.Keys[i] = field.Alias 3024 3025 switch field.Name { 3026 case "__typename": 3027 out.Values[i] = graphql.MarshalString("__Field") 3028 case "name": 3029 out.Values[i] = ec.___Field_name(ctx, field, obj) 3030 if out.Values[i] == graphql.Null { 3031 invalid = true 3032 } 3033 case "description": 3034 out.Values[i] = ec.___Field_description(ctx, field, obj) 3035 case "args": 3036 out.Values[i] = ec.___Field_args(ctx, field, obj) 3037 if out.Values[i] == graphql.Null { 3038 invalid = true 3039 } 3040 case "type": 3041 out.Values[i] = ec.___Field_type(ctx, field, obj) 3042 if out.Values[i] == graphql.Null { 3043 invalid = true 3044 } 3045 case "isDeprecated": 3046 out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) 3047 if out.Values[i] == graphql.Null { 3048 invalid = true 3049 } 3050 case "deprecationReason": 3051 out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) 3052 default: 3053 panic("unknown field " + strconv.Quote(field.Name)) 3054 } 3055 } 3056 3057 if invalid { 3058 return graphql.Null 3059 } 3060 return out 3061 } 3062 3063 // nolint: vetshadow 3064 func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 3065 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3066 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3067 rctx := &graphql.ResolverContext{ 3068 Object: "__Field", 3069 Args: nil, 3070 Field: field, 3071 } 3072 ctx = graphql.WithResolverContext(ctx, rctx) 3073 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3074 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3075 ctx = rctx // use context from middleware stack in children 3076 return obj.Name, nil 3077 }) 3078 if resTmp == nil { 3079 if !ec.HasError(rctx) { 3080 ec.Errorf(ctx, "must not be null") 3081 } 3082 return graphql.Null 3083 } 3084 res := resTmp.(string) 3085 rctx.Result = res 3086 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3087 return graphql.MarshalString(res) 3088 } 3089 3090 // nolint: vetshadow 3091 func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 3092 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3093 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3094 rctx := &graphql.ResolverContext{ 3095 Object: "__Field", 3096 Args: nil, 3097 Field: field, 3098 } 3099 ctx = graphql.WithResolverContext(ctx, rctx) 3100 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3101 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3102 ctx = rctx // use context from middleware stack in children 3103 return obj.Description, nil 3104 }) 3105 if resTmp == nil { 3106 return graphql.Null 3107 } 3108 res := resTmp.(string) 3109 rctx.Result = res 3110 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3111 return graphql.MarshalString(res) 3112 } 3113 3114 // nolint: vetshadow 3115 func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 3116 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3117 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3118 rctx := &graphql.ResolverContext{ 3119 Object: "__Field", 3120 Args: nil, 3121 Field: field, 3122 } 3123 ctx = graphql.WithResolverContext(ctx, rctx) 3124 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3125 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3126 ctx = rctx // use context from middleware stack in children 3127 return obj.Args, nil 3128 }) 3129 if resTmp == nil { 3130 if !ec.HasError(rctx) { 3131 ec.Errorf(ctx, "must not be null") 3132 } 3133 return graphql.Null 3134 } 3135 res := resTmp.([]introspection.InputValue) 3136 rctx.Result = res 3137 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3138 3139 arr1 := make(graphql.Array, len(res)) 3140 var wg sync.WaitGroup 3141 3142 isLen1 := len(res) == 1 3143 if !isLen1 { 3144 wg.Add(len(res)) 3145 } 3146 3147 for idx1 := range res { 3148 idx1 := idx1 3149 rctx := &graphql.ResolverContext{ 3150 Index: &idx1, 3151 Result: &res[idx1], 3152 } 3153 ctx := graphql.WithResolverContext(ctx, rctx) 3154 f := func(idx1 int) { 3155 if !isLen1 { 3156 defer wg.Done() 3157 } 3158 arr1[idx1] = func() graphql.Marshaler { 3159 3160 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 3161 }() 3162 } 3163 if isLen1 { 3164 f(idx1) 3165 } else { 3166 go f(idx1) 3167 } 3168 3169 } 3170 wg.Wait() 3171 return arr1 3172 } 3173 3174 // nolint: vetshadow 3175 func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 3176 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3177 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3178 rctx := &graphql.ResolverContext{ 3179 Object: "__Field", 3180 Args: nil, 3181 Field: field, 3182 } 3183 ctx = graphql.WithResolverContext(ctx, rctx) 3184 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3185 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3186 ctx = rctx // use context from middleware stack in children 3187 return obj.Type, nil 3188 }) 3189 if resTmp == nil { 3190 if !ec.HasError(rctx) { 3191 ec.Errorf(ctx, "must not be null") 3192 } 3193 return graphql.Null 3194 } 3195 res := resTmp.(*introspection.Type) 3196 rctx.Result = res 3197 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3198 3199 if res == nil { 3200 if !ec.HasError(rctx) { 3201 ec.Errorf(ctx, "must not be null") 3202 } 3203 return graphql.Null 3204 } 3205 3206 return ec.___Type(ctx, field.Selections, res) 3207 } 3208 3209 // nolint: vetshadow 3210 func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 3211 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3212 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3213 rctx := &graphql.ResolverContext{ 3214 Object: "__Field", 3215 Args: nil, 3216 Field: field, 3217 } 3218 ctx = graphql.WithResolverContext(ctx, rctx) 3219 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3220 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3221 ctx = rctx // use context from middleware stack in children 3222 return obj.IsDeprecated(), nil 3223 }) 3224 if resTmp == nil { 3225 if !ec.HasError(rctx) { 3226 ec.Errorf(ctx, "must not be null") 3227 } 3228 return graphql.Null 3229 } 3230 res := resTmp.(bool) 3231 rctx.Result = res 3232 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3233 return graphql.MarshalBoolean(res) 3234 } 3235 3236 // nolint: vetshadow 3237 func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 3238 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3239 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3240 rctx := &graphql.ResolverContext{ 3241 Object: "__Field", 3242 Args: nil, 3243 Field: field, 3244 } 3245 ctx = graphql.WithResolverContext(ctx, rctx) 3246 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3247 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3248 ctx = rctx // use context from middleware stack in children 3249 return obj.DeprecationReason(), nil 3250 }) 3251 if resTmp == nil { 3252 return graphql.Null 3253 } 3254 res := resTmp.(*string) 3255 rctx.Result = res 3256 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3257 3258 if res == nil { 3259 return graphql.Null 3260 } 3261 return graphql.MarshalString(*res) 3262 } 3263 3264 var __InputValueImplementors = []string{"__InputValue"} 3265 3266 // nolint: gocyclo, errcheck, gas, goconst 3267 func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { 3268 fields := graphql.CollectFields(ctx, sel, __InputValueImplementors) 3269 3270 out := graphql.NewOrderedMap(len(fields)) 3271 invalid := false 3272 for i, field := range fields { 3273 out.Keys[i] = field.Alias 3274 3275 switch field.Name { 3276 case "__typename": 3277 out.Values[i] = graphql.MarshalString("__InputValue") 3278 case "name": 3279 out.Values[i] = ec.___InputValue_name(ctx, field, obj) 3280 if out.Values[i] == graphql.Null { 3281 invalid = true 3282 } 3283 case "description": 3284 out.Values[i] = ec.___InputValue_description(ctx, field, obj) 3285 case "type": 3286 out.Values[i] = ec.___InputValue_type(ctx, field, obj) 3287 if out.Values[i] == graphql.Null { 3288 invalid = true 3289 } 3290 case "defaultValue": 3291 out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) 3292 default: 3293 panic("unknown field " + strconv.Quote(field.Name)) 3294 } 3295 } 3296 3297 if invalid { 3298 return graphql.Null 3299 } 3300 return out 3301 } 3302 3303 // nolint: vetshadow 3304 func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 3305 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3306 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3307 rctx := &graphql.ResolverContext{ 3308 Object: "__InputValue", 3309 Args: nil, 3310 Field: field, 3311 } 3312 ctx = graphql.WithResolverContext(ctx, rctx) 3313 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3314 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3315 ctx = rctx // use context from middleware stack in children 3316 return obj.Name, nil 3317 }) 3318 if resTmp == nil { 3319 if !ec.HasError(rctx) { 3320 ec.Errorf(ctx, "must not be null") 3321 } 3322 return graphql.Null 3323 } 3324 res := resTmp.(string) 3325 rctx.Result = res 3326 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3327 return graphql.MarshalString(res) 3328 } 3329 3330 // nolint: vetshadow 3331 func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 3332 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3333 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3334 rctx := &graphql.ResolverContext{ 3335 Object: "__InputValue", 3336 Args: nil, 3337 Field: field, 3338 } 3339 ctx = graphql.WithResolverContext(ctx, rctx) 3340 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3341 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3342 ctx = rctx // use context from middleware stack in children 3343 return obj.Description, nil 3344 }) 3345 if resTmp == nil { 3346 return graphql.Null 3347 } 3348 res := resTmp.(string) 3349 rctx.Result = res 3350 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3351 return graphql.MarshalString(res) 3352 } 3353 3354 // nolint: vetshadow 3355 func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 3356 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3357 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3358 rctx := &graphql.ResolverContext{ 3359 Object: "__InputValue", 3360 Args: nil, 3361 Field: field, 3362 } 3363 ctx = graphql.WithResolverContext(ctx, rctx) 3364 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3365 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3366 ctx = rctx // use context from middleware stack in children 3367 return obj.Type, nil 3368 }) 3369 if resTmp == nil { 3370 if !ec.HasError(rctx) { 3371 ec.Errorf(ctx, "must not be null") 3372 } 3373 return graphql.Null 3374 } 3375 res := resTmp.(*introspection.Type) 3376 rctx.Result = res 3377 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3378 3379 if res == nil { 3380 if !ec.HasError(rctx) { 3381 ec.Errorf(ctx, "must not be null") 3382 } 3383 return graphql.Null 3384 } 3385 3386 return ec.___Type(ctx, field.Selections, res) 3387 } 3388 3389 // nolint: vetshadow 3390 func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 3391 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3392 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3393 rctx := &graphql.ResolverContext{ 3394 Object: "__InputValue", 3395 Args: nil, 3396 Field: field, 3397 } 3398 ctx = graphql.WithResolverContext(ctx, rctx) 3399 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3400 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3401 ctx = rctx // use context from middleware stack in children 3402 return obj.DefaultValue, nil 3403 }) 3404 if resTmp == nil { 3405 return graphql.Null 3406 } 3407 res := resTmp.(*string) 3408 rctx.Result = res 3409 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3410 3411 if res == nil { 3412 return graphql.Null 3413 } 3414 return graphql.MarshalString(*res) 3415 } 3416 3417 var __SchemaImplementors = []string{"__Schema"} 3418 3419 // nolint: gocyclo, errcheck, gas, goconst 3420 func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { 3421 fields := graphql.CollectFields(ctx, sel, __SchemaImplementors) 3422 3423 out := graphql.NewOrderedMap(len(fields)) 3424 invalid := false 3425 for i, field := range fields { 3426 out.Keys[i] = field.Alias 3427 3428 switch field.Name { 3429 case "__typename": 3430 out.Values[i] = graphql.MarshalString("__Schema") 3431 case "types": 3432 out.Values[i] = ec.___Schema_types(ctx, field, obj) 3433 if out.Values[i] == graphql.Null { 3434 invalid = true 3435 } 3436 case "queryType": 3437 out.Values[i] = ec.___Schema_queryType(ctx, field, obj) 3438 if out.Values[i] == graphql.Null { 3439 invalid = true 3440 } 3441 case "mutationType": 3442 out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) 3443 case "subscriptionType": 3444 out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) 3445 case "directives": 3446 out.Values[i] = ec.___Schema_directives(ctx, field, obj) 3447 if out.Values[i] == graphql.Null { 3448 invalid = true 3449 } 3450 default: 3451 panic("unknown field " + strconv.Quote(field.Name)) 3452 } 3453 } 3454 3455 if invalid { 3456 return graphql.Null 3457 } 3458 return out 3459 } 3460 3461 // nolint: vetshadow 3462 func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 3463 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3464 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3465 rctx := &graphql.ResolverContext{ 3466 Object: "__Schema", 3467 Args: nil, 3468 Field: field, 3469 } 3470 ctx = graphql.WithResolverContext(ctx, rctx) 3471 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3472 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3473 ctx = rctx // use context from middleware stack in children 3474 return obj.Types(), nil 3475 }) 3476 if resTmp == nil { 3477 if !ec.HasError(rctx) { 3478 ec.Errorf(ctx, "must not be null") 3479 } 3480 return graphql.Null 3481 } 3482 res := resTmp.([]introspection.Type) 3483 rctx.Result = res 3484 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3485 3486 arr1 := make(graphql.Array, len(res)) 3487 var wg sync.WaitGroup 3488 3489 isLen1 := len(res) == 1 3490 if !isLen1 { 3491 wg.Add(len(res)) 3492 } 3493 3494 for idx1 := range res { 3495 idx1 := idx1 3496 rctx := &graphql.ResolverContext{ 3497 Index: &idx1, 3498 Result: &res[idx1], 3499 } 3500 ctx := graphql.WithResolverContext(ctx, rctx) 3501 f := func(idx1 int) { 3502 if !isLen1 { 3503 defer wg.Done() 3504 } 3505 arr1[idx1] = func() graphql.Marshaler { 3506 3507 return ec.___Type(ctx, field.Selections, &res[idx1]) 3508 }() 3509 } 3510 if isLen1 { 3511 f(idx1) 3512 } else { 3513 go f(idx1) 3514 } 3515 3516 } 3517 wg.Wait() 3518 return arr1 3519 } 3520 3521 // nolint: vetshadow 3522 func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 3523 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3524 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3525 rctx := &graphql.ResolverContext{ 3526 Object: "__Schema", 3527 Args: nil, 3528 Field: field, 3529 } 3530 ctx = graphql.WithResolverContext(ctx, rctx) 3531 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3532 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3533 ctx = rctx // use context from middleware stack in children 3534 return obj.QueryType(), nil 3535 }) 3536 if resTmp == nil { 3537 if !ec.HasError(rctx) { 3538 ec.Errorf(ctx, "must not be null") 3539 } 3540 return graphql.Null 3541 } 3542 res := resTmp.(*introspection.Type) 3543 rctx.Result = res 3544 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3545 3546 if res == nil { 3547 if !ec.HasError(rctx) { 3548 ec.Errorf(ctx, "must not be null") 3549 } 3550 return graphql.Null 3551 } 3552 3553 return ec.___Type(ctx, field.Selections, res) 3554 } 3555 3556 // nolint: vetshadow 3557 func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 3558 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3559 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3560 rctx := &graphql.ResolverContext{ 3561 Object: "__Schema", 3562 Args: nil, 3563 Field: field, 3564 } 3565 ctx = graphql.WithResolverContext(ctx, rctx) 3566 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3567 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3568 ctx = rctx // use context from middleware stack in children 3569 return obj.MutationType(), nil 3570 }) 3571 if resTmp == nil { 3572 return graphql.Null 3573 } 3574 res := resTmp.(*introspection.Type) 3575 rctx.Result = res 3576 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3577 3578 if res == nil { 3579 return graphql.Null 3580 } 3581 3582 return ec.___Type(ctx, field.Selections, res) 3583 } 3584 3585 // nolint: vetshadow 3586 func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 3587 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3588 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3589 rctx := &graphql.ResolverContext{ 3590 Object: "__Schema", 3591 Args: nil, 3592 Field: field, 3593 } 3594 ctx = graphql.WithResolverContext(ctx, rctx) 3595 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3596 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3597 ctx = rctx // use context from middleware stack in children 3598 return obj.SubscriptionType(), nil 3599 }) 3600 if resTmp == nil { 3601 return graphql.Null 3602 } 3603 res := resTmp.(*introspection.Type) 3604 rctx.Result = res 3605 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3606 3607 if res == nil { 3608 return graphql.Null 3609 } 3610 3611 return ec.___Type(ctx, field.Selections, res) 3612 } 3613 3614 // nolint: vetshadow 3615 func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 3616 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3617 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3618 rctx := &graphql.ResolverContext{ 3619 Object: "__Schema", 3620 Args: nil, 3621 Field: field, 3622 } 3623 ctx = graphql.WithResolverContext(ctx, rctx) 3624 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3625 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3626 ctx = rctx // use context from middleware stack in children 3627 return obj.Directives(), nil 3628 }) 3629 if resTmp == nil { 3630 if !ec.HasError(rctx) { 3631 ec.Errorf(ctx, "must not be null") 3632 } 3633 return graphql.Null 3634 } 3635 res := resTmp.([]introspection.Directive) 3636 rctx.Result = res 3637 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3638 3639 arr1 := make(graphql.Array, len(res)) 3640 var wg sync.WaitGroup 3641 3642 isLen1 := len(res) == 1 3643 if !isLen1 { 3644 wg.Add(len(res)) 3645 } 3646 3647 for idx1 := range res { 3648 idx1 := idx1 3649 rctx := &graphql.ResolverContext{ 3650 Index: &idx1, 3651 Result: &res[idx1], 3652 } 3653 ctx := graphql.WithResolverContext(ctx, rctx) 3654 f := func(idx1 int) { 3655 if !isLen1 { 3656 defer wg.Done() 3657 } 3658 arr1[idx1] = func() graphql.Marshaler { 3659 3660 return ec.___Directive(ctx, field.Selections, &res[idx1]) 3661 }() 3662 } 3663 if isLen1 { 3664 f(idx1) 3665 } else { 3666 go f(idx1) 3667 } 3668 3669 } 3670 wg.Wait() 3671 return arr1 3672 } 3673 3674 var __TypeImplementors = []string{"__Type"} 3675 3676 // nolint: gocyclo, errcheck, gas, goconst 3677 func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { 3678 fields := graphql.CollectFields(ctx, sel, __TypeImplementors) 3679 3680 out := graphql.NewOrderedMap(len(fields)) 3681 invalid := false 3682 for i, field := range fields { 3683 out.Keys[i] = field.Alias 3684 3685 switch field.Name { 3686 case "__typename": 3687 out.Values[i] = graphql.MarshalString("__Type") 3688 case "kind": 3689 out.Values[i] = ec.___Type_kind(ctx, field, obj) 3690 if out.Values[i] == graphql.Null { 3691 invalid = true 3692 } 3693 case "name": 3694 out.Values[i] = ec.___Type_name(ctx, field, obj) 3695 case "description": 3696 out.Values[i] = ec.___Type_description(ctx, field, obj) 3697 case "fields": 3698 out.Values[i] = ec.___Type_fields(ctx, field, obj) 3699 case "interfaces": 3700 out.Values[i] = ec.___Type_interfaces(ctx, field, obj) 3701 case "possibleTypes": 3702 out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) 3703 case "enumValues": 3704 out.Values[i] = ec.___Type_enumValues(ctx, field, obj) 3705 case "inputFields": 3706 out.Values[i] = ec.___Type_inputFields(ctx, field, obj) 3707 case "ofType": 3708 out.Values[i] = ec.___Type_ofType(ctx, field, obj) 3709 default: 3710 panic("unknown field " + strconv.Quote(field.Name)) 3711 } 3712 } 3713 3714 if invalid { 3715 return graphql.Null 3716 } 3717 return out 3718 } 3719 3720 // nolint: vetshadow 3721 func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3722 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3723 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3724 rctx := &graphql.ResolverContext{ 3725 Object: "__Type", 3726 Args: nil, 3727 Field: field, 3728 } 3729 ctx = graphql.WithResolverContext(ctx, rctx) 3730 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3731 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3732 ctx = rctx // use context from middleware stack in children 3733 return obj.Kind(), nil 3734 }) 3735 if resTmp == nil { 3736 if !ec.HasError(rctx) { 3737 ec.Errorf(ctx, "must not be null") 3738 } 3739 return graphql.Null 3740 } 3741 res := resTmp.(string) 3742 rctx.Result = res 3743 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3744 return graphql.MarshalString(res) 3745 } 3746 3747 // nolint: vetshadow 3748 func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3749 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3750 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3751 rctx := &graphql.ResolverContext{ 3752 Object: "__Type", 3753 Args: nil, 3754 Field: field, 3755 } 3756 ctx = graphql.WithResolverContext(ctx, rctx) 3757 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3758 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3759 ctx = rctx // use context from middleware stack in children 3760 return obj.Name(), nil 3761 }) 3762 if resTmp == nil { 3763 return graphql.Null 3764 } 3765 res := resTmp.(*string) 3766 rctx.Result = res 3767 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3768 3769 if res == nil { 3770 return graphql.Null 3771 } 3772 return graphql.MarshalString(*res) 3773 } 3774 3775 // nolint: vetshadow 3776 func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3777 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3778 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3779 rctx := &graphql.ResolverContext{ 3780 Object: "__Type", 3781 Args: nil, 3782 Field: field, 3783 } 3784 ctx = graphql.WithResolverContext(ctx, rctx) 3785 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3786 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3787 ctx = rctx // use context from middleware stack in children 3788 return obj.Description(), nil 3789 }) 3790 if resTmp == nil { 3791 return graphql.Null 3792 } 3793 res := resTmp.(string) 3794 rctx.Result = res 3795 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3796 return graphql.MarshalString(res) 3797 } 3798 3799 // nolint: vetshadow 3800 func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3801 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3802 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3803 rawArgs := field.ArgumentMap(ec.Variables) 3804 args, err := field___Type_fields_args(rawArgs) 3805 if err != nil { 3806 ec.Error(ctx, err) 3807 return graphql.Null 3808 } 3809 rctx := &graphql.ResolverContext{ 3810 Object: "__Type", 3811 Args: args, 3812 Field: field, 3813 } 3814 ctx = graphql.WithResolverContext(ctx, rctx) 3815 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3816 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3817 ctx = rctx // use context from middleware stack in children 3818 return obj.Fields(args["includeDeprecated"].(bool)), nil 3819 }) 3820 if resTmp == nil { 3821 return graphql.Null 3822 } 3823 res := resTmp.([]introspection.Field) 3824 rctx.Result = res 3825 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3826 3827 arr1 := make(graphql.Array, len(res)) 3828 var wg sync.WaitGroup 3829 3830 isLen1 := len(res) == 1 3831 if !isLen1 { 3832 wg.Add(len(res)) 3833 } 3834 3835 for idx1 := range res { 3836 idx1 := idx1 3837 rctx := &graphql.ResolverContext{ 3838 Index: &idx1, 3839 Result: &res[idx1], 3840 } 3841 ctx := graphql.WithResolverContext(ctx, rctx) 3842 f := func(idx1 int) { 3843 if !isLen1 { 3844 defer wg.Done() 3845 } 3846 arr1[idx1] = func() graphql.Marshaler { 3847 3848 return ec.___Field(ctx, field.Selections, &res[idx1]) 3849 }() 3850 } 3851 if isLen1 { 3852 f(idx1) 3853 } else { 3854 go f(idx1) 3855 } 3856 3857 } 3858 wg.Wait() 3859 return arr1 3860 } 3861 3862 // nolint: vetshadow 3863 func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3864 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3865 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3866 rctx := &graphql.ResolverContext{ 3867 Object: "__Type", 3868 Args: nil, 3869 Field: field, 3870 } 3871 ctx = graphql.WithResolverContext(ctx, rctx) 3872 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3873 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3874 ctx = rctx // use context from middleware stack in children 3875 return obj.Interfaces(), nil 3876 }) 3877 if resTmp == nil { 3878 return graphql.Null 3879 } 3880 res := resTmp.([]introspection.Type) 3881 rctx.Result = res 3882 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3883 3884 arr1 := make(graphql.Array, len(res)) 3885 var wg sync.WaitGroup 3886 3887 isLen1 := len(res) == 1 3888 if !isLen1 { 3889 wg.Add(len(res)) 3890 } 3891 3892 for idx1 := range res { 3893 idx1 := idx1 3894 rctx := &graphql.ResolverContext{ 3895 Index: &idx1, 3896 Result: &res[idx1], 3897 } 3898 ctx := graphql.WithResolverContext(ctx, rctx) 3899 f := func(idx1 int) { 3900 if !isLen1 { 3901 defer wg.Done() 3902 } 3903 arr1[idx1] = func() graphql.Marshaler { 3904 3905 return ec.___Type(ctx, field.Selections, &res[idx1]) 3906 }() 3907 } 3908 if isLen1 { 3909 f(idx1) 3910 } else { 3911 go f(idx1) 3912 } 3913 3914 } 3915 wg.Wait() 3916 return arr1 3917 } 3918 3919 // nolint: vetshadow 3920 func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3921 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3922 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3923 rctx := &graphql.ResolverContext{ 3924 Object: "__Type", 3925 Args: nil, 3926 Field: field, 3927 } 3928 ctx = graphql.WithResolverContext(ctx, rctx) 3929 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3930 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3931 ctx = rctx // use context from middleware stack in children 3932 return obj.PossibleTypes(), nil 3933 }) 3934 if resTmp == nil { 3935 return graphql.Null 3936 } 3937 res := resTmp.([]introspection.Type) 3938 rctx.Result = res 3939 ctx = ec.Tracer.StartFieldChildExecution(ctx) 3940 3941 arr1 := make(graphql.Array, len(res)) 3942 var wg sync.WaitGroup 3943 3944 isLen1 := len(res) == 1 3945 if !isLen1 { 3946 wg.Add(len(res)) 3947 } 3948 3949 for idx1 := range res { 3950 idx1 := idx1 3951 rctx := &graphql.ResolverContext{ 3952 Index: &idx1, 3953 Result: &res[idx1], 3954 } 3955 ctx := graphql.WithResolverContext(ctx, rctx) 3956 f := func(idx1 int) { 3957 if !isLen1 { 3958 defer wg.Done() 3959 } 3960 arr1[idx1] = func() graphql.Marshaler { 3961 3962 return ec.___Type(ctx, field.Selections, &res[idx1]) 3963 }() 3964 } 3965 if isLen1 { 3966 f(idx1) 3967 } else { 3968 go f(idx1) 3969 } 3970 3971 } 3972 wg.Wait() 3973 return arr1 3974 } 3975 3976 // nolint: vetshadow 3977 func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 3978 ctx = ec.Tracer.StartFieldExecution(ctx, field) 3979 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 3980 rawArgs := field.ArgumentMap(ec.Variables) 3981 args, err := field___Type_enumValues_args(rawArgs) 3982 if err != nil { 3983 ec.Error(ctx, err) 3984 return graphql.Null 3985 } 3986 rctx := &graphql.ResolverContext{ 3987 Object: "__Type", 3988 Args: args, 3989 Field: field, 3990 } 3991 ctx = graphql.WithResolverContext(ctx, rctx) 3992 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 3993 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 3994 ctx = rctx // use context from middleware stack in children 3995 return obj.EnumValues(args["includeDeprecated"].(bool)), nil 3996 }) 3997 if resTmp == nil { 3998 return graphql.Null 3999 } 4000 res := resTmp.([]introspection.EnumValue) 4001 rctx.Result = res 4002 ctx = ec.Tracer.StartFieldChildExecution(ctx) 4003 4004 arr1 := make(graphql.Array, len(res)) 4005 var wg sync.WaitGroup 4006 4007 isLen1 := len(res) == 1 4008 if !isLen1 { 4009 wg.Add(len(res)) 4010 } 4011 4012 for idx1 := range res { 4013 idx1 := idx1 4014 rctx := &graphql.ResolverContext{ 4015 Index: &idx1, 4016 Result: &res[idx1], 4017 } 4018 ctx := graphql.WithResolverContext(ctx, rctx) 4019 f := func(idx1 int) { 4020 if !isLen1 { 4021 defer wg.Done() 4022 } 4023 arr1[idx1] = func() graphql.Marshaler { 4024 4025 return ec.___EnumValue(ctx, field.Selections, &res[idx1]) 4026 }() 4027 } 4028 if isLen1 { 4029 f(idx1) 4030 } else { 4031 go f(idx1) 4032 } 4033 4034 } 4035 wg.Wait() 4036 return arr1 4037 } 4038 4039 // nolint: vetshadow 4040 func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 4041 ctx = ec.Tracer.StartFieldExecution(ctx, field) 4042 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 4043 rctx := &graphql.ResolverContext{ 4044 Object: "__Type", 4045 Args: nil, 4046 Field: field, 4047 } 4048 ctx = graphql.WithResolverContext(ctx, rctx) 4049 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 4050 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 4051 ctx = rctx // use context from middleware stack in children 4052 return obj.InputFields(), nil 4053 }) 4054 if resTmp == nil { 4055 return graphql.Null 4056 } 4057 res := resTmp.([]introspection.InputValue) 4058 rctx.Result = res 4059 ctx = ec.Tracer.StartFieldChildExecution(ctx) 4060 4061 arr1 := make(graphql.Array, len(res)) 4062 var wg sync.WaitGroup 4063 4064 isLen1 := len(res) == 1 4065 if !isLen1 { 4066 wg.Add(len(res)) 4067 } 4068 4069 for idx1 := range res { 4070 idx1 := idx1 4071 rctx := &graphql.ResolverContext{ 4072 Index: &idx1, 4073 Result: &res[idx1], 4074 } 4075 ctx := graphql.WithResolverContext(ctx, rctx) 4076 f := func(idx1 int) { 4077 if !isLen1 { 4078 defer wg.Done() 4079 } 4080 arr1[idx1] = func() graphql.Marshaler { 4081 4082 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 4083 }() 4084 } 4085 if isLen1 { 4086 f(idx1) 4087 } else { 4088 go f(idx1) 4089 } 4090 4091 } 4092 wg.Wait() 4093 return arr1 4094 } 4095 4096 // nolint: vetshadow 4097 func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 4098 ctx = ec.Tracer.StartFieldExecution(ctx, field) 4099 defer func() { ec.Tracer.EndFieldExecution(ctx) }() 4100 rctx := &graphql.ResolverContext{ 4101 Object: "__Type", 4102 Args: nil, 4103 Field: field, 4104 } 4105 ctx = graphql.WithResolverContext(ctx, rctx) 4106 ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) 4107 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 4108 ctx = rctx // use context from middleware stack in children 4109 return obj.OfType(), nil 4110 }) 4111 if resTmp == nil { 4112 return graphql.Null 4113 } 4114 res := resTmp.(*introspection.Type) 4115 rctx.Result = res 4116 ctx = ec.Tracer.StartFieldChildExecution(ctx) 4117 4118 if res == nil { 4119 return graphql.Null 4120 } 4121 4122 return ec.___Type(ctx, field.Selections, res) 4123 } 4124 4125 func (ec *executionContext) _Character(ctx context.Context, sel ast.SelectionSet, obj *Character) graphql.Marshaler { 4126 switch obj := (*obj).(type) { 4127 case nil: 4128 return graphql.Null 4129 case Human: 4130 return ec._Human(ctx, sel, &obj) 4131 case *Human: 4132 return ec._Human(ctx, sel, obj) 4133 case Droid: 4134 return ec._Droid(ctx, sel, &obj) 4135 case *Droid: 4136 return ec._Droid(ctx, sel, obj) 4137 default: 4138 panic(fmt.Errorf("unexpected type %T", obj)) 4139 } 4140 } 4141 4142 func (ec *executionContext) _SearchResult(ctx context.Context, sel ast.SelectionSet, obj *SearchResult) graphql.Marshaler { 4143 switch obj := (*obj).(type) { 4144 case nil: 4145 return graphql.Null 4146 case Human: 4147 return ec._Human(ctx, sel, &obj) 4148 case *Human: 4149 return ec._Human(ctx, sel, obj) 4150 case Droid: 4151 return ec._Droid(ctx, sel, &obj) 4152 case *Droid: 4153 return ec._Droid(ctx, sel, obj) 4154 case Starship: 4155 return ec._Starship(ctx, sel, &obj) 4156 case *Starship: 4157 return ec._Starship(ctx, sel, obj) 4158 default: 4159 panic(fmt.Errorf("unexpected type %T", obj)) 4160 } 4161 } 4162 4163 func UnmarshalReviewInput(v interface{}) (Review, error) { 4164 var it Review 4165 var asMap = v.(map[string]interface{}) 4166 4167 for k, v := range asMap { 4168 switch k { 4169 case "stars": 4170 var err error 4171 it.Stars, err = graphql.UnmarshalInt(v) 4172 if err != nil { 4173 return it, err 4174 } 4175 case "commentary": 4176 var err error 4177 var ptr1 string 4178 if v != nil { 4179 ptr1, err = graphql.UnmarshalString(v) 4180 it.Commentary = &ptr1 4181 } 4182 4183 if err != nil { 4184 return it, err 4185 } 4186 case "time": 4187 var err error 4188 it.Time, err = graphql.UnmarshalTime(v) 4189 if err != nil { 4190 return it, err 4191 } 4192 } 4193 } 4194 4195 return it, nil 4196 } 4197 4198 func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { 4199 defer func() { 4200 if r := recover(); r != nil { 4201 ec.Error(ctx, ec.Recover(ctx, r)) 4202 ret = nil 4203 } 4204 }() 4205 res, err := ec.ResolverMiddleware(ctx, next) 4206 if err != nil { 4207 ec.Error(ctx, err) 4208 return nil 4209 } 4210 return res 4211 } 4212 4213 func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { 4214 if ec.DisableIntrospection { 4215 return nil, errors.New("introspection disabled") 4216 } 4217 return introspection.WrapSchema(parsedSchema), nil 4218 } 4219 4220 func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { 4221 if ec.DisableIntrospection { 4222 return nil, errors.New("introspection disabled") 4223 } 4224 return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil 4225 } 4226 4227 var parsedSchema = gqlparser.MustLoadSchema( 4228 &ast.Source{Name: "schema.graphql", Input: `# The query type, represents all of the entry points into our object graph 4229 type Query { 4230 hero(episode: Episode = NEWHOPE): Character 4231 reviews(episode: Episode!, since: Time): [Review!]! 4232 search(text: String!): [SearchResult!]! 4233 character(id: ID!): Character 4234 droid(id: ID!): Droid 4235 human(id: ID!): Human 4236 starship(id: ID!): Starship 4237 } 4238 # The mutation type, represents all updates we can make to our data 4239 type Mutation { 4240 createReview(episode: Episode!, review: ReviewInput!): Review 4241 } 4242 # The episodes in the Star Wars trilogy 4243 enum Episode { 4244 # Star Wars Episode IV: A New Hope, released in 1977. 4245 NEWHOPE 4246 # Star Wars Episode V: The Empire Strikes Back, released in 1980. 4247 EMPIRE 4248 # Star Wars Episode VI: Return of the Jedi, released in 1983. 4249 JEDI 4250 } 4251 # A character from the Star Wars universe 4252 interface Character { 4253 # The ID of the character 4254 id: ID! 4255 # The name of the character 4256 name: String! 4257 # The friends of the character, or an empty list if they have none 4258 friends: [Character!] 4259 # The friends of the character exposed as a connection with edges 4260 friendsConnection(first: Int, after: ID): FriendsConnection! 4261 # The movies this character appears in 4262 appearsIn: [Episode!]! 4263 } 4264 # Units of height 4265 enum LengthUnit { 4266 # The standard unit around the world 4267 METER 4268 # Primarily used in the United States 4269 FOOT 4270 } 4271 # A humanoid creature from the Star Wars universe 4272 type Human implements Character { 4273 # The ID of the human 4274 id: ID! 4275 # What this human calls themselves 4276 name: String! 4277 # Height in the preferred unit, default is meters 4278 height(unit: LengthUnit = METER): Float! 4279 # Mass in kilograms, or null if unknown 4280 mass: Float 4281 # This human's friends, or an empty list if they have none 4282 friends: [Character!] 4283 # The friends of the human exposed as a connection with edges 4284 friendsConnection(first: Int, after: ID): FriendsConnection! 4285 # The movies this human appears in 4286 appearsIn: [Episode!]! 4287 # A list of starships this person has piloted, or an empty list if none 4288 starships: [Starship!] 4289 } 4290 # An autonomous mechanical character in the Star Wars universe 4291 type Droid implements Character { 4292 # The ID of the droid 4293 id: ID! 4294 # What others call this droid 4295 name: String! 4296 # This droid's friends, or an empty list if they have none 4297 friends: [Character!] 4298 # The friends of the droid exposed as a connection with edges 4299 friendsConnection(first: Int, after: ID): FriendsConnection! 4300 # The movies this droid appears in 4301 appearsIn: [Episode!]! 4302 # This droid's primary function 4303 primaryFunction: String 4304 } 4305 # A connection object for a character's friends 4306 type FriendsConnection { 4307 # The total number of friends 4308 totalCount: Int! 4309 # The edges for each of the character's friends. 4310 edges: [FriendsEdge!] 4311 # A list of the friends, as a convenience when edges are not needed. 4312 friends: [Character!] 4313 # Information for paginating this connection 4314 pageInfo: PageInfo! 4315 } 4316 # An edge object for a character's friends 4317 type FriendsEdge { 4318 # A cursor used for pagination 4319 cursor: ID! 4320 # The character represented by this friendship edge 4321 node: Character 4322 } 4323 # Information for paginating this connection 4324 type PageInfo { 4325 startCursor: ID! 4326 endCursor: ID! 4327 hasNextPage: Boolean! 4328 } 4329 # Represents a review for a movie 4330 type Review { 4331 # The number of stars this review gave, 1-5 4332 stars: Int! 4333 # Comment about the movie 4334 commentary: String 4335 # when the review was posted 4336 time: Time 4337 } 4338 # The input object sent when someone is creating a new review 4339 input ReviewInput { 4340 # 0-5 stars 4341 stars: Int! 4342 # Comment about the movie, optional 4343 commentary: String 4344 # when the review was posted 4345 time: Time 4346 } 4347 type Starship { 4348 # The ID of the starship 4349 id: ID! 4350 # The name of the starship 4351 name: String! 4352 # Length of the starship, along the longest axis 4353 length(unit: LengthUnit = METER): Float! 4354 # coordinates tracking this ship 4355 history: [[Int!]!]! 4356 } 4357 union SearchResult = Human | Droid | Starship 4358 scalar Time 4359 `}, 4360 )