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