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