github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/interfaces.generated.go (about) 1 // Code generated by github.com/luciferinlove/gqlgen, DO NOT EDIT. 2 3 package followschema 4 5 import ( 6 "context" 7 "errors" 8 "fmt" 9 "strconv" 10 "sync" 11 "sync/atomic" 12 13 "github.com/luciferinlove/gqlgen/graphql" 14 "github.com/vektah/gqlparser/v2/ast" 15 ) 16 17 // region ************************** generated!.gotpl ************************** 18 19 type BackedByInterfaceResolver interface { 20 ID(ctx context.Context, obj BackedByInterface) (string, error) 21 } 22 23 // endregion ************************** generated!.gotpl ************************** 24 25 // region ***************************** args.gotpl ***************************** 26 27 // endregion ***************************** args.gotpl ***************************** 28 29 // region ************************** directives.gotpl ************************** 30 31 // endregion ************************** directives.gotpl ************************** 32 33 // region **************************** field.gotpl ***************************** 34 35 func (ec *executionContext) _BackedByInterface_id(ctx context.Context, field graphql.CollectedField, obj BackedByInterface) (ret graphql.Marshaler) { 36 fc, err := ec.fieldContext_BackedByInterface_id(ctx, field) 37 if err != nil { 38 return graphql.Null 39 } 40 ctx = graphql.WithFieldContext(ctx, fc) 41 defer func() { 42 if r := recover(); r != nil { 43 ec.Error(ctx, ec.Recover(ctx, r)) 44 ret = graphql.Null 45 } 46 }() 47 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 48 ctx = rctx // use context from middleware stack in children 49 return ec.resolvers.BackedByInterface().ID(rctx, obj) 50 }) 51 52 if resTmp == nil { 53 if !graphql.HasFieldError(ctx, fc) { 54 ec.Errorf(ctx, "must not be null") 55 } 56 return graphql.Null 57 } 58 res := resTmp.(string) 59 fc.Result = res 60 return ec.marshalNString2string(ctx, field.Selections, res) 61 } 62 63 func (ec *executionContext) fieldContext_BackedByInterface_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 64 fc = &graphql.FieldContext{ 65 Object: "BackedByInterface", 66 Field: field, 67 IsMethod: true, 68 IsResolver: true, 69 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 70 return nil, errors.New("field of type String does not have child fields") 71 }, 72 } 73 return fc, nil 74 } 75 76 func (ec *executionContext) _BackedByInterface_thisShouldBind(ctx context.Context, field graphql.CollectedField, obj BackedByInterface) (ret graphql.Marshaler) { 77 fc, err := ec.fieldContext_BackedByInterface_thisShouldBind(ctx, field) 78 if err != nil { 79 return graphql.Null 80 } 81 ctx = graphql.WithFieldContext(ctx, fc) 82 defer func() { 83 if r := recover(); r != nil { 84 ec.Error(ctx, ec.Recover(ctx, r)) 85 ret = graphql.Null 86 } 87 }() 88 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 89 ctx = rctx // use context from middleware stack in children 90 return obj.ThisShouldBind(), nil 91 }) 92 93 if resTmp == nil { 94 if !graphql.HasFieldError(ctx, fc) { 95 ec.Errorf(ctx, "must not be null") 96 } 97 return graphql.Null 98 } 99 res := resTmp.(string) 100 fc.Result = res 101 return ec.marshalNString2string(ctx, field.Selections, res) 102 } 103 104 func (ec *executionContext) fieldContext_BackedByInterface_thisShouldBind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 105 fc = &graphql.FieldContext{ 106 Object: "BackedByInterface", 107 Field: field, 108 IsMethod: true, 109 IsResolver: false, 110 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 111 return nil, errors.New("field of type String does not have child fields") 112 }, 113 } 114 return fc, nil 115 } 116 117 func (ec *executionContext) _BackedByInterface_thisShouldBindWithError(ctx context.Context, field graphql.CollectedField, obj BackedByInterface) (ret graphql.Marshaler) { 118 fc, err := ec.fieldContext_BackedByInterface_thisShouldBindWithError(ctx, field) 119 if err != nil { 120 return graphql.Null 121 } 122 ctx = graphql.WithFieldContext(ctx, fc) 123 defer func() { 124 if r := recover(); r != nil { 125 ec.Error(ctx, ec.Recover(ctx, r)) 126 ret = graphql.Null 127 } 128 }() 129 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 130 ctx = rctx // use context from middleware stack in children 131 return obj.ThisShouldBindWithError() 132 }) 133 134 if resTmp == nil { 135 if !graphql.HasFieldError(ctx, fc) { 136 ec.Errorf(ctx, "must not be null") 137 } 138 return graphql.Null 139 } 140 res := resTmp.(string) 141 fc.Result = res 142 return ec.marshalNString2string(ctx, field.Selections, res) 143 } 144 145 func (ec *executionContext) fieldContext_BackedByInterface_thisShouldBindWithError(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 146 fc = &graphql.FieldContext{ 147 Object: "BackedByInterface", 148 Field: field, 149 IsMethod: true, 150 IsResolver: false, 151 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 152 return nil, errors.New("field of type String does not have child fields") 153 }, 154 } 155 return fc, nil 156 } 157 158 func (ec *executionContext) _Cat_species(ctx context.Context, field graphql.CollectedField, obj *Cat) (ret graphql.Marshaler) { 159 fc, err := ec.fieldContext_Cat_species(ctx, field) 160 if err != nil { 161 return graphql.Null 162 } 163 ctx = graphql.WithFieldContext(ctx, fc) 164 defer func() { 165 if r := recover(); r != nil { 166 ec.Error(ctx, ec.Recover(ctx, r)) 167 ret = graphql.Null 168 } 169 }() 170 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 171 ctx = rctx // use context from middleware stack in children 172 return obj.Species, nil 173 }) 174 175 if resTmp == nil { 176 if !graphql.HasFieldError(ctx, fc) { 177 ec.Errorf(ctx, "must not be null") 178 } 179 return graphql.Null 180 } 181 res := resTmp.(string) 182 fc.Result = res 183 return ec.marshalNString2string(ctx, field.Selections, res) 184 } 185 186 func (ec *executionContext) fieldContext_Cat_species(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 187 fc = &graphql.FieldContext{ 188 Object: "Cat", 189 Field: field, 190 IsMethod: false, 191 IsResolver: false, 192 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 193 return nil, errors.New("field of type String does not have child fields") 194 }, 195 } 196 return fc, nil 197 } 198 199 func (ec *executionContext) _Cat_catBreed(ctx context.Context, field graphql.CollectedField, obj *Cat) (ret graphql.Marshaler) { 200 fc, err := ec.fieldContext_Cat_catBreed(ctx, field) 201 if err != nil { 202 return graphql.Null 203 } 204 ctx = graphql.WithFieldContext(ctx, fc) 205 defer func() { 206 if r := recover(); r != nil { 207 ec.Error(ctx, ec.Recover(ctx, r)) 208 ret = graphql.Null 209 } 210 }() 211 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 212 ctx = rctx // use context from middleware stack in children 213 return obj.CatBreed, nil 214 }) 215 216 if resTmp == nil { 217 if !graphql.HasFieldError(ctx, fc) { 218 ec.Errorf(ctx, "must not be null") 219 } 220 return graphql.Null 221 } 222 res := resTmp.(string) 223 fc.Result = res 224 return ec.marshalNString2string(ctx, field.Selections, res) 225 } 226 227 func (ec *executionContext) fieldContext_Cat_catBreed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 228 fc = &graphql.FieldContext{ 229 Object: "Cat", 230 Field: field, 231 IsMethod: false, 232 IsResolver: false, 233 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 234 return nil, errors.New("field of type String does not have child fields") 235 }, 236 } 237 return fc, nil 238 } 239 240 func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { 241 fc, err := ec.fieldContext_Circle_radius(ctx, field) 242 if err != nil { 243 return graphql.Null 244 } 245 ctx = graphql.WithFieldContext(ctx, fc) 246 defer func() { 247 if r := recover(); r != nil { 248 ec.Error(ctx, ec.Recover(ctx, r)) 249 ret = graphql.Null 250 } 251 }() 252 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 253 ctx = rctx // use context from middleware stack in children 254 return obj.Radius, nil 255 }) 256 257 if resTmp == nil { 258 return graphql.Null 259 } 260 res := resTmp.(float64) 261 fc.Result = res 262 return ec.marshalOFloat2float64(ctx, field.Selections, res) 263 } 264 265 func (ec *executionContext) fieldContext_Circle_radius(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 266 fc = &graphql.FieldContext{ 267 Object: "Circle", 268 Field: field, 269 IsMethod: false, 270 IsResolver: false, 271 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 272 return nil, errors.New("field of type Float does not have child fields") 273 }, 274 } 275 return fc, nil 276 } 277 278 func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { 279 fc, err := ec.fieldContext_Circle_area(ctx, field) 280 if err != nil { 281 return graphql.Null 282 } 283 ctx = graphql.WithFieldContext(ctx, fc) 284 defer func() { 285 if r := recover(); r != nil { 286 ec.Error(ctx, ec.Recover(ctx, r)) 287 ret = graphql.Null 288 } 289 }() 290 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 291 ctx = rctx // use context from middleware stack in children 292 return obj.Area(), nil 293 }) 294 295 if resTmp == nil { 296 return graphql.Null 297 } 298 res := resTmp.(float64) 299 fc.Result = res 300 return ec.marshalOFloat2float64(ctx, field.Selections, res) 301 } 302 303 func (ec *executionContext) fieldContext_Circle_area(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 304 fc = &graphql.FieldContext{ 305 Object: "Circle", 306 Field: field, 307 IsMethod: true, 308 IsResolver: false, 309 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 310 return nil, errors.New("field of type Float does not have child fields") 311 }, 312 } 313 return fc, nil 314 } 315 316 func (ec *executionContext) _Circle_coordinates(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { 317 fc, err := ec.fieldContext_Circle_coordinates(ctx, field) 318 if err != nil { 319 return graphql.Null 320 } 321 ctx = graphql.WithFieldContext(ctx, fc) 322 defer func() { 323 if r := recover(); r != nil { 324 ec.Error(ctx, ec.Recover(ctx, r)) 325 ret = graphql.Null 326 } 327 }() 328 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 329 ctx = rctx // use context from middleware stack in children 330 return obj.Coordinates, nil 331 }) 332 333 if resTmp == nil { 334 return graphql.Null 335 } 336 res := resTmp.(Coordinates) 337 fc.Result = res 338 return ec.marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCoordinates(ctx, field.Selections, res) 339 } 340 341 func (ec *executionContext) fieldContext_Circle_coordinates(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 342 fc = &graphql.FieldContext{ 343 Object: "Circle", 344 Field: field, 345 IsMethod: false, 346 IsResolver: false, 347 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 348 switch field.Name { 349 case "x": 350 return ec.fieldContext_Coordinates_x(ctx, field) 351 case "y": 352 return ec.fieldContext_Coordinates_y(ctx, field) 353 } 354 return nil, fmt.Errorf("no field named %q was found under type Coordinates", field.Name) 355 }, 356 } 357 return fc, nil 358 } 359 360 func (ec *executionContext) _ConcreteNodeA_id(ctx context.Context, field graphql.CollectedField, obj *ConcreteNodeA) (ret graphql.Marshaler) { 361 fc, err := ec.fieldContext_ConcreteNodeA_id(ctx, field) 362 if err != nil { 363 return graphql.Null 364 } 365 ctx = graphql.WithFieldContext(ctx, fc) 366 defer func() { 367 if r := recover(); r != nil { 368 ec.Error(ctx, ec.Recover(ctx, r)) 369 ret = graphql.Null 370 } 371 }() 372 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 373 ctx = rctx // use context from middleware stack in children 374 return obj.ID, nil 375 }) 376 377 if resTmp == nil { 378 if !graphql.HasFieldError(ctx, fc) { 379 ec.Errorf(ctx, "must not be null") 380 } 381 return graphql.Null 382 } 383 res := resTmp.(string) 384 fc.Result = res 385 return ec.marshalNID2string(ctx, field.Selections, res) 386 } 387 388 func (ec *executionContext) fieldContext_ConcreteNodeA_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 389 fc = &graphql.FieldContext{ 390 Object: "ConcreteNodeA", 391 Field: field, 392 IsMethod: false, 393 IsResolver: false, 394 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 395 return nil, errors.New("field of type ID does not have child fields") 396 }, 397 } 398 return fc, nil 399 } 400 401 func (ec *executionContext) _ConcreteNodeA_child(ctx context.Context, field graphql.CollectedField, obj *ConcreteNodeA) (ret graphql.Marshaler) { 402 fc, err := ec.fieldContext_ConcreteNodeA_child(ctx, field) 403 if err != nil { 404 return graphql.Null 405 } 406 ctx = graphql.WithFieldContext(ctx, fc) 407 defer func() { 408 if r := recover(); r != nil { 409 ec.Error(ctx, ec.Recover(ctx, r)) 410 ret = graphql.Null 411 } 412 }() 413 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 414 ctx = rctx // use context from middleware stack in children 415 return obj.Child() 416 }) 417 418 if resTmp == nil { 419 if !graphql.HasFieldError(ctx, fc) { 420 ec.Errorf(ctx, "must not be null") 421 } 422 return graphql.Null 423 } 424 res := resTmp.(Node) 425 fc.Result = res 426 return ec.marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNode(ctx, field.Selections, res) 427 } 428 429 func (ec *executionContext) fieldContext_ConcreteNodeA_child(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 430 fc = &graphql.FieldContext{ 431 Object: "ConcreteNodeA", 432 Field: field, 433 IsMethod: true, 434 IsResolver: false, 435 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 436 return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") 437 }, 438 } 439 return fc, nil 440 } 441 442 func (ec *executionContext) _ConcreteNodeA_name(ctx context.Context, field graphql.CollectedField, obj *ConcreteNodeA) (ret graphql.Marshaler) { 443 fc, err := ec.fieldContext_ConcreteNodeA_name(ctx, field) 444 if err != nil { 445 return graphql.Null 446 } 447 ctx = graphql.WithFieldContext(ctx, fc) 448 defer func() { 449 if r := recover(); r != nil { 450 ec.Error(ctx, ec.Recover(ctx, r)) 451 ret = graphql.Null 452 } 453 }() 454 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 455 ctx = rctx // use context from middleware stack in children 456 return obj.Name, nil 457 }) 458 459 if resTmp == nil { 460 if !graphql.HasFieldError(ctx, fc) { 461 ec.Errorf(ctx, "must not be null") 462 } 463 return graphql.Null 464 } 465 res := resTmp.(string) 466 fc.Result = res 467 return ec.marshalNString2string(ctx, field.Selections, res) 468 } 469 470 func (ec *executionContext) fieldContext_ConcreteNodeA_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 471 fc = &graphql.FieldContext{ 472 Object: "ConcreteNodeA", 473 Field: field, 474 IsMethod: false, 475 IsResolver: false, 476 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 477 return nil, errors.New("field of type String does not have child fields") 478 }, 479 } 480 return fc, nil 481 } 482 483 func (ec *executionContext) _ConcreteNodeInterface_id(ctx context.Context, field graphql.CollectedField, obj ConcreteNodeInterface) (ret graphql.Marshaler) { 484 fc, err := ec.fieldContext_ConcreteNodeInterface_id(ctx, field) 485 if err != nil { 486 return graphql.Null 487 } 488 ctx = graphql.WithFieldContext(ctx, fc) 489 defer func() { 490 if r := recover(); r != nil { 491 ec.Error(ctx, ec.Recover(ctx, r)) 492 ret = graphql.Null 493 } 494 }() 495 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 496 ctx = rctx // use context from middleware stack in children 497 return obj.ID(), nil 498 }) 499 500 if resTmp == nil { 501 if !graphql.HasFieldError(ctx, fc) { 502 ec.Errorf(ctx, "must not be null") 503 } 504 return graphql.Null 505 } 506 res := resTmp.(string) 507 fc.Result = res 508 return ec.marshalNID2string(ctx, field.Selections, res) 509 } 510 511 func (ec *executionContext) fieldContext_ConcreteNodeInterface_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 512 fc = &graphql.FieldContext{ 513 Object: "ConcreteNodeInterface", 514 Field: field, 515 IsMethod: true, 516 IsResolver: false, 517 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 518 return nil, errors.New("field of type ID does not have child fields") 519 }, 520 } 521 return fc, nil 522 } 523 524 func (ec *executionContext) _ConcreteNodeInterface_child(ctx context.Context, field graphql.CollectedField, obj ConcreteNodeInterface) (ret graphql.Marshaler) { 525 fc, err := ec.fieldContext_ConcreteNodeInterface_child(ctx, field) 526 if err != nil { 527 return graphql.Null 528 } 529 ctx = graphql.WithFieldContext(ctx, fc) 530 defer func() { 531 if r := recover(); r != nil { 532 ec.Error(ctx, ec.Recover(ctx, r)) 533 ret = graphql.Null 534 } 535 }() 536 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 537 ctx = rctx // use context from middleware stack in children 538 return obj.Child() 539 }) 540 541 if resTmp == nil { 542 if !graphql.HasFieldError(ctx, fc) { 543 ec.Errorf(ctx, "must not be null") 544 } 545 return graphql.Null 546 } 547 res := resTmp.(Node) 548 fc.Result = res 549 return ec.marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNode(ctx, field.Selections, res) 550 } 551 552 func (ec *executionContext) fieldContext_ConcreteNodeInterface_child(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 553 fc = &graphql.FieldContext{ 554 Object: "ConcreteNodeInterface", 555 Field: field, 556 IsMethod: true, 557 IsResolver: false, 558 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 559 return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") 560 }, 561 } 562 return fc, nil 563 } 564 565 func (ec *executionContext) _Coordinates_x(ctx context.Context, field graphql.CollectedField, obj *Coordinates) (ret graphql.Marshaler) { 566 fc, err := ec.fieldContext_Coordinates_x(ctx, field) 567 if err != nil { 568 return graphql.Null 569 } 570 ctx = graphql.WithFieldContext(ctx, fc) 571 defer func() { 572 if r := recover(); r != nil { 573 ec.Error(ctx, ec.Recover(ctx, r)) 574 ret = graphql.Null 575 } 576 }() 577 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 578 ctx = rctx // use context from middleware stack in children 579 return obj.X, nil 580 }) 581 582 if resTmp == nil { 583 if !graphql.HasFieldError(ctx, fc) { 584 ec.Errorf(ctx, "must not be null") 585 } 586 return graphql.Null 587 } 588 res := resTmp.(float64) 589 fc.Result = res 590 return ec.marshalNFloat2float64(ctx, field.Selections, res) 591 } 592 593 func (ec *executionContext) fieldContext_Coordinates_x(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 594 fc = &graphql.FieldContext{ 595 Object: "Coordinates", 596 Field: field, 597 IsMethod: false, 598 IsResolver: false, 599 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 600 return nil, errors.New("field of type Float does not have child fields") 601 }, 602 } 603 return fc, nil 604 } 605 606 func (ec *executionContext) _Coordinates_y(ctx context.Context, field graphql.CollectedField, obj *Coordinates) (ret graphql.Marshaler) { 607 fc, err := ec.fieldContext_Coordinates_y(ctx, field) 608 if err != nil { 609 return graphql.Null 610 } 611 ctx = graphql.WithFieldContext(ctx, fc) 612 defer func() { 613 if r := recover(); r != nil { 614 ec.Error(ctx, ec.Recover(ctx, r)) 615 ret = graphql.Null 616 } 617 }() 618 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 619 ctx = rctx // use context from middleware stack in children 620 return obj.Y, nil 621 }) 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.(float64) 630 fc.Result = res 631 return ec.marshalNFloat2float64(ctx, field.Selections, res) 632 } 633 634 func (ec *executionContext) fieldContext_Coordinates_y(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 635 fc = &graphql.FieldContext{ 636 Object: "Coordinates", 637 Field: field, 638 IsMethod: false, 639 IsResolver: false, 640 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 641 return nil, errors.New("field of type Float does not have child fields") 642 }, 643 } 644 return fc, nil 645 } 646 647 func (ec *executionContext) _Dog_species(ctx context.Context, field graphql.CollectedField, obj *Dog) (ret graphql.Marshaler) { 648 fc, err := ec.fieldContext_Dog_species(ctx, field) 649 if err != nil { 650 return graphql.Null 651 } 652 ctx = graphql.WithFieldContext(ctx, fc) 653 defer func() { 654 if r := recover(); r != nil { 655 ec.Error(ctx, ec.Recover(ctx, r)) 656 ret = graphql.Null 657 } 658 }() 659 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 660 ctx = rctx // use context from middleware stack in children 661 return obj.Species, nil 662 }) 663 664 if resTmp == nil { 665 if !graphql.HasFieldError(ctx, fc) { 666 ec.Errorf(ctx, "must not be null") 667 } 668 return graphql.Null 669 } 670 res := resTmp.(string) 671 fc.Result = res 672 return ec.marshalNString2string(ctx, field.Selections, res) 673 } 674 675 func (ec *executionContext) fieldContext_Dog_species(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 676 fc = &graphql.FieldContext{ 677 Object: "Dog", 678 Field: field, 679 IsMethod: false, 680 IsResolver: false, 681 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 682 return nil, errors.New("field of type String does not have child fields") 683 }, 684 } 685 return fc, nil 686 } 687 688 func (ec *executionContext) _Dog_dogBreed(ctx context.Context, field graphql.CollectedField, obj *Dog) (ret graphql.Marshaler) { 689 fc, err := ec.fieldContext_Dog_dogBreed(ctx, field) 690 if err != nil { 691 return graphql.Null 692 } 693 ctx = graphql.WithFieldContext(ctx, fc) 694 defer func() { 695 if r := recover(); r != nil { 696 ec.Error(ctx, ec.Recover(ctx, r)) 697 ret = graphql.Null 698 } 699 }() 700 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 701 ctx = rctx // use context from middleware stack in children 702 return obj.DogBreed, nil 703 }) 704 705 if resTmp == nil { 706 if !graphql.HasFieldError(ctx, fc) { 707 ec.Errorf(ctx, "must not be null") 708 } 709 return graphql.Null 710 } 711 res := resTmp.(string) 712 fc.Result = res 713 return ec.marshalNString2string(ctx, field.Selections, res) 714 } 715 716 func (ec *executionContext) fieldContext_Dog_dogBreed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 717 fc = &graphql.FieldContext{ 718 Object: "Dog", 719 Field: field, 720 IsMethod: false, 721 IsResolver: false, 722 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 723 return nil, errors.New("field of type String does not have child fields") 724 }, 725 } 726 return fc, nil 727 } 728 729 func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { 730 fc, err := ec.fieldContext_Rectangle_length(ctx, field) 731 if err != nil { 732 return graphql.Null 733 } 734 ctx = graphql.WithFieldContext(ctx, fc) 735 defer func() { 736 if r := recover(); r != nil { 737 ec.Error(ctx, ec.Recover(ctx, r)) 738 ret = graphql.Null 739 } 740 }() 741 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 742 ctx = rctx // use context from middleware stack in children 743 return obj.Length, nil 744 }) 745 746 if resTmp == nil { 747 return graphql.Null 748 } 749 res := resTmp.(float64) 750 fc.Result = res 751 return ec.marshalOFloat2float64(ctx, field.Selections, res) 752 } 753 754 func (ec *executionContext) fieldContext_Rectangle_length(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 755 fc = &graphql.FieldContext{ 756 Object: "Rectangle", 757 Field: field, 758 IsMethod: false, 759 IsResolver: false, 760 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 761 return nil, errors.New("field of type Float does not have child fields") 762 }, 763 } 764 return fc, nil 765 } 766 767 func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { 768 fc, err := ec.fieldContext_Rectangle_width(ctx, field) 769 if err != nil { 770 return graphql.Null 771 } 772 ctx = graphql.WithFieldContext(ctx, fc) 773 defer func() { 774 if r := recover(); r != nil { 775 ec.Error(ctx, ec.Recover(ctx, r)) 776 ret = graphql.Null 777 } 778 }() 779 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 780 ctx = rctx // use context from middleware stack in children 781 return obj.Width, nil 782 }) 783 784 if resTmp == nil { 785 return graphql.Null 786 } 787 res := resTmp.(float64) 788 fc.Result = res 789 return ec.marshalOFloat2float64(ctx, field.Selections, res) 790 } 791 792 func (ec *executionContext) fieldContext_Rectangle_width(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 793 fc = &graphql.FieldContext{ 794 Object: "Rectangle", 795 Field: field, 796 IsMethod: false, 797 IsResolver: false, 798 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 799 return nil, errors.New("field of type Float does not have child fields") 800 }, 801 } 802 return fc, nil 803 } 804 805 func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { 806 fc, err := ec.fieldContext_Rectangle_area(ctx, field) 807 if err != nil { 808 return graphql.Null 809 } 810 ctx = graphql.WithFieldContext(ctx, fc) 811 defer func() { 812 if r := recover(); r != nil { 813 ec.Error(ctx, ec.Recover(ctx, r)) 814 ret = graphql.Null 815 } 816 }() 817 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 818 ctx = rctx // use context from middleware stack in children 819 return obj.Area(), nil 820 }) 821 822 if resTmp == nil { 823 return graphql.Null 824 } 825 res := resTmp.(float64) 826 fc.Result = res 827 return ec.marshalOFloat2float64(ctx, field.Selections, res) 828 } 829 830 func (ec *executionContext) fieldContext_Rectangle_area(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 831 fc = &graphql.FieldContext{ 832 Object: "Rectangle", 833 Field: field, 834 IsMethod: true, 835 IsResolver: false, 836 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 837 return nil, errors.New("field of type Float does not have child fields") 838 }, 839 } 840 return fc, nil 841 } 842 843 func (ec *executionContext) _Rectangle_coordinates(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { 844 fc, err := ec.fieldContext_Rectangle_coordinates(ctx, field) 845 if err != nil { 846 return graphql.Null 847 } 848 ctx = graphql.WithFieldContext(ctx, fc) 849 defer func() { 850 if r := recover(); r != nil { 851 ec.Error(ctx, ec.Recover(ctx, r)) 852 ret = graphql.Null 853 } 854 }() 855 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 856 ctx = rctx // use context from middleware stack in children 857 return obj.Coordinates, nil 858 }) 859 860 if resTmp == nil { 861 return graphql.Null 862 } 863 res := resTmp.(Coordinates) 864 fc.Result = res 865 return ec.marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCoordinates(ctx, field.Selections, res) 866 } 867 868 func (ec *executionContext) fieldContext_Rectangle_coordinates(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 869 fc = &graphql.FieldContext{ 870 Object: "Rectangle", 871 Field: field, 872 IsMethod: false, 873 IsResolver: false, 874 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 875 switch field.Name { 876 case "x": 877 return ec.fieldContext_Coordinates_x(ctx, field) 878 case "y": 879 return ec.fieldContext_Coordinates_y(ctx, field) 880 } 881 return nil, fmt.Errorf("no field named %q was found under type Coordinates", field.Name) 882 }, 883 } 884 return fc, nil 885 } 886 887 // endregion **************************** field.gotpl ***************************** 888 889 // region **************************** input.gotpl ***************************** 890 891 // endregion **************************** input.gotpl ***************************** 892 893 // region ************************** interface.gotpl *************************** 894 895 func (ec *executionContext) _Animal(ctx context.Context, sel ast.SelectionSet, obj Animal) graphql.Marshaler { 896 switch obj := (obj).(type) { 897 case nil: 898 return graphql.Null 899 case Dog: 900 return ec._Dog(ctx, sel, &obj) 901 case *Dog: 902 if obj == nil { 903 return graphql.Null 904 } 905 return ec._Dog(ctx, sel, obj) 906 case Cat: 907 return ec._Cat(ctx, sel, &obj) 908 case *Cat: 909 if obj == nil { 910 return graphql.Null 911 } 912 return ec._Cat(ctx, sel, obj) 913 default: 914 panic(fmt.Errorf("unexpected type %T", obj)) 915 } 916 } 917 918 func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj Node) graphql.Marshaler { 919 switch obj := (obj).(type) { 920 case nil: 921 return graphql.Null 922 case *ConcreteNodeA: 923 if obj == nil { 924 return graphql.Null 925 } 926 return ec._ConcreteNodeA(ctx, sel, obj) 927 case ConcreteNodeInterface: 928 if obj == nil { 929 return graphql.Null 930 } 931 return ec._ConcreteNodeInterface(ctx, sel, obj) 932 default: 933 panic(fmt.Errorf("unexpected type %T", obj)) 934 } 935 } 936 937 func (ec *executionContext) _Shape(ctx context.Context, sel ast.SelectionSet, obj Shape) graphql.Marshaler { 938 switch obj := (obj).(type) { 939 case nil: 940 return graphql.Null 941 case *Circle: 942 if obj == nil { 943 return graphql.Null 944 } 945 return ec._Circle(ctx, sel, obj) 946 case *Rectangle: 947 if obj == nil { 948 return graphql.Null 949 } 950 return ec._Rectangle(ctx, sel, obj) 951 default: 952 panic(fmt.Errorf("unexpected type %T", obj)) 953 } 954 } 955 956 func (ec *executionContext) _ShapeUnion(ctx context.Context, sel ast.SelectionSet, obj ShapeUnion) graphql.Marshaler { 957 switch obj := (obj).(type) { 958 case nil: 959 return graphql.Null 960 case *Circle: 961 if obj == nil { 962 return graphql.Null 963 } 964 return ec._Circle(ctx, sel, obj) 965 case *Rectangle: 966 if obj == nil { 967 return graphql.Null 968 } 969 return ec._Rectangle(ctx, sel, obj) 970 default: 971 panic(fmt.Errorf("unexpected type %T", obj)) 972 } 973 } 974 975 // endregion ************************** interface.gotpl *************************** 976 977 // region **************************** object.gotpl **************************** 978 979 var backedByInterfaceImplementors = []string{"BackedByInterface"} 980 981 func (ec *executionContext) _BackedByInterface(ctx context.Context, sel ast.SelectionSet, obj BackedByInterface) graphql.Marshaler { 982 fields := graphql.CollectFields(ec.OperationContext, sel, backedByInterfaceImplementors) 983 out := graphql.NewFieldSet(fields) 984 var invalids uint32 985 for i, field := range fields { 986 switch field.Name { 987 case "__typename": 988 out.Values[i] = graphql.MarshalString("BackedByInterface") 989 case "id": 990 field := field 991 992 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 993 defer func() { 994 if r := recover(); r != nil { 995 ec.Error(ctx, ec.Recover(ctx, r)) 996 } 997 }() 998 res = ec._BackedByInterface_id(ctx, field, obj) 999 if res == graphql.Null { 1000 atomic.AddUint32(&invalids, 1) 1001 } 1002 return res 1003 } 1004 1005 out.Concurrently(i, func() graphql.Marshaler { 1006 return innerFunc(ctx) 1007 1008 }) 1009 case "thisShouldBind": 1010 1011 out.Values[i] = ec._BackedByInterface_thisShouldBind(ctx, field, obj) 1012 1013 if out.Values[i] == graphql.Null { 1014 atomic.AddUint32(&invalids, 1) 1015 } 1016 case "thisShouldBindWithError": 1017 1018 out.Values[i] = ec._BackedByInterface_thisShouldBindWithError(ctx, field, obj) 1019 1020 if out.Values[i] == graphql.Null { 1021 atomic.AddUint32(&invalids, 1) 1022 } 1023 default: 1024 panic("unknown field " + strconv.Quote(field.Name)) 1025 } 1026 } 1027 out.Dispatch() 1028 if invalids > 0 { 1029 return graphql.Null 1030 } 1031 return out 1032 } 1033 1034 var catImplementors = []string{"Cat", "Animal"} 1035 1036 func (ec *executionContext) _Cat(ctx context.Context, sel ast.SelectionSet, obj *Cat) graphql.Marshaler { 1037 fields := graphql.CollectFields(ec.OperationContext, sel, catImplementors) 1038 out := graphql.NewFieldSet(fields) 1039 var invalids uint32 1040 for i, field := range fields { 1041 switch field.Name { 1042 case "__typename": 1043 out.Values[i] = graphql.MarshalString("Cat") 1044 case "species": 1045 1046 out.Values[i] = ec._Cat_species(ctx, field, obj) 1047 1048 if out.Values[i] == graphql.Null { 1049 invalids++ 1050 } 1051 case "catBreed": 1052 1053 out.Values[i] = ec._Cat_catBreed(ctx, field, obj) 1054 1055 if out.Values[i] == graphql.Null { 1056 invalids++ 1057 } 1058 default: 1059 panic("unknown field " + strconv.Quote(field.Name)) 1060 } 1061 } 1062 out.Dispatch() 1063 if invalids > 0 { 1064 return graphql.Null 1065 } 1066 return out 1067 } 1068 1069 var circleImplementors = []string{"Circle", "Shape", "ShapeUnion"} 1070 1071 func (ec *executionContext) _Circle(ctx context.Context, sel ast.SelectionSet, obj *Circle) graphql.Marshaler { 1072 fields := graphql.CollectFields(ec.OperationContext, sel, circleImplementors) 1073 out := graphql.NewFieldSet(fields) 1074 var invalids uint32 1075 for i, field := range fields { 1076 switch field.Name { 1077 case "__typename": 1078 out.Values[i] = graphql.MarshalString("Circle") 1079 case "radius": 1080 1081 out.Values[i] = ec._Circle_radius(ctx, field, obj) 1082 1083 case "area": 1084 1085 out.Values[i] = ec._Circle_area(ctx, field, obj) 1086 1087 case "coordinates": 1088 1089 out.Values[i] = ec._Circle_coordinates(ctx, field, obj) 1090 1091 default: 1092 panic("unknown field " + strconv.Quote(field.Name)) 1093 } 1094 } 1095 out.Dispatch() 1096 if invalids > 0 { 1097 return graphql.Null 1098 } 1099 return out 1100 } 1101 1102 var concreteNodeAImplementors = []string{"ConcreteNodeA", "Node"} 1103 1104 func (ec *executionContext) _ConcreteNodeA(ctx context.Context, sel ast.SelectionSet, obj *ConcreteNodeA) graphql.Marshaler { 1105 fields := graphql.CollectFields(ec.OperationContext, sel, concreteNodeAImplementors) 1106 out := graphql.NewFieldSet(fields) 1107 var invalids uint32 1108 for i, field := range fields { 1109 switch field.Name { 1110 case "__typename": 1111 out.Values[i] = graphql.MarshalString("ConcreteNodeA") 1112 case "id": 1113 1114 out.Values[i] = ec._ConcreteNodeA_id(ctx, field, obj) 1115 1116 if out.Values[i] == graphql.Null { 1117 invalids++ 1118 } 1119 case "child": 1120 1121 out.Values[i] = ec._ConcreteNodeA_child(ctx, field, obj) 1122 1123 if out.Values[i] == graphql.Null { 1124 invalids++ 1125 } 1126 case "name": 1127 1128 out.Values[i] = ec._ConcreteNodeA_name(ctx, field, obj) 1129 1130 if out.Values[i] == graphql.Null { 1131 invalids++ 1132 } 1133 default: 1134 panic("unknown field " + strconv.Quote(field.Name)) 1135 } 1136 } 1137 out.Dispatch() 1138 if invalids > 0 { 1139 return graphql.Null 1140 } 1141 return out 1142 } 1143 1144 var concreteNodeInterfaceImplementors = []string{"ConcreteNodeInterface", "Node"} 1145 1146 func (ec *executionContext) _ConcreteNodeInterface(ctx context.Context, sel ast.SelectionSet, obj ConcreteNodeInterface) graphql.Marshaler { 1147 fields := graphql.CollectFields(ec.OperationContext, sel, concreteNodeInterfaceImplementors) 1148 out := graphql.NewFieldSet(fields) 1149 var invalids uint32 1150 for i, field := range fields { 1151 switch field.Name { 1152 case "__typename": 1153 out.Values[i] = graphql.MarshalString("ConcreteNodeInterface") 1154 case "id": 1155 1156 out.Values[i] = ec._ConcreteNodeInterface_id(ctx, field, obj) 1157 1158 if out.Values[i] == graphql.Null { 1159 invalids++ 1160 } 1161 case "child": 1162 1163 out.Values[i] = ec._ConcreteNodeInterface_child(ctx, field, obj) 1164 1165 if out.Values[i] == graphql.Null { 1166 invalids++ 1167 } 1168 default: 1169 panic("unknown field " + strconv.Quote(field.Name)) 1170 } 1171 } 1172 out.Dispatch() 1173 if invalids > 0 { 1174 return graphql.Null 1175 } 1176 return out 1177 } 1178 1179 var coordinatesImplementors = []string{"Coordinates"} 1180 1181 func (ec *executionContext) _Coordinates(ctx context.Context, sel ast.SelectionSet, obj *Coordinates) graphql.Marshaler { 1182 fields := graphql.CollectFields(ec.OperationContext, sel, coordinatesImplementors) 1183 out := graphql.NewFieldSet(fields) 1184 var invalids uint32 1185 for i, field := range fields { 1186 switch field.Name { 1187 case "__typename": 1188 out.Values[i] = graphql.MarshalString("Coordinates") 1189 case "x": 1190 1191 out.Values[i] = ec._Coordinates_x(ctx, field, obj) 1192 1193 if out.Values[i] == graphql.Null { 1194 invalids++ 1195 } 1196 case "y": 1197 1198 out.Values[i] = ec._Coordinates_y(ctx, field, obj) 1199 1200 if out.Values[i] == graphql.Null { 1201 invalids++ 1202 } 1203 default: 1204 panic("unknown field " + strconv.Quote(field.Name)) 1205 } 1206 } 1207 out.Dispatch() 1208 if invalids > 0 { 1209 return graphql.Null 1210 } 1211 return out 1212 } 1213 1214 var dogImplementors = []string{"Dog", "Animal"} 1215 1216 func (ec *executionContext) _Dog(ctx context.Context, sel ast.SelectionSet, obj *Dog) graphql.Marshaler { 1217 fields := graphql.CollectFields(ec.OperationContext, sel, dogImplementors) 1218 out := graphql.NewFieldSet(fields) 1219 var invalids uint32 1220 for i, field := range fields { 1221 switch field.Name { 1222 case "__typename": 1223 out.Values[i] = graphql.MarshalString("Dog") 1224 case "species": 1225 1226 out.Values[i] = ec._Dog_species(ctx, field, obj) 1227 1228 if out.Values[i] == graphql.Null { 1229 invalids++ 1230 } 1231 case "dogBreed": 1232 1233 out.Values[i] = ec._Dog_dogBreed(ctx, field, obj) 1234 1235 if out.Values[i] == graphql.Null { 1236 invalids++ 1237 } 1238 default: 1239 panic("unknown field " + strconv.Quote(field.Name)) 1240 } 1241 } 1242 out.Dispatch() 1243 if invalids > 0 { 1244 return graphql.Null 1245 } 1246 return out 1247 } 1248 1249 var rectangleImplementors = []string{"Rectangle", "Shape", "ShapeUnion"} 1250 1251 func (ec *executionContext) _Rectangle(ctx context.Context, sel ast.SelectionSet, obj *Rectangle) graphql.Marshaler { 1252 fields := graphql.CollectFields(ec.OperationContext, sel, rectangleImplementors) 1253 out := graphql.NewFieldSet(fields) 1254 var invalids uint32 1255 for i, field := range fields { 1256 switch field.Name { 1257 case "__typename": 1258 out.Values[i] = graphql.MarshalString("Rectangle") 1259 case "length": 1260 1261 out.Values[i] = ec._Rectangle_length(ctx, field, obj) 1262 1263 case "width": 1264 1265 out.Values[i] = ec._Rectangle_width(ctx, field, obj) 1266 1267 case "area": 1268 1269 out.Values[i] = ec._Rectangle_area(ctx, field, obj) 1270 1271 case "coordinates": 1272 1273 out.Values[i] = ec._Rectangle_coordinates(ctx, field, obj) 1274 1275 default: 1276 panic("unknown field " + strconv.Quote(field.Name)) 1277 } 1278 } 1279 out.Dispatch() 1280 if invalids > 0 { 1281 return graphql.Null 1282 } 1283 return out 1284 } 1285 1286 // endregion **************************** object.gotpl **************************** 1287 1288 // region ***************************** type.gotpl ***************************** 1289 1290 func (ec *executionContext) marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNode(ctx context.Context, sel ast.SelectionSet, v Node) graphql.Marshaler { 1291 if v == nil { 1292 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 1293 ec.Errorf(ctx, "the requested element is null which the schema does not allow") 1294 } 1295 return graphql.Null 1296 } 1297 return ec._Node(ctx, sel, v) 1298 } 1299 1300 func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShapeUnion(ctx context.Context, sel ast.SelectionSet, v ShapeUnion) graphql.Marshaler { 1301 if v == nil { 1302 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 1303 ec.Errorf(ctx, "the requested element is null which the schema does not allow") 1304 } 1305 return graphql.Null 1306 } 1307 return ec._ShapeUnion(ctx, sel, v) 1308 } 1309 1310 func (ec *executionContext) marshalOAnimal2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAnimal(ctx context.Context, sel ast.SelectionSet, v Animal) graphql.Marshaler { 1311 if v == nil { 1312 return graphql.Null 1313 } 1314 return ec._Animal(ctx, sel, v) 1315 } 1316 1317 func (ec *executionContext) marshalOBackedByInterface2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐBackedByInterface(ctx context.Context, sel ast.SelectionSet, v BackedByInterface) graphql.Marshaler { 1318 if v == nil { 1319 return graphql.Null 1320 } 1321 return ec._BackedByInterface(ctx, sel, v) 1322 } 1323 1324 func (ec *executionContext) marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCircle(ctx context.Context, sel ast.SelectionSet, v *Circle) graphql.Marshaler { 1325 if v == nil { 1326 return graphql.Null 1327 } 1328 return ec._Circle(ctx, sel, v) 1329 } 1330 1331 func (ec *executionContext) marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCoordinates(ctx context.Context, sel ast.SelectionSet, v Coordinates) graphql.Marshaler { 1332 return ec._Coordinates(ctx, sel, &v) 1333 } 1334 1335 func (ec *executionContext) marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShape(ctx context.Context, sel ast.SelectionSet, v Shape) graphql.Marshaler { 1336 if v == nil { 1337 return graphql.Null 1338 } 1339 return ec._Shape(ctx, sel, v) 1340 } 1341 1342 func (ec *executionContext) marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShape(ctx context.Context, sel ast.SelectionSet, v []Shape) graphql.Marshaler { 1343 if v == nil { 1344 return graphql.Null 1345 } 1346 ret := make(graphql.Array, len(v)) 1347 var wg sync.WaitGroup 1348 isLen1 := len(v) == 1 1349 if !isLen1 { 1350 wg.Add(len(v)) 1351 } 1352 for i := range v { 1353 i := i 1354 fc := &graphql.FieldContext{ 1355 Index: &i, 1356 Result: &v[i], 1357 } 1358 ctx := graphql.WithFieldContext(ctx, fc) 1359 f := func(i int) { 1360 defer func() { 1361 if r := recover(); r != nil { 1362 ec.Error(ctx, ec.Recover(ctx, r)) 1363 ret = nil 1364 } 1365 }() 1366 if !isLen1 { 1367 defer wg.Done() 1368 } 1369 ret[i] = ec.marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShape(ctx, sel, v[i]) 1370 } 1371 if isLen1 { 1372 f(i) 1373 } else { 1374 go f(i) 1375 } 1376 1377 } 1378 wg.Wait() 1379 1380 return ret 1381 } 1382 1383 // endregion ***************************** type.gotpl *****************************