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