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