github.com/matiasanaya/gqlgen@v0.6.0/example/selection/generated.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 3 package selection 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 Query() QueryResolver 36 } 37 38 type DirectiveRoot struct { 39 } 40 41 type ComplexityRoot struct { 42 Like struct { 43 Reaction func(childComplexity int) int 44 Sent func(childComplexity int) int 45 Selection func(childComplexity int) int 46 Collected func(childComplexity int) int 47 } 48 49 Post struct { 50 Message func(childComplexity int) int 51 Sent func(childComplexity int) int 52 Selection func(childComplexity int) int 53 Collected func(childComplexity int) int 54 } 55 56 Query struct { 57 Events func(childComplexity int) int 58 } 59 } 60 61 type QueryResolver interface { 62 Events(ctx context.Context) ([]Event, error) 63 } 64 65 func field_Query___type_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 66 args := map[string]interface{}{} 67 var arg0 string 68 if tmp, ok := rawArgs["name"]; ok { 69 var err error 70 arg0, err = graphql.UnmarshalString(tmp) 71 if err != nil { 72 return nil, err 73 } 74 } 75 args["name"] = arg0 76 return args, nil 77 78 } 79 80 func field___Type_fields_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 81 args := map[string]interface{}{} 82 var arg0 bool 83 if tmp, ok := rawArgs["includeDeprecated"]; ok { 84 var err error 85 arg0, err = graphql.UnmarshalBoolean(tmp) 86 if err != nil { 87 return nil, err 88 } 89 } 90 args["includeDeprecated"] = arg0 91 return args, nil 92 93 } 94 95 func field___Type_enumValues_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { 96 args := map[string]interface{}{} 97 var arg0 bool 98 if tmp, ok := rawArgs["includeDeprecated"]; ok { 99 var err error 100 arg0, err = graphql.UnmarshalBoolean(tmp) 101 if err != nil { 102 return nil, err 103 } 104 } 105 args["includeDeprecated"] = arg0 106 return args, nil 107 108 } 109 110 type executableSchema struct { 111 resolvers ResolverRoot 112 directives DirectiveRoot 113 complexity ComplexityRoot 114 } 115 116 func (e *executableSchema) Schema() *ast.Schema { 117 return parsedSchema 118 } 119 120 func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { 121 switch typeName + "." + field { 122 123 case "Like.reaction": 124 if e.complexity.Like.Reaction == nil { 125 break 126 } 127 128 return e.complexity.Like.Reaction(childComplexity), true 129 130 case "Like.sent": 131 if e.complexity.Like.Sent == nil { 132 break 133 } 134 135 return e.complexity.Like.Sent(childComplexity), true 136 137 case "Like.selection": 138 if e.complexity.Like.Selection == nil { 139 break 140 } 141 142 return e.complexity.Like.Selection(childComplexity), true 143 144 case "Like.collected": 145 if e.complexity.Like.Collected == nil { 146 break 147 } 148 149 return e.complexity.Like.Collected(childComplexity), true 150 151 case "Post.message": 152 if e.complexity.Post.Message == nil { 153 break 154 } 155 156 return e.complexity.Post.Message(childComplexity), true 157 158 case "Post.sent": 159 if e.complexity.Post.Sent == nil { 160 break 161 } 162 163 return e.complexity.Post.Sent(childComplexity), true 164 165 case "Post.selection": 166 if e.complexity.Post.Selection == nil { 167 break 168 } 169 170 return e.complexity.Post.Selection(childComplexity), true 171 172 case "Post.collected": 173 if e.complexity.Post.Collected == nil { 174 break 175 } 176 177 return e.complexity.Post.Collected(childComplexity), true 178 179 case "Query.events": 180 if e.complexity.Query.Events == nil { 181 break 182 } 183 184 return e.complexity.Query.Events(childComplexity), true 185 186 } 187 return 0, false 188 } 189 190 func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { 191 ec := executionContext{graphql.GetRequestContext(ctx), e} 192 193 buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { 194 data := ec._Query(ctx, op.SelectionSet) 195 var buf bytes.Buffer 196 data.MarshalGQL(&buf) 197 return buf.Bytes() 198 }) 199 200 return &graphql.Response{ 201 Data: buf, 202 Errors: ec.Errors, 203 Extensions: ec.Extensions} 204 } 205 206 func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { 207 return graphql.ErrorResponse(ctx, "mutations are not supported") 208 } 209 210 func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { 211 return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) 212 } 213 214 type executionContext struct { 215 *graphql.RequestContext 216 *executableSchema 217 } 218 219 var likeImplementors = []string{"Like", "Event"} 220 221 // nolint: gocyclo, errcheck, gas, goconst 222 func (ec *executionContext) _Like(ctx context.Context, sel ast.SelectionSet, obj *Like) graphql.Marshaler { 223 fields := graphql.CollectFields(ctx, sel, likeImplementors) 224 225 out := graphql.NewOrderedMap(len(fields)) 226 invalid := false 227 for i, field := range fields { 228 out.Keys[i] = field.Alias 229 230 switch field.Name { 231 case "__typename": 232 out.Values[i] = graphql.MarshalString("Like") 233 case "reaction": 234 out.Values[i] = ec._Like_reaction(ctx, field, obj) 235 if out.Values[i] == graphql.Null { 236 invalid = true 237 } 238 case "sent": 239 out.Values[i] = ec._Like_sent(ctx, field, obj) 240 if out.Values[i] == graphql.Null { 241 invalid = true 242 } 243 case "selection": 244 out.Values[i] = ec._Like_selection(ctx, field, obj) 245 case "collected": 246 out.Values[i] = ec._Like_collected(ctx, field, obj) 247 default: 248 panic("unknown field " + strconv.Quote(field.Name)) 249 } 250 } 251 252 if invalid { 253 return graphql.Null 254 } 255 return out 256 } 257 258 // nolint: vetshadow 259 func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { 260 rctx := &graphql.ResolverContext{ 261 Object: "Like", 262 Args: nil, 263 Field: field, 264 } 265 ctx = graphql.WithResolverContext(ctx, rctx) 266 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 267 ctx = rctx // use context from middleware stack in children 268 return obj.Reaction, nil 269 }) 270 if resTmp == nil { 271 if !ec.HasError(rctx) { 272 ec.Errorf(ctx, "must not be null") 273 } 274 return graphql.Null 275 } 276 res := resTmp.(string) 277 rctx.Result = res 278 return graphql.MarshalString(res) 279 } 280 281 // nolint: vetshadow 282 func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { 283 rctx := &graphql.ResolverContext{ 284 Object: "Like", 285 Args: nil, 286 Field: field, 287 } 288 ctx = graphql.WithResolverContext(ctx, rctx) 289 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 290 ctx = rctx // use context from middleware stack in children 291 return obj.Sent, nil 292 }) 293 if resTmp == nil { 294 if !ec.HasError(rctx) { 295 ec.Errorf(ctx, "must not be null") 296 } 297 return graphql.Null 298 } 299 res := resTmp.(time.Time) 300 rctx.Result = res 301 return graphql.MarshalTime(res) 302 } 303 304 // nolint: vetshadow 305 func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { 306 rctx := &graphql.ResolverContext{ 307 Object: "Like", 308 Args: nil, 309 Field: field, 310 } 311 ctx = graphql.WithResolverContext(ctx, rctx) 312 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 313 ctx = rctx // use context from middleware stack in children 314 return obj.Selection, nil 315 }) 316 if resTmp == nil { 317 return graphql.Null 318 } 319 res := resTmp.([]string) 320 rctx.Result = res 321 322 arr1 := make(graphql.Array, len(res)) 323 324 for idx1 := range res { 325 arr1[idx1] = func() graphql.Marshaler { 326 return graphql.MarshalString(res[idx1]) 327 }() 328 } 329 330 return arr1 331 } 332 333 // nolint: vetshadow 334 func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { 335 rctx := &graphql.ResolverContext{ 336 Object: "Like", 337 Args: nil, 338 Field: field, 339 } 340 ctx = graphql.WithResolverContext(ctx, rctx) 341 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 342 ctx = rctx // use context from middleware stack in children 343 return obj.Collected, nil 344 }) 345 if resTmp == nil { 346 return graphql.Null 347 } 348 res := resTmp.([]string) 349 rctx.Result = res 350 351 arr1 := make(graphql.Array, len(res)) 352 353 for idx1 := range res { 354 arr1[idx1] = func() graphql.Marshaler { 355 return graphql.MarshalString(res[idx1]) 356 }() 357 } 358 359 return arr1 360 } 361 362 var postImplementors = []string{"Post", "Event"} 363 364 // nolint: gocyclo, errcheck, gas, goconst 365 func (ec *executionContext) _Post(ctx context.Context, sel ast.SelectionSet, obj *Post) graphql.Marshaler { 366 fields := graphql.CollectFields(ctx, sel, postImplementors) 367 368 out := graphql.NewOrderedMap(len(fields)) 369 invalid := false 370 for i, field := range fields { 371 out.Keys[i] = field.Alias 372 373 switch field.Name { 374 case "__typename": 375 out.Values[i] = graphql.MarshalString("Post") 376 case "message": 377 out.Values[i] = ec._Post_message(ctx, field, obj) 378 if out.Values[i] == graphql.Null { 379 invalid = true 380 } 381 case "sent": 382 out.Values[i] = ec._Post_sent(ctx, field, obj) 383 if out.Values[i] == graphql.Null { 384 invalid = true 385 } 386 case "selection": 387 out.Values[i] = ec._Post_selection(ctx, field, obj) 388 case "collected": 389 out.Values[i] = ec._Post_collected(ctx, field, obj) 390 default: 391 panic("unknown field " + strconv.Quote(field.Name)) 392 } 393 } 394 395 if invalid { 396 return graphql.Null 397 } 398 return out 399 } 400 401 // nolint: vetshadow 402 func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { 403 rctx := &graphql.ResolverContext{ 404 Object: "Post", 405 Args: nil, 406 Field: field, 407 } 408 ctx = graphql.WithResolverContext(ctx, rctx) 409 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 410 ctx = rctx // use context from middleware stack in children 411 return obj.Message, nil 412 }) 413 if resTmp == nil { 414 if !ec.HasError(rctx) { 415 ec.Errorf(ctx, "must not be null") 416 } 417 return graphql.Null 418 } 419 res := resTmp.(string) 420 rctx.Result = res 421 return graphql.MarshalString(res) 422 } 423 424 // nolint: vetshadow 425 func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { 426 rctx := &graphql.ResolverContext{ 427 Object: "Post", 428 Args: nil, 429 Field: field, 430 } 431 ctx = graphql.WithResolverContext(ctx, rctx) 432 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 433 ctx = rctx // use context from middleware stack in children 434 return obj.Sent, nil 435 }) 436 if resTmp == nil { 437 if !ec.HasError(rctx) { 438 ec.Errorf(ctx, "must not be null") 439 } 440 return graphql.Null 441 } 442 res := resTmp.(time.Time) 443 rctx.Result = res 444 return graphql.MarshalTime(res) 445 } 446 447 // nolint: vetshadow 448 func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { 449 rctx := &graphql.ResolverContext{ 450 Object: "Post", 451 Args: nil, 452 Field: field, 453 } 454 ctx = graphql.WithResolverContext(ctx, rctx) 455 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 456 ctx = rctx // use context from middleware stack in children 457 return obj.Selection, nil 458 }) 459 if resTmp == nil { 460 return graphql.Null 461 } 462 res := resTmp.([]string) 463 rctx.Result = res 464 465 arr1 := make(graphql.Array, len(res)) 466 467 for idx1 := range res { 468 arr1[idx1] = func() graphql.Marshaler { 469 return graphql.MarshalString(res[idx1]) 470 }() 471 } 472 473 return arr1 474 } 475 476 // nolint: vetshadow 477 func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { 478 rctx := &graphql.ResolverContext{ 479 Object: "Post", 480 Args: nil, 481 Field: field, 482 } 483 ctx = graphql.WithResolverContext(ctx, rctx) 484 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 485 ctx = rctx // use context from middleware stack in children 486 return obj.Collected, nil 487 }) 488 if resTmp == nil { 489 return graphql.Null 490 } 491 res := resTmp.([]string) 492 rctx.Result = res 493 494 arr1 := make(graphql.Array, len(res)) 495 496 for idx1 := range res { 497 arr1[idx1] = func() graphql.Marshaler { 498 return graphql.MarshalString(res[idx1]) 499 }() 500 } 501 502 return arr1 503 } 504 505 var queryImplementors = []string{"Query"} 506 507 // nolint: gocyclo, errcheck, gas, goconst 508 func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 509 fields := graphql.CollectFields(ctx, sel, queryImplementors) 510 511 ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{ 512 Object: "Query", 513 }) 514 515 var wg sync.WaitGroup 516 out := graphql.NewOrderedMap(len(fields)) 517 invalid := false 518 for i, field := range fields { 519 out.Keys[i] = field.Alias 520 521 switch field.Name { 522 case "__typename": 523 out.Values[i] = graphql.MarshalString("Query") 524 case "events": 525 wg.Add(1) 526 go func(i int, field graphql.CollectedField) { 527 out.Values[i] = ec._Query_events(ctx, field) 528 wg.Done() 529 }(i, field) 530 case "__type": 531 out.Values[i] = ec._Query___type(ctx, field) 532 case "__schema": 533 out.Values[i] = ec._Query___schema(ctx, field) 534 default: 535 panic("unknown field " + strconv.Quote(field.Name)) 536 } 537 } 538 wg.Wait() 539 if invalid { 540 return graphql.Null 541 } 542 return out 543 } 544 545 // nolint: vetshadow 546 func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 547 rctx := &graphql.ResolverContext{ 548 Object: "Query", 549 Args: nil, 550 Field: field, 551 } 552 ctx = graphql.WithResolverContext(ctx, rctx) 553 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 554 ctx = rctx // use context from middleware stack in children 555 return ec.resolvers.Query().Events(rctx) 556 }) 557 if resTmp == nil { 558 return graphql.Null 559 } 560 res := resTmp.([]Event) 561 rctx.Result = res 562 563 arr1 := make(graphql.Array, len(res)) 564 var wg sync.WaitGroup 565 566 isLen1 := len(res) == 1 567 if !isLen1 { 568 wg.Add(len(res)) 569 } 570 571 for idx1 := range res { 572 idx1 := idx1 573 rctx := &graphql.ResolverContext{ 574 Index: &idx1, 575 Result: &res[idx1], 576 } 577 ctx := graphql.WithResolverContext(ctx, rctx) 578 f := func(idx1 int) { 579 if !isLen1 { 580 defer wg.Done() 581 } 582 arr1[idx1] = func() graphql.Marshaler { 583 584 return ec._Event(ctx, field.Selections, &res[idx1]) 585 }() 586 } 587 if isLen1 { 588 f(idx1) 589 } else { 590 go f(idx1) 591 } 592 593 } 594 wg.Wait() 595 return arr1 596 } 597 598 // nolint: vetshadow 599 func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 600 rawArgs := field.ArgumentMap(ec.Variables) 601 args, err := field_Query___type_args(rawArgs) 602 if err != nil { 603 ec.Error(ctx, err) 604 return graphql.Null 605 } 606 rctx := &graphql.ResolverContext{ 607 Object: "Query", 608 Args: args, 609 Field: field, 610 } 611 ctx = graphql.WithResolverContext(ctx, rctx) 612 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 613 ctx = rctx // use context from middleware stack in children 614 return ec.introspectType(args["name"].(string)), nil 615 }) 616 if resTmp == nil { 617 return graphql.Null 618 } 619 res := resTmp.(*introspection.Type) 620 rctx.Result = res 621 622 if res == nil { 623 return graphql.Null 624 } 625 626 return ec.___Type(ctx, field.Selections, res) 627 } 628 629 // nolint: vetshadow 630 func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { 631 rctx := &graphql.ResolverContext{ 632 Object: "Query", 633 Args: nil, 634 Field: field, 635 } 636 ctx = graphql.WithResolverContext(ctx, rctx) 637 resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { 638 ctx = rctx // use context from middleware stack in children 639 return ec.introspectSchema(), nil 640 }) 641 if resTmp == nil { 642 return graphql.Null 643 } 644 res := resTmp.(*introspection.Schema) 645 rctx.Result = res 646 647 if res == nil { 648 return graphql.Null 649 } 650 651 return ec.___Schema(ctx, field.Selections, res) 652 } 653 654 var __DirectiveImplementors = []string{"__Directive"} 655 656 // nolint: gocyclo, errcheck, gas, goconst 657 func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { 658 fields := graphql.CollectFields(ctx, sel, __DirectiveImplementors) 659 660 out := graphql.NewOrderedMap(len(fields)) 661 invalid := false 662 for i, field := range fields { 663 out.Keys[i] = field.Alias 664 665 switch field.Name { 666 case "__typename": 667 out.Values[i] = graphql.MarshalString("__Directive") 668 case "name": 669 out.Values[i] = ec.___Directive_name(ctx, field, obj) 670 if out.Values[i] == graphql.Null { 671 invalid = true 672 } 673 case "description": 674 out.Values[i] = ec.___Directive_description(ctx, field, obj) 675 case "locations": 676 out.Values[i] = ec.___Directive_locations(ctx, field, obj) 677 if out.Values[i] == graphql.Null { 678 invalid = true 679 } 680 case "args": 681 out.Values[i] = ec.___Directive_args(ctx, field, obj) 682 if out.Values[i] == graphql.Null { 683 invalid = true 684 } 685 default: 686 panic("unknown field " + strconv.Quote(field.Name)) 687 } 688 } 689 690 if invalid { 691 return graphql.Null 692 } 693 return out 694 } 695 696 // nolint: vetshadow 697 func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 698 rctx := &graphql.ResolverContext{ 699 Object: "__Directive", 700 Args: nil, 701 Field: field, 702 } 703 ctx = graphql.WithResolverContext(ctx, rctx) 704 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 705 ctx = rctx // use context from middleware stack in children 706 return obj.Name, nil 707 }) 708 if resTmp == nil { 709 if !ec.HasError(rctx) { 710 ec.Errorf(ctx, "must not be null") 711 } 712 return graphql.Null 713 } 714 res := resTmp.(string) 715 rctx.Result = res 716 return graphql.MarshalString(res) 717 } 718 719 // nolint: vetshadow 720 func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 721 rctx := &graphql.ResolverContext{ 722 Object: "__Directive", 723 Args: nil, 724 Field: field, 725 } 726 ctx = graphql.WithResolverContext(ctx, rctx) 727 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 728 ctx = rctx // use context from middleware stack in children 729 return obj.Description, nil 730 }) 731 if resTmp == nil { 732 return graphql.Null 733 } 734 res := resTmp.(string) 735 rctx.Result = res 736 return graphql.MarshalString(res) 737 } 738 739 // nolint: vetshadow 740 func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 741 rctx := &graphql.ResolverContext{ 742 Object: "__Directive", 743 Args: nil, 744 Field: field, 745 } 746 ctx = graphql.WithResolverContext(ctx, rctx) 747 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 748 ctx = rctx // use context from middleware stack in children 749 return obj.Locations, nil 750 }) 751 if resTmp == nil { 752 if !ec.HasError(rctx) { 753 ec.Errorf(ctx, "must not be null") 754 } 755 return graphql.Null 756 } 757 res := resTmp.([]string) 758 rctx.Result = res 759 760 arr1 := make(graphql.Array, len(res)) 761 762 for idx1 := range res { 763 arr1[idx1] = func() graphql.Marshaler { 764 return graphql.MarshalString(res[idx1]) 765 }() 766 } 767 768 return arr1 769 } 770 771 // nolint: vetshadow 772 func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { 773 rctx := &graphql.ResolverContext{ 774 Object: "__Directive", 775 Args: nil, 776 Field: field, 777 } 778 ctx = graphql.WithResolverContext(ctx, rctx) 779 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 780 ctx = rctx // use context from middleware stack in children 781 return obj.Args, nil 782 }) 783 if resTmp == nil { 784 if !ec.HasError(rctx) { 785 ec.Errorf(ctx, "must not be null") 786 } 787 return graphql.Null 788 } 789 res := resTmp.([]introspection.InputValue) 790 rctx.Result = res 791 792 arr1 := make(graphql.Array, len(res)) 793 var wg sync.WaitGroup 794 795 isLen1 := len(res) == 1 796 if !isLen1 { 797 wg.Add(len(res)) 798 } 799 800 for idx1 := range res { 801 idx1 := idx1 802 rctx := &graphql.ResolverContext{ 803 Index: &idx1, 804 Result: &res[idx1], 805 } 806 ctx := graphql.WithResolverContext(ctx, rctx) 807 f := func(idx1 int) { 808 if !isLen1 { 809 defer wg.Done() 810 } 811 arr1[idx1] = func() graphql.Marshaler { 812 813 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 814 }() 815 } 816 if isLen1 { 817 f(idx1) 818 } else { 819 go f(idx1) 820 } 821 822 } 823 wg.Wait() 824 return arr1 825 } 826 827 var __EnumValueImplementors = []string{"__EnumValue"} 828 829 // nolint: gocyclo, errcheck, gas, goconst 830 func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { 831 fields := graphql.CollectFields(ctx, sel, __EnumValueImplementors) 832 833 out := graphql.NewOrderedMap(len(fields)) 834 invalid := false 835 for i, field := range fields { 836 out.Keys[i] = field.Alias 837 838 switch field.Name { 839 case "__typename": 840 out.Values[i] = graphql.MarshalString("__EnumValue") 841 case "name": 842 out.Values[i] = ec.___EnumValue_name(ctx, field, obj) 843 if out.Values[i] == graphql.Null { 844 invalid = true 845 } 846 case "description": 847 out.Values[i] = ec.___EnumValue_description(ctx, field, obj) 848 case "isDeprecated": 849 out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) 850 if out.Values[i] == graphql.Null { 851 invalid = true 852 } 853 case "deprecationReason": 854 out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) 855 default: 856 panic("unknown field " + strconv.Quote(field.Name)) 857 } 858 } 859 860 if invalid { 861 return graphql.Null 862 } 863 return out 864 } 865 866 // nolint: vetshadow 867 func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 868 rctx := &graphql.ResolverContext{ 869 Object: "__EnumValue", 870 Args: nil, 871 Field: field, 872 } 873 ctx = graphql.WithResolverContext(ctx, rctx) 874 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 875 ctx = rctx // use context from middleware stack in children 876 return obj.Name, nil 877 }) 878 if resTmp == nil { 879 if !ec.HasError(rctx) { 880 ec.Errorf(ctx, "must not be null") 881 } 882 return graphql.Null 883 } 884 res := resTmp.(string) 885 rctx.Result = res 886 return graphql.MarshalString(res) 887 } 888 889 // nolint: vetshadow 890 func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 891 rctx := &graphql.ResolverContext{ 892 Object: "__EnumValue", 893 Args: nil, 894 Field: field, 895 } 896 ctx = graphql.WithResolverContext(ctx, rctx) 897 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 898 ctx = rctx // use context from middleware stack in children 899 return obj.Description, nil 900 }) 901 if resTmp == nil { 902 return graphql.Null 903 } 904 res := resTmp.(string) 905 rctx.Result = res 906 return graphql.MarshalString(res) 907 } 908 909 // nolint: vetshadow 910 func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 911 rctx := &graphql.ResolverContext{ 912 Object: "__EnumValue", 913 Args: nil, 914 Field: field, 915 } 916 ctx = graphql.WithResolverContext(ctx, rctx) 917 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 918 ctx = rctx // use context from middleware stack in children 919 return obj.IsDeprecated, nil 920 }) 921 if resTmp == nil { 922 if !ec.HasError(rctx) { 923 ec.Errorf(ctx, "must not be null") 924 } 925 return graphql.Null 926 } 927 res := resTmp.(bool) 928 rctx.Result = res 929 return graphql.MarshalBoolean(res) 930 } 931 932 // nolint: vetshadow 933 func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { 934 rctx := &graphql.ResolverContext{ 935 Object: "__EnumValue", 936 Args: nil, 937 Field: field, 938 } 939 ctx = graphql.WithResolverContext(ctx, rctx) 940 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 941 ctx = rctx // use context from middleware stack in children 942 return obj.DeprecationReason, nil 943 }) 944 if resTmp == nil { 945 return graphql.Null 946 } 947 res := resTmp.(string) 948 rctx.Result = res 949 return graphql.MarshalString(res) 950 } 951 952 var __FieldImplementors = []string{"__Field"} 953 954 // nolint: gocyclo, errcheck, gas, goconst 955 func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { 956 fields := graphql.CollectFields(ctx, sel, __FieldImplementors) 957 958 out := graphql.NewOrderedMap(len(fields)) 959 invalid := false 960 for i, field := range fields { 961 out.Keys[i] = field.Alias 962 963 switch field.Name { 964 case "__typename": 965 out.Values[i] = graphql.MarshalString("__Field") 966 case "name": 967 out.Values[i] = ec.___Field_name(ctx, field, obj) 968 if out.Values[i] == graphql.Null { 969 invalid = true 970 } 971 case "description": 972 out.Values[i] = ec.___Field_description(ctx, field, obj) 973 case "args": 974 out.Values[i] = ec.___Field_args(ctx, field, obj) 975 if out.Values[i] == graphql.Null { 976 invalid = true 977 } 978 case "type": 979 out.Values[i] = ec.___Field_type(ctx, field, obj) 980 if out.Values[i] == graphql.Null { 981 invalid = true 982 } 983 case "isDeprecated": 984 out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) 985 if out.Values[i] == graphql.Null { 986 invalid = true 987 } 988 case "deprecationReason": 989 out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) 990 default: 991 panic("unknown field " + strconv.Quote(field.Name)) 992 } 993 } 994 995 if invalid { 996 return graphql.Null 997 } 998 return out 999 } 1000 1001 // nolint: vetshadow 1002 func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1003 rctx := &graphql.ResolverContext{ 1004 Object: "__Field", 1005 Args: nil, 1006 Field: field, 1007 } 1008 ctx = graphql.WithResolverContext(ctx, rctx) 1009 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1010 ctx = rctx // use context from middleware stack in children 1011 return obj.Name, nil 1012 }) 1013 if resTmp == nil { 1014 if !ec.HasError(rctx) { 1015 ec.Errorf(ctx, "must not be null") 1016 } 1017 return graphql.Null 1018 } 1019 res := resTmp.(string) 1020 rctx.Result = res 1021 return graphql.MarshalString(res) 1022 } 1023 1024 // nolint: vetshadow 1025 func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1026 rctx := &graphql.ResolverContext{ 1027 Object: "__Field", 1028 Args: nil, 1029 Field: field, 1030 } 1031 ctx = graphql.WithResolverContext(ctx, rctx) 1032 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1033 ctx = rctx // use context from middleware stack in children 1034 return obj.Description, nil 1035 }) 1036 if resTmp == nil { 1037 return graphql.Null 1038 } 1039 res := resTmp.(string) 1040 rctx.Result = res 1041 return graphql.MarshalString(res) 1042 } 1043 1044 // nolint: vetshadow 1045 func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1046 rctx := &graphql.ResolverContext{ 1047 Object: "__Field", 1048 Args: nil, 1049 Field: field, 1050 } 1051 ctx = graphql.WithResolverContext(ctx, rctx) 1052 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1053 ctx = rctx // use context from middleware stack in children 1054 return obj.Args, nil 1055 }) 1056 if resTmp == nil { 1057 if !ec.HasError(rctx) { 1058 ec.Errorf(ctx, "must not be null") 1059 } 1060 return graphql.Null 1061 } 1062 res := resTmp.([]introspection.InputValue) 1063 rctx.Result = res 1064 1065 arr1 := make(graphql.Array, len(res)) 1066 var wg sync.WaitGroup 1067 1068 isLen1 := len(res) == 1 1069 if !isLen1 { 1070 wg.Add(len(res)) 1071 } 1072 1073 for idx1 := range res { 1074 idx1 := idx1 1075 rctx := &graphql.ResolverContext{ 1076 Index: &idx1, 1077 Result: &res[idx1], 1078 } 1079 ctx := graphql.WithResolverContext(ctx, rctx) 1080 f := func(idx1 int) { 1081 if !isLen1 { 1082 defer wg.Done() 1083 } 1084 arr1[idx1] = func() graphql.Marshaler { 1085 1086 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 1087 }() 1088 } 1089 if isLen1 { 1090 f(idx1) 1091 } else { 1092 go f(idx1) 1093 } 1094 1095 } 1096 wg.Wait() 1097 return arr1 1098 } 1099 1100 // nolint: vetshadow 1101 func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1102 rctx := &graphql.ResolverContext{ 1103 Object: "__Field", 1104 Args: nil, 1105 Field: field, 1106 } 1107 ctx = graphql.WithResolverContext(ctx, rctx) 1108 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1109 ctx = rctx // use context from middleware stack in children 1110 return obj.Type, nil 1111 }) 1112 if resTmp == nil { 1113 if !ec.HasError(rctx) { 1114 ec.Errorf(ctx, "must not be null") 1115 } 1116 return graphql.Null 1117 } 1118 res := resTmp.(*introspection.Type) 1119 rctx.Result = res 1120 1121 if res == nil { 1122 if !ec.HasError(rctx) { 1123 ec.Errorf(ctx, "must not be null") 1124 } 1125 return graphql.Null 1126 } 1127 1128 return ec.___Type(ctx, field.Selections, res) 1129 } 1130 1131 // nolint: vetshadow 1132 func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1133 rctx := &graphql.ResolverContext{ 1134 Object: "__Field", 1135 Args: nil, 1136 Field: field, 1137 } 1138 ctx = graphql.WithResolverContext(ctx, rctx) 1139 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1140 ctx = rctx // use context from middleware stack in children 1141 return obj.IsDeprecated, nil 1142 }) 1143 if resTmp == nil { 1144 if !ec.HasError(rctx) { 1145 ec.Errorf(ctx, "must not be null") 1146 } 1147 return graphql.Null 1148 } 1149 res := resTmp.(bool) 1150 rctx.Result = res 1151 return graphql.MarshalBoolean(res) 1152 } 1153 1154 // nolint: vetshadow 1155 func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { 1156 rctx := &graphql.ResolverContext{ 1157 Object: "__Field", 1158 Args: nil, 1159 Field: field, 1160 } 1161 ctx = graphql.WithResolverContext(ctx, rctx) 1162 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1163 ctx = rctx // use context from middleware stack in children 1164 return obj.DeprecationReason, nil 1165 }) 1166 if resTmp == nil { 1167 return graphql.Null 1168 } 1169 res := resTmp.(string) 1170 rctx.Result = res 1171 return graphql.MarshalString(res) 1172 } 1173 1174 var __InputValueImplementors = []string{"__InputValue"} 1175 1176 // nolint: gocyclo, errcheck, gas, goconst 1177 func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { 1178 fields := graphql.CollectFields(ctx, sel, __InputValueImplementors) 1179 1180 out := graphql.NewOrderedMap(len(fields)) 1181 invalid := false 1182 for i, field := range fields { 1183 out.Keys[i] = field.Alias 1184 1185 switch field.Name { 1186 case "__typename": 1187 out.Values[i] = graphql.MarshalString("__InputValue") 1188 case "name": 1189 out.Values[i] = ec.___InputValue_name(ctx, field, obj) 1190 if out.Values[i] == graphql.Null { 1191 invalid = true 1192 } 1193 case "description": 1194 out.Values[i] = ec.___InputValue_description(ctx, field, obj) 1195 case "type": 1196 out.Values[i] = ec.___InputValue_type(ctx, field, obj) 1197 if out.Values[i] == graphql.Null { 1198 invalid = true 1199 } 1200 case "defaultValue": 1201 out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) 1202 default: 1203 panic("unknown field " + strconv.Quote(field.Name)) 1204 } 1205 } 1206 1207 if invalid { 1208 return graphql.Null 1209 } 1210 return out 1211 } 1212 1213 // nolint: vetshadow 1214 func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1215 rctx := &graphql.ResolverContext{ 1216 Object: "__InputValue", 1217 Args: nil, 1218 Field: field, 1219 } 1220 ctx = graphql.WithResolverContext(ctx, rctx) 1221 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1222 ctx = rctx // use context from middleware stack in children 1223 return obj.Name, nil 1224 }) 1225 if resTmp == nil { 1226 if !ec.HasError(rctx) { 1227 ec.Errorf(ctx, "must not be null") 1228 } 1229 return graphql.Null 1230 } 1231 res := resTmp.(string) 1232 rctx.Result = res 1233 return graphql.MarshalString(res) 1234 } 1235 1236 // nolint: vetshadow 1237 func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1238 rctx := &graphql.ResolverContext{ 1239 Object: "__InputValue", 1240 Args: nil, 1241 Field: field, 1242 } 1243 ctx = graphql.WithResolverContext(ctx, rctx) 1244 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1245 ctx = rctx // use context from middleware stack in children 1246 return obj.Description, nil 1247 }) 1248 if resTmp == nil { 1249 return graphql.Null 1250 } 1251 res := resTmp.(string) 1252 rctx.Result = res 1253 return graphql.MarshalString(res) 1254 } 1255 1256 // nolint: vetshadow 1257 func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1258 rctx := &graphql.ResolverContext{ 1259 Object: "__InputValue", 1260 Args: nil, 1261 Field: field, 1262 } 1263 ctx = graphql.WithResolverContext(ctx, rctx) 1264 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1265 ctx = rctx // use context from middleware stack in children 1266 return obj.Type, nil 1267 }) 1268 if resTmp == nil { 1269 if !ec.HasError(rctx) { 1270 ec.Errorf(ctx, "must not be null") 1271 } 1272 return graphql.Null 1273 } 1274 res := resTmp.(*introspection.Type) 1275 rctx.Result = res 1276 1277 if res == nil { 1278 if !ec.HasError(rctx) { 1279 ec.Errorf(ctx, "must not be null") 1280 } 1281 return graphql.Null 1282 } 1283 1284 return ec.___Type(ctx, field.Selections, res) 1285 } 1286 1287 // nolint: vetshadow 1288 func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { 1289 rctx := &graphql.ResolverContext{ 1290 Object: "__InputValue", 1291 Args: nil, 1292 Field: field, 1293 } 1294 ctx = graphql.WithResolverContext(ctx, rctx) 1295 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1296 ctx = rctx // use context from middleware stack in children 1297 return obj.DefaultValue, nil 1298 }) 1299 if resTmp == nil { 1300 return graphql.Null 1301 } 1302 res := resTmp.(*string) 1303 rctx.Result = res 1304 1305 if res == nil { 1306 return graphql.Null 1307 } 1308 return graphql.MarshalString(*res) 1309 } 1310 1311 var __SchemaImplementors = []string{"__Schema"} 1312 1313 // nolint: gocyclo, errcheck, gas, goconst 1314 func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { 1315 fields := graphql.CollectFields(ctx, sel, __SchemaImplementors) 1316 1317 out := graphql.NewOrderedMap(len(fields)) 1318 invalid := false 1319 for i, field := range fields { 1320 out.Keys[i] = field.Alias 1321 1322 switch field.Name { 1323 case "__typename": 1324 out.Values[i] = graphql.MarshalString("__Schema") 1325 case "types": 1326 out.Values[i] = ec.___Schema_types(ctx, field, obj) 1327 if out.Values[i] == graphql.Null { 1328 invalid = true 1329 } 1330 case "queryType": 1331 out.Values[i] = ec.___Schema_queryType(ctx, field, obj) 1332 if out.Values[i] == graphql.Null { 1333 invalid = true 1334 } 1335 case "mutationType": 1336 out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) 1337 case "subscriptionType": 1338 out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) 1339 case "directives": 1340 out.Values[i] = ec.___Schema_directives(ctx, field, obj) 1341 if out.Values[i] == graphql.Null { 1342 invalid = true 1343 } 1344 default: 1345 panic("unknown field " + strconv.Quote(field.Name)) 1346 } 1347 } 1348 1349 if invalid { 1350 return graphql.Null 1351 } 1352 return out 1353 } 1354 1355 // nolint: vetshadow 1356 func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1357 rctx := &graphql.ResolverContext{ 1358 Object: "__Schema", 1359 Args: nil, 1360 Field: field, 1361 } 1362 ctx = graphql.WithResolverContext(ctx, rctx) 1363 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1364 ctx = rctx // use context from middleware stack in children 1365 return obj.Types(), nil 1366 }) 1367 if resTmp == nil { 1368 if !ec.HasError(rctx) { 1369 ec.Errorf(ctx, "must not be null") 1370 } 1371 return graphql.Null 1372 } 1373 res := resTmp.([]introspection.Type) 1374 rctx.Result = res 1375 1376 arr1 := make(graphql.Array, len(res)) 1377 var wg sync.WaitGroup 1378 1379 isLen1 := len(res) == 1 1380 if !isLen1 { 1381 wg.Add(len(res)) 1382 } 1383 1384 for idx1 := range res { 1385 idx1 := idx1 1386 rctx := &graphql.ResolverContext{ 1387 Index: &idx1, 1388 Result: &res[idx1], 1389 } 1390 ctx := graphql.WithResolverContext(ctx, rctx) 1391 f := func(idx1 int) { 1392 if !isLen1 { 1393 defer wg.Done() 1394 } 1395 arr1[idx1] = func() graphql.Marshaler { 1396 1397 return ec.___Type(ctx, field.Selections, &res[idx1]) 1398 }() 1399 } 1400 if isLen1 { 1401 f(idx1) 1402 } else { 1403 go f(idx1) 1404 } 1405 1406 } 1407 wg.Wait() 1408 return arr1 1409 } 1410 1411 // nolint: vetshadow 1412 func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1413 rctx := &graphql.ResolverContext{ 1414 Object: "__Schema", 1415 Args: nil, 1416 Field: field, 1417 } 1418 ctx = graphql.WithResolverContext(ctx, rctx) 1419 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1420 ctx = rctx // use context from middleware stack in children 1421 return obj.QueryType(), nil 1422 }) 1423 if resTmp == nil { 1424 if !ec.HasError(rctx) { 1425 ec.Errorf(ctx, "must not be null") 1426 } 1427 return graphql.Null 1428 } 1429 res := resTmp.(*introspection.Type) 1430 rctx.Result = res 1431 1432 if res == nil { 1433 if !ec.HasError(rctx) { 1434 ec.Errorf(ctx, "must not be null") 1435 } 1436 return graphql.Null 1437 } 1438 1439 return ec.___Type(ctx, field.Selections, res) 1440 } 1441 1442 // nolint: vetshadow 1443 func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1444 rctx := &graphql.ResolverContext{ 1445 Object: "__Schema", 1446 Args: nil, 1447 Field: field, 1448 } 1449 ctx = graphql.WithResolverContext(ctx, rctx) 1450 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1451 ctx = rctx // use context from middleware stack in children 1452 return obj.MutationType(), nil 1453 }) 1454 if resTmp == nil { 1455 return graphql.Null 1456 } 1457 res := resTmp.(*introspection.Type) 1458 rctx.Result = res 1459 1460 if res == nil { 1461 return graphql.Null 1462 } 1463 1464 return ec.___Type(ctx, field.Selections, res) 1465 } 1466 1467 // nolint: vetshadow 1468 func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1469 rctx := &graphql.ResolverContext{ 1470 Object: "__Schema", 1471 Args: nil, 1472 Field: field, 1473 } 1474 ctx = graphql.WithResolverContext(ctx, rctx) 1475 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1476 ctx = rctx // use context from middleware stack in children 1477 return obj.SubscriptionType(), nil 1478 }) 1479 if resTmp == nil { 1480 return graphql.Null 1481 } 1482 res := resTmp.(*introspection.Type) 1483 rctx.Result = res 1484 1485 if res == nil { 1486 return graphql.Null 1487 } 1488 1489 return ec.___Type(ctx, field.Selections, res) 1490 } 1491 1492 // nolint: vetshadow 1493 func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { 1494 rctx := &graphql.ResolverContext{ 1495 Object: "__Schema", 1496 Args: nil, 1497 Field: field, 1498 } 1499 ctx = graphql.WithResolverContext(ctx, rctx) 1500 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1501 ctx = rctx // use context from middleware stack in children 1502 return obj.Directives(), nil 1503 }) 1504 if resTmp == nil { 1505 if !ec.HasError(rctx) { 1506 ec.Errorf(ctx, "must not be null") 1507 } 1508 return graphql.Null 1509 } 1510 res := resTmp.([]introspection.Directive) 1511 rctx.Result = res 1512 1513 arr1 := make(graphql.Array, len(res)) 1514 var wg sync.WaitGroup 1515 1516 isLen1 := len(res) == 1 1517 if !isLen1 { 1518 wg.Add(len(res)) 1519 } 1520 1521 for idx1 := range res { 1522 idx1 := idx1 1523 rctx := &graphql.ResolverContext{ 1524 Index: &idx1, 1525 Result: &res[idx1], 1526 } 1527 ctx := graphql.WithResolverContext(ctx, rctx) 1528 f := func(idx1 int) { 1529 if !isLen1 { 1530 defer wg.Done() 1531 } 1532 arr1[idx1] = func() graphql.Marshaler { 1533 1534 return ec.___Directive(ctx, field.Selections, &res[idx1]) 1535 }() 1536 } 1537 if isLen1 { 1538 f(idx1) 1539 } else { 1540 go f(idx1) 1541 } 1542 1543 } 1544 wg.Wait() 1545 return arr1 1546 } 1547 1548 var __TypeImplementors = []string{"__Type"} 1549 1550 // nolint: gocyclo, errcheck, gas, goconst 1551 func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { 1552 fields := graphql.CollectFields(ctx, sel, __TypeImplementors) 1553 1554 out := graphql.NewOrderedMap(len(fields)) 1555 invalid := false 1556 for i, field := range fields { 1557 out.Keys[i] = field.Alias 1558 1559 switch field.Name { 1560 case "__typename": 1561 out.Values[i] = graphql.MarshalString("__Type") 1562 case "kind": 1563 out.Values[i] = ec.___Type_kind(ctx, field, obj) 1564 if out.Values[i] == graphql.Null { 1565 invalid = true 1566 } 1567 case "name": 1568 out.Values[i] = ec.___Type_name(ctx, field, obj) 1569 case "description": 1570 out.Values[i] = ec.___Type_description(ctx, field, obj) 1571 case "fields": 1572 out.Values[i] = ec.___Type_fields(ctx, field, obj) 1573 case "interfaces": 1574 out.Values[i] = ec.___Type_interfaces(ctx, field, obj) 1575 case "possibleTypes": 1576 out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) 1577 case "enumValues": 1578 out.Values[i] = ec.___Type_enumValues(ctx, field, obj) 1579 case "inputFields": 1580 out.Values[i] = ec.___Type_inputFields(ctx, field, obj) 1581 case "ofType": 1582 out.Values[i] = ec.___Type_ofType(ctx, field, obj) 1583 default: 1584 panic("unknown field " + strconv.Quote(field.Name)) 1585 } 1586 } 1587 1588 if invalid { 1589 return graphql.Null 1590 } 1591 return out 1592 } 1593 1594 // nolint: vetshadow 1595 func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1596 rctx := &graphql.ResolverContext{ 1597 Object: "__Type", 1598 Args: nil, 1599 Field: field, 1600 } 1601 ctx = graphql.WithResolverContext(ctx, rctx) 1602 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1603 ctx = rctx // use context from middleware stack in children 1604 return obj.Kind(), nil 1605 }) 1606 if resTmp == nil { 1607 if !ec.HasError(rctx) { 1608 ec.Errorf(ctx, "must not be null") 1609 } 1610 return graphql.Null 1611 } 1612 res := resTmp.(string) 1613 rctx.Result = res 1614 return graphql.MarshalString(res) 1615 } 1616 1617 // nolint: vetshadow 1618 func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1619 rctx := &graphql.ResolverContext{ 1620 Object: "__Type", 1621 Args: nil, 1622 Field: field, 1623 } 1624 ctx = graphql.WithResolverContext(ctx, rctx) 1625 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1626 ctx = rctx // use context from middleware stack in children 1627 return obj.Name(), nil 1628 }) 1629 if resTmp == nil { 1630 return graphql.Null 1631 } 1632 res := resTmp.(*string) 1633 rctx.Result = res 1634 1635 if res == nil { 1636 return graphql.Null 1637 } 1638 return graphql.MarshalString(*res) 1639 } 1640 1641 // nolint: vetshadow 1642 func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1643 rctx := &graphql.ResolverContext{ 1644 Object: "__Type", 1645 Args: nil, 1646 Field: field, 1647 } 1648 ctx = graphql.WithResolverContext(ctx, rctx) 1649 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1650 ctx = rctx // use context from middleware stack in children 1651 return obj.Description(), nil 1652 }) 1653 if resTmp == nil { 1654 return graphql.Null 1655 } 1656 res := resTmp.(string) 1657 rctx.Result = res 1658 return graphql.MarshalString(res) 1659 } 1660 1661 // nolint: vetshadow 1662 func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1663 rawArgs := field.ArgumentMap(ec.Variables) 1664 args, err := field___Type_fields_args(rawArgs) 1665 if err != nil { 1666 ec.Error(ctx, err) 1667 return graphql.Null 1668 } 1669 rctx := &graphql.ResolverContext{ 1670 Object: "__Type", 1671 Args: args, 1672 Field: field, 1673 } 1674 ctx = graphql.WithResolverContext(ctx, rctx) 1675 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1676 ctx = rctx // use context from middleware stack in children 1677 return obj.Fields(args["includeDeprecated"].(bool)), nil 1678 }) 1679 if resTmp == nil { 1680 return graphql.Null 1681 } 1682 res := resTmp.([]introspection.Field) 1683 rctx.Result = res 1684 1685 arr1 := make(graphql.Array, len(res)) 1686 var wg sync.WaitGroup 1687 1688 isLen1 := len(res) == 1 1689 if !isLen1 { 1690 wg.Add(len(res)) 1691 } 1692 1693 for idx1 := range res { 1694 idx1 := idx1 1695 rctx := &graphql.ResolverContext{ 1696 Index: &idx1, 1697 Result: &res[idx1], 1698 } 1699 ctx := graphql.WithResolverContext(ctx, rctx) 1700 f := func(idx1 int) { 1701 if !isLen1 { 1702 defer wg.Done() 1703 } 1704 arr1[idx1] = func() graphql.Marshaler { 1705 1706 return ec.___Field(ctx, field.Selections, &res[idx1]) 1707 }() 1708 } 1709 if isLen1 { 1710 f(idx1) 1711 } else { 1712 go f(idx1) 1713 } 1714 1715 } 1716 wg.Wait() 1717 return arr1 1718 } 1719 1720 // nolint: vetshadow 1721 func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1722 rctx := &graphql.ResolverContext{ 1723 Object: "__Type", 1724 Args: nil, 1725 Field: field, 1726 } 1727 ctx = graphql.WithResolverContext(ctx, rctx) 1728 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1729 ctx = rctx // use context from middleware stack in children 1730 return obj.Interfaces(), nil 1731 }) 1732 if resTmp == nil { 1733 return graphql.Null 1734 } 1735 res := resTmp.([]introspection.Type) 1736 rctx.Result = res 1737 1738 arr1 := make(graphql.Array, len(res)) 1739 var wg sync.WaitGroup 1740 1741 isLen1 := len(res) == 1 1742 if !isLen1 { 1743 wg.Add(len(res)) 1744 } 1745 1746 for idx1 := range res { 1747 idx1 := idx1 1748 rctx := &graphql.ResolverContext{ 1749 Index: &idx1, 1750 Result: &res[idx1], 1751 } 1752 ctx := graphql.WithResolverContext(ctx, rctx) 1753 f := func(idx1 int) { 1754 if !isLen1 { 1755 defer wg.Done() 1756 } 1757 arr1[idx1] = func() graphql.Marshaler { 1758 1759 return ec.___Type(ctx, field.Selections, &res[idx1]) 1760 }() 1761 } 1762 if isLen1 { 1763 f(idx1) 1764 } else { 1765 go f(idx1) 1766 } 1767 1768 } 1769 wg.Wait() 1770 return arr1 1771 } 1772 1773 // nolint: vetshadow 1774 func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1775 rctx := &graphql.ResolverContext{ 1776 Object: "__Type", 1777 Args: nil, 1778 Field: field, 1779 } 1780 ctx = graphql.WithResolverContext(ctx, rctx) 1781 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1782 ctx = rctx // use context from middleware stack in children 1783 return obj.PossibleTypes(), nil 1784 }) 1785 if resTmp == nil { 1786 return graphql.Null 1787 } 1788 res := resTmp.([]introspection.Type) 1789 rctx.Result = res 1790 1791 arr1 := make(graphql.Array, len(res)) 1792 var wg sync.WaitGroup 1793 1794 isLen1 := len(res) == 1 1795 if !isLen1 { 1796 wg.Add(len(res)) 1797 } 1798 1799 for idx1 := range res { 1800 idx1 := idx1 1801 rctx := &graphql.ResolverContext{ 1802 Index: &idx1, 1803 Result: &res[idx1], 1804 } 1805 ctx := graphql.WithResolverContext(ctx, rctx) 1806 f := func(idx1 int) { 1807 if !isLen1 { 1808 defer wg.Done() 1809 } 1810 arr1[idx1] = func() graphql.Marshaler { 1811 1812 return ec.___Type(ctx, field.Selections, &res[idx1]) 1813 }() 1814 } 1815 if isLen1 { 1816 f(idx1) 1817 } else { 1818 go f(idx1) 1819 } 1820 1821 } 1822 wg.Wait() 1823 return arr1 1824 } 1825 1826 // nolint: vetshadow 1827 func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1828 rawArgs := field.ArgumentMap(ec.Variables) 1829 args, err := field___Type_enumValues_args(rawArgs) 1830 if err != nil { 1831 ec.Error(ctx, err) 1832 return graphql.Null 1833 } 1834 rctx := &graphql.ResolverContext{ 1835 Object: "__Type", 1836 Args: args, 1837 Field: field, 1838 } 1839 ctx = graphql.WithResolverContext(ctx, rctx) 1840 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1841 ctx = rctx // use context from middleware stack in children 1842 return obj.EnumValues(args["includeDeprecated"].(bool)), nil 1843 }) 1844 if resTmp == nil { 1845 return graphql.Null 1846 } 1847 res := resTmp.([]introspection.EnumValue) 1848 rctx.Result = res 1849 1850 arr1 := make(graphql.Array, len(res)) 1851 var wg sync.WaitGroup 1852 1853 isLen1 := len(res) == 1 1854 if !isLen1 { 1855 wg.Add(len(res)) 1856 } 1857 1858 for idx1 := range res { 1859 idx1 := idx1 1860 rctx := &graphql.ResolverContext{ 1861 Index: &idx1, 1862 Result: &res[idx1], 1863 } 1864 ctx := graphql.WithResolverContext(ctx, rctx) 1865 f := func(idx1 int) { 1866 if !isLen1 { 1867 defer wg.Done() 1868 } 1869 arr1[idx1] = func() graphql.Marshaler { 1870 1871 return ec.___EnumValue(ctx, field.Selections, &res[idx1]) 1872 }() 1873 } 1874 if isLen1 { 1875 f(idx1) 1876 } else { 1877 go f(idx1) 1878 } 1879 1880 } 1881 wg.Wait() 1882 return arr1 1883 } 1884 1885 // nolint: vetshadow 1886 func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1887 rctx := &graphql.ResolverContext{ 1888 Object: "__Type", 1889 Args: nil, 1890 Field: field, 1891 } 1892 ctx = graphql.WithResolverContext(ctx, rctx) 1893 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1894 ctx = rctx // use context from middleware stack in children 1895 return obj.InputFields(), nil 1896 }) 1897 if resTmp == nil { 1898 return graphql.Null 1899 } 1900 res := resTmp.([]introspection.InputValue) 1901 rctx.Result = res 1902 1903 arr1 := make(graphql.Array, len(res)) 1904 var wg sync.WaitGroup 1905 1906 isLen1 := len(res) == 1 1907 if !isLen1 { 1908 wg.Add(len(res)) 1909 } 1910 1911 for idx1 := range res { 1912 idx1 := idx1 1913 rctx := &graphql.ResolverContext{ 1914 Index: &idx1, 1915 Result: &res[idx1], 1916 } 1917 ctx := graphql.WithResolverContext(ctx, rctx) 1918 f := func(idx1 int) { 1919 if !isLen1 { 1920 defer wg.Done() 1921 } 1922 arr1[idx1] = func() graphql.Marshaler { 1923 1924 return ec.___InputValue(ctx, field.Selections, &res[idx1]) 1925 }() 1926 } 1927 if isLen1 { 1928 f(idx1) 1929 } else { 1930 go f(idx1) 1931 } 1932 1933 } 1934 wg.Wait() 1935 return arr1 1936 } 1937 1938 // nolint: vetshadow 1939 func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { 1940 rctx := &graphql.ResolverContext{ 1941 Object: "__Type", 1942 Args: nil, 1943 Field: field, 1944 } 1945 ctx = graphql.WithResolverContext(ctx, rctx) 1946 resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 1947 ctx = rctx // use context from middleware stack in children 1948 return obj.OfType(), nil 1949 }) 1950 if resTmp == nil { 1951 return graphql.Null 1952 } 1953 res := resTmp.(*introspection.Type) 1954 rctx.Result = res 1955 1956 if res == nil { 1957 return graphql.Null 1958 } 1959 1960 return ec.___Type(ctx, field.Selections, res) 1961 } 1962 1963 func (ec *executionContext) _Event(ctx context.Context, sel ast.SelectionSet, obj *Event) graphql.Marshaler { 1964 switch obj := (*obj).(type) { 1965 case nil: 1966 return graphql.Null 1967 case Post: 1968 return ec._Post(ctx, sel, &obj) 1969 case *Post: 1970 return ec._Post(ctx, sel, obj) 1971 case Like: 1972 return ec._Like(ctx, sel, &obj) 1973 case *Like: 1974 return ec._Like(ctx, sel, obj) 1975 default: 1976 panic(fmt.Errorf("unexpected type %T", obj)) 1977 } 1978 } 1979 1980 func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { 1981 defer func() { 1982 if r := recover(); r != nil { 1983 ec.Error(ctx, ec.Recover(ctx, r)) 1984 ret = nil 1985 } 1986 }() 1987 res, err := ec.ResolverMiddleware(ctx, next) 1988 if err != nil { 1989 ec.Error(ctx, err) 1990 return nil 1991 } 1992 return res 1993 } 1994 1995 func (ec *executionContext) introspectSchema() *introspection.Schema { 1996 return introspection.WrapSchema(parsedSchema) 1997 } 1998 1999 func (ec *executionContext) introspectType(name string) *introspection.Type { 2000 return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]) 2001 } 2002 2003 var parsedSchema = gqlparser.MustLoadSchema( 2004 &ast.Source{Name: "schema.graphql", Input: `interface Event { 2005 selection: [String!] 2006 collected: [String!] 2007 } 2008 2009 type Post implements Event { 2010 message: String! 2011 sent: Time! 2012 selection: [String!] 2013 collected: [String!] 2014 } 2015 2016 type Like implements Event { 2017 reaction: String! 2018 sent: Time! 2019 selection: [String!] 2020 collected: [String!] 2021 } 2022 2023 type Query { 2024 events: [Event!] 2025 } 2026 2027 scalar Time 2028 `}, 2029 )