github.com/animeshon/gqlgen@v0.13.1-0.20210304133704-3a770431bb6d/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/animeshon/gqlgen/example/federation/reviews/graph/model" 15 "github.com/animeshon/gqlgen/graphql" 16 "github.com/animeshon/gqlgen/graphql/introspection" 17 "github.com/animeshon/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 return ret 2643 } 2644 2645 func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx context.Context, sel ast.SelectionSet, v []fedruntime.Entity) graphql.Marshaler { 2646 ret := make(graphql.Array, len(v)) 2647 var wg sync.WaitGroup 2648 isLen1 := len(v) == 1 2649 if !isLen1 { 2650 wg.Add(len(v)) 2651 } 2652 for i := range v { 2653 i := i 2654 fc := &graphql.FieldContext{ 2655 Index: &i, 2656 Result: &v[i], 2657 } 2658 ctx := graphql.WithFieldContext(ctx, fc) 2659 f := func(i int) { 2660 defer func() { 2661 if r := recover(); r != nil { 2662 ec.Error(ctx, ec.Recover(ctx, r)) 2663 ret = nil 2664 } 2665 }() 2666 if !isLen1 { 2667 defer wg.Done() 2668 } 2669 ret[i] = ec.marshalO_Entity2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx, sel, v[i]) 2670 } 2671 if isLen1 { 2672 f(i) 2673 } else { 2674 go f(i) 2675 } 2676 2677 } 2678 wg.Wait() 2679 return ret 2680 } 2681 2682 func (ec *executionContext) unmarshalN_FieldSet2string(ctx context.Context, v interface{}) (string, error) { 2683 res, err := graphql.UnmarshalString(v) 2684 return res, graphql.ErrorOnPath(ctx, err) 2685 } 2686 2687 func (ec *executionContext) marshalN_FieldSet2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2688 res := graphql.MarshalString(v) 2689 if res == graphql.Null { 2690 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2691 ec.Errorf(ctx, "must not be null") 2692 } 2693 } 2694 return res 2695 } 2696 2697 func (ec *executionContext) marshalN_Service2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐService(ctx context.Context, sel ast.SelectionSet, v fedruntime.Service) graphql.Marshaler { 2698 return ec.__Service(ctx, sel, &v) 2699 } 2700 2701 func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { 2702 return ec.___Directive(ctx, sel, &v) 2703 } 2704 2705 func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { 2706 ret := make(graphql.Array, len(v)) 2707 var wg sync.WaitGroup 2708 isLen1 := len(v) == 1 2709 if !isLen1 { 2710 wg.Add(len(v)) 2711 } 2712 for i := range v { 2713 i := i 2714 fc := &graphql.FieldContext{ 2715 Index: &i, 2716 Result: &v[i], 2717 } 2718 ctx := graphql.WithFieldContext(ctx, fc) 2719 f := func(i int) { 2720 defer func() { 2721 if r := recover(); r != nil { 2722 ec.Error(ctx, ec.Recover(ctx, r)) 2723 ret = nil 2724 } 2725 }() 2726 if !isLen1 { 2727 defer wg.Done() 2728 } 2729 ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) 2730 } 2731 if isLen1 { 2732 f(i) 2733 } else { 2734 go f(i) 2735 } 2736 2737 } 2738 wg.Wait() 2739 return ret 2740 } 2741 2742 func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { 2743 res, err := graphql.UnmarshalString(v) 2744 return res, graphql.ErrorOnPath(ctx, err) 2745 } 2746 2747 func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2748 res := graphql.MarshalString(v) 2749 if res == graphql.Null { 2750 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2751 ec.Errorf(ctx, "must not be null") 2752 } 2753 } 2754 return res 2755 } 2756 2757 func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { 2758 var vSlice []interface{} 2759 if v != nil { 2760 if tmp1, ok := v.([]interface{}); ok { 2761 vSlice = tmp1 2762 } else { 2763 vSlice = []interface{}{v} 2764 } 2765 } 2766 var err error 2767 res := make([]string, len(vSlice)) 2768 for i := range vSlice { 2769 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) 2770 res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) 2771 if err != nil { 2772 return nil, err 2773 } 2774 } 2775 return res, nil 2776 } 2777 2778 func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { 2779 ret := make(graphql.Array, len(v)) 2780 var wg sync.WaitGroup 2781 isLen1 := len(v) == 1 2782 if !isLen1 { 2783 wg.Add(len(v)) 2784 } 2785 for i := range v { 2786 i := i 2787 fc := &graphql.FieldContext{ 2788 Index: &i, 2789 Result: &v[i], 2790 } 2791 ctx := graphql.WithFieldContext(ctx, fc) 2792 f := func(i int) { 2793 defer func() { 2794 if r := recover(); r != nil { 2795 ec.Error(ctx, ec.Recover(ctx, r)) 2796 ret = nil 2797 } 2798 }() 2799 if !isLen1 { 2800 defer wg.Done() 2801 } 2802 ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) 2803 } 2804 if isLen1 { 2805 f(i) 2806 } else { 2807 go f(i) 2808 } 2809 2810 } 2811 wg.Wait() 2812 return ret 2813 } 2814 2815 func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { 2816 return ec.___EnumValue(ctx, sel, &v) 2817 } 2818 2819 func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { 2820 return ec.___Field(ctx, sel, &v) 2821 } 2822 2823 func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { 2824 return ec.___InputValue(ctx, sel, &v) 2825 } 2826 2827 func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { 2828 ret := make(graphql.Array, len(v)) 2829 var wg sync.WaitGroup 2830 isLen1 := len(v) == 1 2831 if !isLen1 { 2832 wg.Add(len(v)) 2833 } 2834 for i := range v { 2835 i := i 2836 fc := &graphql.FieldContext{ 2837 Index: &i, 2838 Result: &v[i], 2839 } 2840 ctx := graphql.WithFieldContext(ctx, fc) 2841 f := func(i int) { 2842 defer func() { 2843 if r := recover(); r != nil { 2844 ec.Error(ctx, ec.Recover(ctx, r)) 2845 ret = nil 2846 } 2847 }() 2848 if !isLen1 { 2849 defer wg.Done() 2850 } 2851 ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) 2852 } 2853 if isLen1 { 2854 f(i) 2855 } else { 2856 go f(i) 2857 } 2858 2859 } 2860 wg.Wait() 2861 return ret 2862 } 2863 2864 func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { 2865 return ec.___Type(ctx, sel, &v) 2866 } 2867 2868 func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { 2869 ret := make(graphql.Array, len(v)) 2870 var wg sync.WaitGroup 2871 isLen1 := len(v) == 1 2872 if !isLen1 { 2873 wg.Add(len(v)) 2874 } 2875 for i := range v { 2876 i := i 2877 fc := &graphql.FieldContext{ 2878 Index: &i, 2879 Result: &v[i], 2880 } 2881 ctx := graphql.WithFieldContext(ctx, fc) 2882 f := func(i int) { 2883 defer func() { 2884 if r := recover(); r != nil { 2885 ec.Error(ctx, ec.Recover(ctx, r)) 2886 ret = nil 2887 } 2888 }() 2889 if !isLen1 { 2890 defer wg.Done() 2891 } 2892 ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) 2893 } 2894 if isLen1 { 2895 f(i) 2896 } else { 2897 go f(i) 2898 } 2899 2900 } 2901 wg.Wait() 2902 return ret 2903 } 2904 2905 func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { 2906 if v == nil { 2907 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2908 ec.Errorf(ctx, "must not be null") 2909 } 2910 return graphql.Null 2911 } 2912 return ec.___Type(ctx, sel, v) 2913 } 2914 2915 func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { 2916 res, err := graphql.UnmarshalString(v) 2917 return res, graphql.ErrorOnPath(ctx, err) 2918 } 2919 2920 func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 2921 res := graphql.MarshalString(v) 2922 if res == graphql.Null { 2923 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 2924 ec.Errorf(ctx, "must not be null") 2925 } 2926 } 2927 return res 2928 } 2929 2930 func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 2931 res, err := graphql.UnmarshalBoolean(v) 2932 return res, graphql.ErrorOnPath(ctx, err) 2933 } 2934 2935 func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { 2936 return graphql.MarshalBoolean(v) 2937 } 2938 2939 func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { 2940 if v == nil { 2941 return nil, nil 2942 } 2943 res, err := graphql.UnmarshalBoolean(v) 2944 return &res, graphql.ErrorOnPath(ctx, err) 2945 } 2946 2947 func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { 2948 if v == nil { 2949 return graphql.Null 2950 } 2951 return graphql.MarshalBoolean(*v) 2952 } 2953 2954 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 { 2955 if v == nil { 2956 return graphql.Null 2957 } 2958 ret := make(graphql.Array, len(v)) 2959 var wg sync.WaitGroup 2960 isLen1 := len(v) == 1 2961 if !isLen1 { 2962 wg.Add(len(v)) 2963 } 2964 for i := range v { 2965 i := i 2966 fc := &graphql.FieldContext{ 2967 Index: &i, 2968 Result: &v[i], 2969 } 2970 ctx := graphql.WithFieldContext(ctx, fc) 2971 f := func(i int) { 2972 defer func() { 2973 if r := recover(); r != nil { 2974 ec.Error(ctx, ec.Recover(ctx, r)) 2975 ret = nil 2976 } 2977 }() 2978 if !isLen1 { 2979 defer wg.Done() 2980 } 2981 ret[i] = ec.marshalOReview2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfederationᚋreviewsᚋgraphᚋmodelᚐReview(ctx, sel, v[i]) 2982 } 2983 if isLen1 { 2984 f(i) 2985 } else { 2986 go f(i) 2987 } 2988 2989 } 2990 wg.Wait() 2991 return ret 2992 } 2993 2994 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 { 2995 if v == nil { 2996 return graphql.Null 2997 } 2998 return ec._Review(ctx, sel, v) 2999 } 3000 3001 func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { 3002 res, err := graphql.UnmarshalString(v) 3003 return res, graphql.ErrorOnPath(ctx, err) 3004 } 3005 3006 func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { 3007 return graphql.MarshalString(v) 3008 } 3009 3010 func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { 3011 if v == nil { 3012 return nil, nil 3013 } 3014 res, err := graphql.UnmarshalString(v) 3015 return &res, graphql.ErrorOnPath(ctx, err) 3016 } 3017 3018 func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { 3019 if v == nil { 3020 return graphql.Null 3021 } 3022 return graphql.MarshalString(*v) 3023 } 3024 3025 func (ec *executionContext) marshalO_Entity2githubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋfedruntimeᚐEntity(ctx context.Context, sel ast.SelectionSet, v fedruntime.Entity) graphql.Marshaler { 3026 if v == nil { 3027 return graphql.Null 3028 } 3029 return ec.__Entity(ctx, sel, v) 3030 } 3031 3032 func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { 3033 if v == nil { 3034 return graphql.Null 3035 } 3036 ret := make(graphql.Array, len(v)) 3037 var wg sync.WaitGroup 3038 isLen1 := len(v) == 1 3039 if !isLen1 { 3040 wg.Add(len(v)) 3041 } 3042 for i := range v { 3043 i := i 3044 fc := &graphql.FieldContext{ 3045 Index: &i, 3046 Result: &v[i], 3047 } 3048 ctx := graphql.WithFieldContext(ctx, fc) 3049 f := func(i int) { 3050 defer func() { 3051 if r := recover(); r != nil { 3052 ec.Error(ctx, ec.Recover(ctx, r)) 3053 ret = nil 3054 } 3055 }() 3056 if !isLen1 { 3057 defer wg.Done() 3058 } 3059 ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) 3060 } 3061 if isLen1 { 3062 f(i) 3063 } else { 3064 go f(i) 3065 } 3066 3067 } 3068 wg.Wait() 3069 return ret 3070 } 3071 3072 func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { 3073 if v == nil { 3074 return graphql.Null 3075 } 3076 ret := make(graphql.Array, len(v)) 3077 var wg sync.WaitGroup 3078 isLen1 := len(v) == 1 3079 if !isLen1 { 3080 wg.Add(len(v)) 3081 } 3082 for i := range v { 3083 i := i 3084 fc := &graphql.FieldContext{ 3085 Index: &i, 3086 Result: &v[i], 3087 } 3088 ctx := graphql.WithFieldContext(ctx, fc) 3089 f := func(i int) { 3090 defer func() { 3091 if r := recover(); r != nil { 3092 ec.Error(ctx, ec.Recover(ctx, r)) 3093 ret = nil 3094 } 3095 }() 3096 if !isLen1 { 3097 defer wg.Done() 3098 } 3099 ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) 3100 } 3101 if isLen1 { 3102 f(i) 3103 } else { 3104 go f(i) 3105 } 3106 3107 } 3108 wg.Wait() 3109 return ret 3110 } 3111 3112 func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { 3113 if v == nil { 3114 return graphql.Null 3115 } 3116 ret := make(graphql.Array, len(v)) 3117 var wg sync.WaitGroup 3118 isLen1 := len(v) == 1 3119 if !isLen1 { 3120 wg.Add(len(v)) 3121 } 3122 for i := range v { 3123 i := i 3124 fc := &graphql.FieldContext{ 3125 Index: &i, 3126 Result: &v[i], 3127 } 3128 ctx := graphql.WithFieldContext(ctx, fc) 3129 f := func(i int) { 3130 defer func() { 3131 if r := recover(); r != nil { 3132 ec.Error(ctx, ec.Recover(ctx, r)) 3133 ret = nil 3134 } 3135 }() 3136 if !isLen1 { 3137 defer wg.Done() 3138 } 3139 ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) 3140 } 3141 if isLen1 { 3142 f(i) 3143 } else { 3144 go f(i) 3145 } 3146 3147 } 3148 wg.Wait() 3149 return ret 3150 } 3151 3152 func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { 3153 if v == nil { 3154 return graphql.Null 3155 } 3156 return ec.___Schema(ctx, sel, v) 3157 } 3158 3159 func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { 3160 if v == nil { 3161 return graphql.Null 3162 } 3163 ret := make(graphql.Array, len(v)) 3164 var wg sync.WaitGroup 3165 isLen1 := len(v) == 1 3166 if !isLen1 { 3167 wg.Add(len(v)) 3168 } 3169 for i := range v { 3170 i := i 3171 fc := &graphql.FieldContext{ 3172 Index: &i, 3173 Result: &v[i], 3174 } 3175 ctx := graphql.WithFieldContext(ctx, fc) 3176 f := func(i int) { 3177 defer func() { 3178 if r := recover(); r != nil { 3179 ec.Error(ctx, ec.Recover(ctx, r)) 3180 ret = nil 3181 } 3182 }() 3183 if !isLen1 { 3184 defer wg.Done() 3185 } 3186 ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) 3187 } 3188 if isLen1 { 3189 f(i) 3190 } else { 3191 go f(i) 3192 } 3193 3194 } 3195 wg.Wait() 3196 return ret 3197 } 3198 3199 func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { 3200 if v == nil { 3201 return graphql.Null 3202 } 3203 return ec.___Type(ctx, sel, v) 3204 } 3205 3206 // endregion ***************************** type.gotpl *****************************