1
2
3 package followschema
4
5 import (
6 "context"
7 "errors"
8 "fmt"
9 "strconv"
10 "sync"
11 "sync/atomic"
12
13 "github.com/99designs/gqlgen/graphql"
14 "github.com/vektah/gqlparser/v2/ast"
15 )
16
17
18
19 type BackedByInterfaceResolver interface {
20 ID(ctx context.Context, obj BackedByInterface) (string, error)
21 }
22
23
24
25
26
27
28
29
30
31
32
33
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
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
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
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
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_size(ctx context.Context, field graphql.CollectedField, obj *Cat) (ret graphql.Marshaler) {
200 fc, err := ec.fieldContext_Cat_size(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
213 return obj.Size, 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.(*Size)
223 fc.Result = res
224 return ec.marshalNSize2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSize(ctx, field.Selections, res)
225 }
226
227 func (ec *executionContext) fieldContext_Cat_size(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 switch field.Name {
235 case "height":
236 return ec.fieldContext_Size_height(ctx, field)
237 case "weight":
238 return ec.fieldContext_Size_weight(ctx, field)
239 }
240 return nil, fmt.Errorf("no field named %q was found under type Size", field.Name)
241 },
242 }
243 return fc, nil
244 }
245
246 func (ec *executionContext) _Cat_catBreed(ctx context.Context, field graphql.CollectedField, obj *Cat) (ret graphql.Marshaler) {
247 fc, err := ec.fieldContext_Cat_catBreed(ctx, field)
248 if err != nil {
249 return graphql.Null
250 }
251 ctx = graphql.WithFieldContext(ctx, fc)
252 defer func() {
253 if r := recover(); r != nil {
254 ec.Error(ctx, ec.Recover(ctx, r))
255 ret = graphql.Null
256 }
257 }()
258 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
259 ctx = rctx
260 return obj.CatBreed, nil
261 })
262
263 if resTmp == nil {
264 if !graphql.HasFieldError(ctx, fc) {
265 ec.Errorf(ctx, "must not be null")
266 }
267 return graphql.Null
268 }
269 res := resTmp.(string)
270 fc.Result = res
271 return ec.marshalNString2string(ctx, field.Selections, res)
272 }
273
274 func (ec *executionContext) fieldContext_Cat_catBreed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
275 fc = &graphql.FieldContext{
276 Object: "Cat",
277 Field: field,
278 IsMethod: false,
279 IsResolver: false,
280 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
281 return nil, errors.New("field of type String does not have child fields")
282 },
283 }
284 return fc, nil
285 }
286
287 func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) {
288 fc, err := ec.fieldContext_Circle_radius(ctx, field)
289 if err != nil {
290 return graphql.Null
291 }
292 ctx = graphql.WithFieldContext(ctx, fc)
293 defer func() {
294 if r := recover(); r != nil {
295 ec.Error(ctx, ec.Recover(ctx, r))
296 ret = graphql.Null
297 }
298 }()
299 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
300 ctx = rctx
301 return obj.Radius, nil
302 })
303
304 if resTmp == nil {
305 return graphql.Null
306 }
307 res := resTmp.(float64)
308 fc.Result = res
309 return ec.marshalOFloat2float64(ctx, field.Selections, res)
310 }
311
312 func (ec *executionContext) fieldContext_Circle_radius(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
313 fc = &graphql.FieldContext{
314 Object: "Circle",
315 Field: field,
316 IsMethod: false,
317 IsResolver: false,
318 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
319 return nil, errors.New("field of type Float does not have child fields")
320 },
321 }
322 return fc, nil
323 }
324
325 func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) {
326 fc, err := ec.fieldContext_Circle_area(ctx, field)
327 if err != nil {
328 return graphql.Null
329 }
330 ctx = graphql.WithFieldContext(ctx, fc)
331 defer func() {
332 if r := recover(); r != nil {
333 ec.Error(ctx, ec.Recover(ctx, r))
334 ret = graphql.Null
335 }
336 }()
337 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
338 ctx = rctx
339 return obj.Area(), nil
340 })
341
342 if resTmp == nil {
343 return graphql.Null
344 }
345 res := resTmp.(float64)
346 fc.Result = res
347 return ec.marshalOFloat2float64(ctx, field.Selections, res)
348 }
349
350 func (ec *executionContext) fieldContext_Circle_area(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
351 fc = &graphql.FieldContext{
352 Object: "Circle",
353 Field: field,
354 IsMethod: true,
355 IsResolver: false,
356 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
357 return nil, errors.New("field of type Float does not have child fields")
358 },
359 }
360 return fc, nil
361 }
362
363 func (ec *executionContext) _Circle_coordinates(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) {
364 fc, err := ec.fieldContext_Circle_coordinates(ctx, field)
365 if err != nil {
366 return graphql.Null
367 }
368 ctx = graphql.WithFieldContext(ctx, fc)
369 defer func() {
370 if r := recover(); r != nil {
371 ec.Error(ctx, ec.Recover(ctx, r))
372 ret = graphql.Null
373 }
374 }()
375 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
376 ctx = rctx
377 return obj.Coordinates, nil
378 })
379
380 if resTmp == nil {
381 return graphql.Null
382 }
383 res := resTmp.(Coordinates)
384 fc.Result = res
385 return ec.marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCoordinates(ctx, field.Selections, res)
386 }
387
388 func (ec *executionContext) fieldContext_Circle_coordinates(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
389 fc = &graphql.FieldContext{
390 Object: "Circle",
391 Field: field,
392 IsMethod: false,
393 IsResolver: false,
394 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
395 switch field.Name {
396 case "x":
397 return ec.fieldContext_Coordinates_x(ctx, field)
398 case "y":
399 return ec.fieldContext_Coordinates_y(ctx, field)
400 }
401 return nil, fmt.Errorf("no field named %q was found under type Coordinates", field.Name)
402 },
403 }
404 return fc, nil
405 }
406
407 func (ec *executionContext) _ConcreteNodeA_id(ctx context.Context, field graphql.CollectedField, obj *ConcreteNodeA) (ret graphql.Marshaler) {
408 fc, err := ec.fieldContext_ConcreteNodeA_id(ctx, field)
409 if err != nil {
410 return graphql.Null
411 }
412 ctx = graphql.WithFieldContext(ctx, fc)
413 defer func() {
414 if r := recover(); r != nil {
415 ec.Error(ctx, ec.Recover(ctx, r))
416 ret = graphql.Null
417 }
418 }()
419 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
420 ctx = rctx
421 return obj.ID, nil
422 })
423
424 if resTmp == nil {
425 if !graphql.HasFieldError(ctx, fc) {
426 ec.Errorf(ctx, "must not be null")
427 }
428 return graphql.Null
429 }
430 res := resTmp.(string)
431 fc.Result = res
432 return ec.marshalNID2string(ctx, field.Selections, res)
433 }
434
435 func (ec *executionContext) fieldContext_ConcreteNodeA_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
436 fc = &graphql.FieldContext{
437 Object: "ConcreteNodeA",
438 Field: field,
439 IsMethod: false,
440 IsResolver: false,
441 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
442 return nil, errors.New("field of type ID does not have child fields")
443 },
444 }
445 return fc, nil
446 }
447
448 func (ec *executionContext) _ConcreteNodeA_child(ctx context.Context, field graphql.CollectedField, obj *ConcreteNodeA) (ret graphql.Marshaler) {
449 fc, err := ec.fieldContext_ConcreteNodeA_child(ctx, field)
450 if err != nil {
451 return graphql.Null
452 }
453 ctx = graphql.WithFieldContext(ctx, fc)
454 defer func() {
455 if r := recover(); r != nil {
456 ec.Error(ctx, ec.Recover(ctx, r))
457 ret = graphql.Null
458 }
459 }()
460 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
461 ctx = rctx
462 return obj.Child()
463 })
464
465 if resTmp == nil {
466 if !graphql.HasFieldError(ctx, fc) {
467 ec.Errorf(ctx, "must not be null")
468 }
469 return graphql.Null
470 }
471 res := resTmp.(Node)
472 fc.Result = res
473 return ec.marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNode(ctx, field.Selections, res)
474 }
475
476 func (ec *executionContext) fieldContext_ConcreteNodeA_child(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
477 fc = &graphql.FieldContext{
478 Object: "ConcreteNodeA",
479 Field: field,
480 IsMethod: true,
481 IsResolver: false,
482 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
483 return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE")
484 },
485 }
486 return fc, nil
487 }
488
489 func (ec *executionContext) _ConcreteNodeA_name(ctx context.Context, field graphql.CollectedField, obj *ConcreteNodeA) (ret graphql.Marshaler) {
490 fc, err := ec.fieldContext_ConcreteNodeA_name(ctx, field)
491 if err != nil {
492 return graphql.Null
493 }
494 ctx = graphql.WithFieldContext(ctx, fc)
495 defer func() {
496 if r := recover(); r != nil {
497 ec.Error(ctx, ec.Recover(ctx, r))
498 ret = graphql.Null
499 }
500 }()
501 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
502 ctx = rctx
503 return obj.Name, nil
504 })
505
506 if resTmp == nil {
507 if !graphql.HasFieldError(ctx, fc) {
508 ec.Errorf(ctx, "must not be null")
509 }
510 return graphql.Null
511 }
512 res := resTmp.(string)
513 fc.Result = res
514 return ec.marshalNString2string(ctx, field.Selections, res)
515 }
516
517 func (ec *executionContext) fieldContext_ConcreteNodeA_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
518 fc = &graphql.FieldContext{
519 Object: "ConcreteNodeA",
520 Field: field,
521 IsMethod: false,
522 IsResolver: false,
523 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
524 return nil, errors.New("field of type String does not have child fields")
525 },
526 }
527 return fc, nil
528 }
529
530 func (ec *executionContext) _ConcreteNodeInterface_id(ctx context.Context, field graphql.CollectedField, obj ConcreteNodeInterface) (ret graphql.Marshaler) {
531 fc, err := ec.fieldContext_ConcreteNodeInterface_id(ctx, field)
532 if err != nil {
533 return graphql.Null
534 }
535 ctx = graphql.WithFieldContext(ctx, fc)
536 defer func() {
537 if r := recover(); r != nil {
538 ec.Error(ctx, ec.Recover(ctx, r))
539 ret = graphql.Null
540 }
541 }()
542 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
543 ctx = rctx
544 return obj.ID(), nil
545 })
546
547 if resTmp == nil {
548 if !graphql.HasFieldError(ctx, fc) {
549 ec.Errorf(ctx, "must not be null")
550 }
551 return graphql.Null
552 }
553 res := resTmp.(string)
554 fc.Result = res
555 return ec.marshalNID2string(ctx, field.Selections, res)
556 }
557
558 func (ec *executionContext) fieldContext_ConcreteNodeInterface_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
559 fc = &graphql.FieldContext{
560 Object: "ConcreteNodeInterface",
561 Field: field,
562 IsMethod: true,
563 IsResolver: false,
564 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
565 return nil, errors.New("field of type ID does not have child fields")
566 },
567 }
568 return fc, nil
569 }
570
571 func (ec *executionContext) _ConcreteNodeInterface_child(ctx context.Context, field graphql.CollectedField, obj ConcreteNodeInterface) (ret graphql.Marshaler) {
572 fc, err := ec.fieldContext_ConcreteNodeInterface_child(ctx, field)
573 if err != nil {
574 return graphql.Null
575 }
576 ctx = graphql.WithFieldContext(ctx, fc)
577 defer func() {
578 if r := recover(); r != nil {
579 ec.Error(ctx, ec.Recover(ctx, r))
580 ret = graphql.Null
581 }
582 }()
583 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
584 ctx = rctx
585 return obj.Child()
586 })
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.(Node)
595 fc.Result = res
596 return ec.marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNode(ctx, field.Selections, res)
597 }
598
599 func (ec *executionContext) fieldContext_ConcreteNodeInterface_child(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
600 fc = &graphql.FieldContext{
601 Object: "ConcreteNodeInterface",
602 Field: field,
603 IsMethod: true,
604 IsResolver: false,
605 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
606 return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE")
607 },
608 }
609 return fc, nil
610 }
611
612 func (ec *executionContext) _Coordinates_x(ctx context.Context, field graphql.CollectedField, obj *Coordinates) (ret graphql.Marshaler) {
613 fc, err := ec.fieldContext_Coordinates_x(ctx, field)
614 if err != nil {
615 return graphql.Null
616 }
617 ctx = graphql.WithFieldContext(ctx, fc)
618 defer func() {
619 if r := recover(); r != nil {
620 ec.Error(ctx, ec.Recover(ctx, r))
621 ret = graphql.Null
622 }
623 }()
624 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
625 ctx = rctx
626 return obj.X, nil
627 })
628
629 if resTmp == nil {
630 if !graphql.HasFieldError(ctx, fc) {
631 ec.Errorf(ctx, "must not be null")
632 }
633 return graphql.Null
634 }
635 res := resTmp.(float64)
636 fc.Result = res
637 return ec.marshalNFloat2float64(ctx, field.Selections, res)
638 }
639
640 func (ec *executionContext) fieldContext_Coordinates_x(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
641 fc = &graphql.FieldContext{
642 Object: "Coordinates",
643 Field: field,
644 IsMethod: false,
645 IsResolver: false,
646 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
647 return nil, errors.New("field of type Float does not have child fields")
648 },
649 }
650 return fc, nil
651 }
652
653 func (ec *executionContext) _Coordinates_y(ctx context.Context, field graphql.CollectedField, obj *Coordinates) (ret graphql.Marshaler) {
654 fc, err := ec.fieldContext_Coordinates_y(ctx, field)
655 if err != nil {
656 return graphql.Null
657 }
658 ctx = graphql.WithFieldContext(ctx, fc)
659 defer func() {
660 if r := recover(); r != nil {
661 ec.Error(ctx, ec.Recover(ctx, r))
662 ret = graphql.Null
663 }
664 }()
665 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
666 ctx = rctx
667 return obj.Y, nil
668 })
669
670 if resTmp == nil {
671 if !graphql.HasFieldError(ctx, fc) {
672 ec.Errorf(ctx, "must not be null")
673 }
674 return graphql.Null
675 }
676 res := resTmp.(float64)
677 fc.Result = res
678 return ec.marshalNFloat2float64(ctx, field.Selections, res)
679 }
680
681 func (ec *executionContext) fieldContext_Coordinates_y(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
682 fc = &graphql.FieldContext{
683 Object: "Coordinates",
684 Field: field,
685 IsMethod: false,
686 IsResolver: false,
687 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
688 return nil, errors.New("field of type Float does not have child fields")
689 },
690 }
691 return fc, nil
692 }
693
694 func (ec *executionContext) _Dog_species(ctx context.Context, field graphql.CollectedField, obj *Dog) (ret graphql.Marshaler) {
695 fc, err := ec.fieldContext_Dog_species(ctx, field)
696 if err != nil {
697 return graphql.Null
698 }
699 ctx = graphql.WithFieldContext(ctx, fc)
700 defer func() {
701 if r := recover(); r != nil {
702 ec.Error(ctx, ec.Recover(ctx, r))
703 ret = graphql.Null
704 }
705 }()
706 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
707 ctx = rctx
708 return obj.Species, nil
709 })
710
711 if resTmp == nil {
712 if !graphql.HasFieldError(ctx, fc) {
713 ec.Errorf(ctx, "must not be null")
714 }
715 return graphql.Null
716 }
717 res := resTmp.(string)
718 fc.Result = res
719 return ec.marshalNString2string(ctx, field.Selections, res)
720 }
721
722 func (ec *executionContext) fieldContext_Dog_species(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
723 fc = &graphql.FieldContext{
724 Object: "Dog",
725 Field: field,
726 IsMethod: false,
727 IsResolver: false,
728 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
729 return nil, errors.New("field of type String does not have child fields")
730 },
731 }
732 return fc, nil
733 }
734
735 func (ec *executionContext) _Dog_size(ctx context.Context, field graphql.CollectedField, obj *Dog) (ret graphql.Marshaler) {
736 fc, err := ec.fieldContext_Dog_size(ctx, field)
737 if err != nil {
738 return graphql.Null
739 }
740 ctx = graphql.WithFieldContext(ctx, fc)
741 defer func() {
742 if r := recover(); r != nil {
743 ec.Error(ctx, ec.Recover(ctx, r))
744 ret = graphql.Null
745 }
746 }()
747 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
748 ctx = rctx
749 return obj.Size, nil
750 })
751
752 if resTmp == nil {
753 if !graphql.HasFieldError(ctx, fc) {
754 ec.Errorf(ctx, "must not be null")
755 }
756 return graphql.Null
757 }
758 res := resTmp.(*Size)
759 fc.Result = res
760 return ec.marshalNSize2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSize(ctx, field.Selections, res)
761 }
762
763 func (ec *executionContext) fieldContext_Dog_size(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
764 fc = &graphql.FieldContext{
765 Object: "Dog",
766 Field: field,
767 IsMethod: false,
768 IsResolver: false,
769 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
770 switch field.Name {
771 case "height":
772 return ec.fieldContext_Size_height(ctx, field)
773 case "weight":
774 return ec.fieldContext_Size_weight(ctx, field)
775 }
776 return nil, fmt.Errorf("no field named %q was found under type Size", field.Name)
777 },
778 }
779 return fc, nil
780 }
781
782 func (ec *executionContext) _Dog_dogBreed(ctx context.Context, field graphql.CollectedField, obj *Dog) (ret graphql.Marshaler) {
783 fc, err := ec.fieldContext_Dog_dogBreed(ctx, field)
784 if err != nil {
785 return graphql.Null
786 }
787 ctx = graphql.WithFieldContext(ctx, fc)
788 defer func() {
789 if r := recover(); r != nil {
790 ec.Error(ctx, ec.Recover(ctx, r))
791 ret = graphql.Null
792 }
793 }()
794 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
795 ctx = rctx
796 return obj.DogBreed, nil
797 })
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.(string)
806 fc.Result = res
807 return ec.marshalNString2string(ctx, field.Selections, res)
808 }
809
810 func (ec *executionContext) fieldContext_Dog_dogBreed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
811 fc = &graphql.FieldContext{
812 Object: "Dog",
813 Field: field,
814 IsMethod: false,
815 IsResolver: false,
816 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
817 return nil, errors.New("field of type String does not have child fields")
818 },
819 }
820 return fc, nil
821 }
822
823 func (ec *executionContext) _Horse_species(ctx context.Context, field graphql.CollectedField, obj *Horse) (ret graphql.Marshaler) {
824 fc, err := ec.fieldContext_Horse_species(ctx, field)
825 if err != nil {
826 return graphql.Null
827 }
828 ctx = graphql.WithFieldContext(ctx, fc)
829 defer func() {
830 if r := recover(); r != nil {
831 ec.Error(ctx, ec.Recover(ctx, r))
832 ret = graphql.Null
833 }
834 }()
835 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
836 ctx = rctx
837 return obj.Species, nil
838 })
839
840 if resTmp == nil {
841 if !graphql.HasFieldError(ctx, fc) {
842 ec.Errorf(ctx, "must not be null")
843 }
844 return graphql.Null
845 }
846 res := resTmp.(string)
847 fc.Result = res
848 return ec.marshalNString2string(ctx, field.Selections, res)
849 }
850
851 func (ec *executionContext) fieldContext_Horse_species(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
852 fc = &graphql.FieldContext{
853 Object: "Horse",
854 Field: field,
855 IsMethod: false,
856 IsResolver: false,
857 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
858 return nil, errors.New("field of type String does not have child fields")
859 },
860 }
861 return fc, nil
862 }
863
864 func (ec *executionContext) _Horse_size(ctx context.Context, field graphql.CollectedField, obj *Horse) (ret graphql.Marshaler) {
865 fc, err := ec.fieldContext_Horse_size(ctx, field)
866 if err != nil {
867 return graphql.Null
868 }
869 ctx = graphql.WithFieldContext(ctx, fc)
870 defer func() {
871 if r := recover(); r != nil {
872 ec.Error(ctx, ec.Recover(ctx, r))
873 ret = graphql.Null
874 }
875 }()
876 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
877 ctx = rctx
878 return obj.Size, nil
879 })
880
881 if resTmp == nil {
882 if !graphql.HasFieldError(ctx, fc) {
883 ec.Errorf(ctx, "must not be null")
884 }
885 return graphql.Null
886 }
887 res := resTmp.(*Size)
888 fc.Result = res
889 return ec.marshalNSize2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSize(ctx, field.Selections, res)
890 }
891
892 func (ec *executionContext) fieldContext_Horse_size(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
893 fc = &graphql.FieldContext{
894 Object: "Horse",
895 Field: field,
896 IsMethod: false,
897 IsResolver: false,
898 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
899 switch field.Name {
900 case "height":
901 return ec.fieldContext_Size_height(ctx, field)
902 case "weight":
903 return ec.fieldContext_Size_weight(ctx, field)
904 }
905 return nil, fmt.Errorf("no field named %q was found under type Size", field.Name)
906 },
907 }
908 return fc, nil
909 }
910
911 func (ec *executionContext) _Horse_horseBreed(ctx context.Context, field graphql.CollectedField, obj *Horse) (ret graphql.Marshaler) {
912 fc, err := ec.fieldContext_Horse_horseBreed(ctx, field)
913 if err != nil {
914 return graphql.Null
915 }
916 ctx = graphql.WithFieldContext(ctx, fc)
917 defer func() {
918 if r := recover(); r != nil {
919 ec.Error(ctx, ec.Recover(ctx, r))
920 ret = graphql.Null
921 }
922 }()
923 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
924 ctx = rctx
925 return obj.HorseBreed, nil
926 })
927
928 if resTmp == nil {
929 if !graphql.HasFieldError(ctx, fc) {
930 ec.Errorf(ctx, "must not be null")
931 }
932 return graphql.Null
933 }
934 res := resTmp.(string)
935 fc.Result = res
936 return ec.marshalNString2string(ctx, field.Selections, res)
937 }
938
939 func (ec *executionContext) fieldContext_Horse_horseBreed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
940 fc = &graphql.FieldContext{
941 Object: "Horse",
942 Field: field,
943 IsMethod: false,
944 IsResolver: false,
945 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
946 return nil, errors.New("field of type String does not have child fields")
947 },
948 }
949 return fc, nil
950 }
951
952 func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) {
953 fc, err := ec.fieldContext_Rectangle_length(ctx, field)
954 if err != nil {
955 return graphql.Null
956 }
957 ctx = graphql.WithFieldContext(ctx, fc)
958 defer func() {
959 if r := recover(); r != nil {
960 ec.Error(ctx, ec.Recover(ctx, r))
961 ret = graphql.Null
962 }
963 }()
964 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
965 ctx = rctx
966 return obj.Length, nil
967 })
968
969 if resTmp == nil {
970 return graphql.Null
971 }
972 res := resTmp.(float64)
973 fc.Result = res
974 return ec.marshalOFloat2float64(ctx, field.Selections, res)
975 }
976
977 func (ec *executionContext) fieldContext_Rectangle_length(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
978 fc = &graphql.FieldContext{
979 Object: "Rectangle",
980 Field: field,
981 IsMethod: false,
982 IsResolver: false,
983 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
984 return nil, errors.New("field of type Float does not have child fields")
985 },
986 }
987 return fc, nil
988 }
989
990 func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) {
991 fc, err := ec.fieldContext_Rectangle_width(ctx, field)
992 if err != nil {
993 return graphql.Null
994 }
995 ctx = graphql.WithFieldContext(ctx, fc)
996 defer func() {
997 if r := recover(); r != nil {
998 ec.Error(ctx, ec.Recover(ctx, r))
999 ret = graphql.Null
1000 }
1001 }()
1002 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
1003 ctx = rctx
1004 return obj.Width, nil
1005 })
1006
1007 if resTmp == nil {
1008 return graphql.Null
1009 }
1010 res := resTmp.(float64)
1011 fc.Result = res
1012 return ec.marshalOFloat2float64(ctx, field.Selections, res)
1013 }
1014
1015 func (ec *executionContext) fieldContext_Rectangle_width(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
1016 fc = &graphql.FieldContext{
1017 Object: "Rectangle",
1018 Field: field,
1019 IsMethod: false,
1020 IsResolver: false,
1021 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
1022 return nil, errors.New("field of type Float does not have child fields")
1023 },
1024 }
1025 return fc, nil
1026 }
1027
1028 func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) {
1029 fc, err := ec.fieldContext_Rectangle_area(ctx, field)
1030 if err != nil {
1031 return graphql.Null
1032 }
1033 ctx = graphql.WithFieldContext(ctx, fc)
1034 defer func() {
1035 if r := recover(); r != nil {
1036 ec.Error(ctx, ec.Recover(ctx, r))
1037 ret = graphql.Null
1038 }
1039 }()
1040 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
1041 ctx = rctx
1042 return obj.Area(), nil
1043 })
1044
1045 if resTmp == nil {
1046 return graphql.Null
1047 }
1048 res := resTmp.(float64)
1049 fc.Result = res
1050 return ec.marshalOFloat2float64(ctx, field.Selections, res)
1051 }
1052
1053 func (ec *executionContext) fieldContext_Rectangle_area(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
1054 fc = &graphql.FieldContext{
1055 Object: "Rectangle",
1056 Field: field,
1057 IsMethod: true,
1058 IsResolver: false,
1059 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
1060 return nil, errors.New("field of type Float does not have child fields")
1061 },
1062 }
1063 return fc, nil
1064 }
1065
1066 func (ec *executionContext) _Rectangle_coordinates(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) {
1067 fc, err := ec.fieldContext_Rectangle_coordinates(ctx, field)
1068 if err != nil {
1069 return graphql.Null
1070 }
1071 ctx = graphql.WithFieldContext(ctx, fc)
1072 defer func() {
1073 if r := recover(); r != nil {
1074 ec.Error(ctx, ec.Recover(ctx, r))
1075 ret = graphql.Null
1076 }
1077 }()
1078 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
1079 ctx = rctx
1080 return obj.Coordinates, nil
1081 })
1082
1083 if resTmp == nil {
1084 return graphql.Null
1085 }
1086 res := resTmp.(Coordinates)
1087 fc.Result = res
1088 return ec.marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCoordinates(ctx, field.Selections, res)
1089 }
1090
1091 func (ec *executionContext) fieldContext_Rectangle_coordinates(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
1092 fc = &graphql.FieldContext{
1093 Object: "Rectangle",
1094 Field: field,
1095 IsMethod: false,
1096 IsResolver: false,
1097 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
1098 switch field.Name {
1099 case "x":
1100 return ec.fieldContext_Coordinates_x(ctx, field)
1101 case "y":
1102 return ec.fieldContext_Coordinates_y(ctx, field)
1103 }
1104 return nil, fmt.Errorf("no field named %q was found under type Coordinates", field.Name)
1105 },
1106 }
1107 return fc, nil
1108 }
1109
1110 func (ec *executionContext) _Size_height(ctx context.Context, field graphql.CollectedField, obj *Size) (ret graphql.Marshaler) {
1111 fc, err := ec.fieldContext_Size_height(ctx, field)
1112 if err != nil {
1113 return graphql.Null
1114 }
1115 ctx = graphql.WithFieldContext(ctx, fc)
1116 defer func() {
1117 if r := recover(); r != nil {
1118 ec.Error(ctx, ec.Recover(ctx, r))
1119 ret = graphql.Null
1120 }
1121 }()
1122 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
1123 ctx = rctx
1124 return obj.Height, nil
1125 })
1126
1127 if resTmp == nil {
1128 if !graphql.HasFieldError(ctx, fc) {
1129 ec.Errorf(ctx, "must not be null")
1130 }
1131 return graphql.Null
1132 }
1133 res := resTmp.(int)
1134 fc.Result = res
1135 return ec.marshalNInt2int(ctx, field.Selections, res)
1136 }
1137
1138 func (ec *executionContext) fieldContext_Size_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
1139 fc = &graphql.FieldContext{
1140 Object: "Size",
1141 Field: field,
1142 IsMethod: false,
1143 IsResolver: false,
1144 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
1145 return nil, errors.New("field of type Int does not have child fields")
1146 },
1147 }
1148 return fc, nil
1149 }
1150
1151 func (ec *executionContext) _Size_weight(ctx context.Context, field graphql.CollectedField, obj *Size) (ret graphql.Marshaler) {
1152 fc, err := ec.fieldContext_Size_weight(ctx, field)
1153 if err != nil {
1154 return graphql.Null
1155 }
1156 ctx = graphql.WithFieldContext(ctx, fc)
1157 defer func() {
1158 if r := recover(); r != nil {
1159 ec.Error(ctx, ec.Recover(ctx, r))
1160 ret = graphql.Null
1161 }
1162 }()
1163 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
1164 ctx = rctx
1165 return obj.Weight, nil
1166 })
1167
1168 if resTmp == nil {
1169 if !graphql.HasFieldError(ctx, fc) {
1170 ec.Errorf(ctx, "must not be null")
1171 }
1172 return graphql.Null
1173 }
1174 res := resTmp.(int)
1175 fc.Result = res
1176 return ec.marshalNInt2int(ctx, field.Selections, res)
1177 }
1178
1179 func (ec *executionContext) fieldContext_Size_weight(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
1180 fc = &graphql.FieldContext{
1181 Object: "Size",
1182 Field: field,
1183 IsMethod: false,
1184 IsResolver: false,
1185 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
1186 return nil, errors.New("field of type Int does not have child fields")
1187 },
1188 }
1189 return fc, nil
1190 }
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200 func (ec *executionContext) _Animal(ctx context.Context, sel ast.SelectionSet, obj Animal) graphql.Marshaler {
1201 switch obj := (obj).(type) {
1202 case nil:
1203 return graphql.Null
1204 case Horse:
1205 return ec._Horse(ctx, sel, &obj)
1206 case *Horse:
1207 if obj == nil {
1208 return graphql.Null
1209 }
1210 return ec._Horse(ctx, sel, obj)
1211 case Dog:
1212 return ec._Dog(ctx, sel, &obj)
1213 case *Dog:
1214 if obj == nil {
1215 return graphql.Null
1216 }
1217 return ec._Dog(ctx, sel, obj)
1218 case Cat:
1219 return ec._Cat(ctx, sel, &obj)
1220 case *Cat:
1221 if obj == nil {
1222 return graphql.Null
1223 }
1224 return ec._Cat(ctx, sel, obj)
1225 case Mammalian:
1226 if obj == nil {
1227 return graphql.Null
1228 }
1229 return ec._Mammalian(ctx, sel, obj)
1230 default:
1231 panic(fmt.Errorf("unexpected type %T", obj))
1232 }
1233 }
1234
1235 func (ec *executionContext) _Mammalian(ctx context.Context, sel ast.SelectionSet, obj Mammalian) graphql.Marshaler {
1236 switch obj := (obj).(type) {
1237 case nil:
1238 return graphql.Null
1239 case Horse:
1240 return ec._Horse(ctx, sel, &obj)
1241 case *Horse:
1242 if obj == nil {
1243 return graphql.Null
1244 }
1245 return ec._Horse(ctx, sel, obj)
1246 default:
1247 panic(fmt.Errorf("unexpected type %T", obj))
1248 }
1249 }
1250
1251 func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj Node) graphql.Marshaler {
1252 switch obj := (obj).(type) {
1253 case nil:
1254 return graphql.Null
1255 case *ConcreteNodeA:
1256 if obj == nil {
1257 return graphql.Null
1258 }
1259 return ec._ConcreteNodeA(ctx, sel, obj)
1260 case ConcreteNodeInterface:
1261 if obj == nil {
1262 return graphql.Null
1263 }
1264 return ec._ConcreteNodeInterface(ctx, sel, obj)
1265 default:
1266 panic(fmt.Errorf("unexpected type %T", obj))
1267 }
1268 }
1269
1270 func (ec *executionContext) _Shape(ctx context.Context, sel ast.SelectionSet, obj Shape) graphql.Marshaler {
1271 switch obj := (obj).(type) {
1272 case nil:
1273 return graphql.Null
1274 case *Circle:
1275 if obj == nil {
1276 return graphql.Null
1277 }
1278 return ec._Circle(ctx, sel, obj)
1279 case *Rectangle:
1280 if obj == nil {
1281 return graphql.Null
1282 }
1283 return ec._Rectangle(ctx, sel, obj)
1284 default:
1285 panic(fmt.Errorf("unexpected type %T", obj))
1286 }
1287 }
1288
1289 func (ec *executionContext) _ShapeUnion(ctx context.Context, sel ast.SelectionSet, obj ShapeUnion) graphql.Marshaler {
1290 switch obj := (obj).(type) {
1291 case nil:
1292 return graphql.Null
1293 case *Circle:
1294 if obj == nil {
1295 return graphql.Null
1296 }
1297 return ec._Circle(ctx, sel, obj)
1298 case *Rectangle:
1299 if obj == nil {
1300 return graphql.Null
1301 }
1302 return ec._Rectangle(ctx, sel, obj)
1303 default:
1304 panic(fmt.Errorf("unexpected type %T", obj))
1305 }
1306 }
1307
1308
1309
1310
1311
1312 var backedByInterfaceImplementors = []string{"BackedByInterface"}
1313
1314 func (ec *executionContext) _BackedByInterface(ctx context.Context, sel ast.SelectionSet, obj BackedByInterface) graphql.Marshaler {
1315 fields := graphql.CollectFields(ec.OperationContext, sel, backedByInterfaceImplementors)
1316
1317 out := graphql.NewFieldSet(fields)
1318 deferred := make(map[string]*graphql.FieldSet)
1319 for i, field := range fields {
1320 switch field.Name {
1321 case "__typename":
1322 out.Values[i] = graphql.MarshalString("BackedByInterface")
1323 case "id":
1324 field := field
1325
1326 innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
1327 defer func() {
1328 if r := recover(); r != nil {
1329 ec.Error(ctx, ec.Recover(ctx, r))
1330 }
1331 }()
1332 res = ec._BackedByInterface_id(ctx, field, obj)
1333 if res == graphql.Null {
1334 atomic.AddUint32(&fs.Invalids, 1)
1335 }
1336 return res
1337 }
1338
1339 if field.Deferrable != nil {
1340 dfs, ok := deferred[field.Deferrable.Label]
1341 di := 0
1342 if ok {
1343 dfs.AddField(field)
1344 di = len(dfs.Values) - 1
1345 } else {
1346 dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
1347 deferred[field.Deferrable.Label] = dfs
1348 }
1349 dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
1350 return innerFunc(ctx, dfs)
1351 })
1352
1353
1354 out.Values[i] = graphql.Null
1355 continue
1356 }
1357
1358 out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
1359 case "thisShouldBind":
1360 out.Values[i] = ec._BackedByInterface_thisShouldBind(ctx, field, obj)
1361 if out.Values[i] == graphql.Null {
1362 atomic.AddUint32(&out.Invalids, 1)
1363 }
1364 case "thisShouldBindWithError":
1365 out.Values[i] = ec._BackedByInterface_thisShouldBindWithError(ctx, field, obj)
1366 if out.Values[i] == graphql.Null {
1367 atomic.AddUint32(&out.Invalids, 1)
1368 }
1369 default:
1370 panic("unknown field " + strconv.Quote(field.Name))
1371 }
1372 }
1373 out.Dispatch(ctx)
1374 if out.Invalids > 0 {
1375 return graphql.Null
1376 }
1377
1378 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1379
1380 for label, dfs := range deferred {
1381 ec.processDeferredGroup(graphql.DeferredGroup{
1382 Label: label,
1383 Path: graphql.GetPath(ctx),
1384 FieldSet: dfs,
1385 Context: ctx,
1386 })
1387 }
1388
1389 return out
1390 }
1391
1392 var catImplementors = []string{"Cat", "Animal"}
1393
1394 func (ec *executionContext) _Cat(ctx context.Context, sel ast.SelectionSet, obj *Cat) graphql.Marshaler {
1395 fields := graphql.CollectFields(ec.OperationContext, sel, catImplementors)
1396
1397 out := graphql.NewFieldSet(fields)
1398 deferred := make(map[string]*graphql.FieldSet)
1399 for i, field := range fields {
1400 switch field.Name {
1401 case "__typename":
1402 out.Values[i] = graphql.MarshalString("Cat")
1403 case "species":
1404 out.Values[i] = ec._Cat_species(ctx, field, obj)
1405 if out.Values[i] == graphql.Null {
1406 out.Invalids++
1407 }
1408 case "size":
1409 out.Values[i] = ec._Cat_size(ctx, field, obj)
1410 if out.Values[i] == graphql.Null {
1411 out.Invalids++
1412 }
1413 case "catBreed":
1414 out.Values[i] = ec._Cat_catBreed(ctx, field, obj)
1415 if out.Values[i] == graphql.Null {
1416 out.Invalids++
1417 }
1418 default:
1419 panic("unknown field " + strconv.Quote(field.Name))
1420 }
1421 }
1422 out.Dispatch(ctx)
1423 if out.Invalids > 0 {
1424 return graphql.Null
1425 }
1426
1427 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1428
1429 for label, dfs := range deferred {
1430 ec.processDeferredGroup(graphql.DeferredGroup{
1431 Label: label,
1432 Path: graphql.GetPath(ctx),
1433 FieldSet: dfs,
1434 Context: ctx,
1435 })
1436 }
1437
1438 return out
1439 }
1440
1441 var circleImplementors = []string{"Circle", "Shape", "ShapeUnion"}
1442
1443 func (ec *executionContext) _Circle(ctx context.Context, sel ast.SelectionSet, obj *Circle) graphql.Marshaler {
1444 fields := graphql.CollectFields(ec.OperationContext, sel, circleImplementors)
1445
1446 out := graphql.NewFieldSet(fields)
1447 deferred := make(map[string]*graphql.FieldSet)
1448 for i, field := range fields {
1449 switch field.Name {
1450 case "__typename":
1451 out.Values[i] = graphql.MarshalString("Circle")
1452 case "radius":
1453 out.Values[i] = ec._Circle_radius(ctx, field, obj)
1454 case "area":
1455 out.Values[i] = ec._Circle_area(ctx, field, obj)
1456 case "coordinates":
1457 out.Values[i] = ec._Circle_coordinates(ctx, field, obj)
1458 default:
1459 panic("unknown field " + strconv.Quote(field.Name))
1460 }
1461 }
1462 out.Dispatch(ctx)
1463 if out.Invalids > 0 {
1464 return graphql.Null
1465 }
1466
1467 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1468
1469 for label, dfs := range deferred {
1470 ec.processDeferredGroup(graphql.DeferredGroup{
1471 Label: label,
1472 Path: graphql.GetPath(ctx),
1473 FieldSet: dfs,
1474 Context: ctx,
1475 })
1476 }
1477
1478 return out
1479 }
1480
1481 var concreteNodeAImplementors = []string{"ConcreteNodeA", "Node"}
1482
1483 func (ec *executionContext) _ConcreteNodeA(ctx context.Context, sel ast.SelectionSet, obj *ConcreteNodeA) graphql.Marshaler {
1484 fields := graphql.CollectFields(ec.OperationContext, sel, concreteNodeAImplementors)
1485
1486 out := graphql.NewFieldSet(fields)
1487 deferred := make(map[string]*graphql.FieldSet)
1488 for i, field := range fields {
1489 switch field.Name {
1490 case "__typename":
1491 out.Values[i] = graphql.MarshalString("ConcreteNodeA")
1492 case "id":
1493 out.Values[i] = ec._ConcreteNodeA_id(ctx, field, obj)
1494 if out.Values[i] == graphql.Null {
1495 out.Invalids++
1496 }
1497 case "child":
1498 out.Values[i] = ec._ConcreteNodeA_child(ctx, field, obj)
1499 if out.Values[i] == graphql.Null {
1500 out.Invalids++
1501 }
1502 case "name":
1503 out.Values[i] = ec._ConcreteNodeA_name(ctx, field, obj)
1504 if out.Values[i] == graphql.Null {
1505 out.Invalids++
1506 }
1507 default:
1508 panic("unknown field " + strconv.Quote(field.Name))
1509 }
1510 }
1511 out.Dispatch(ctx)
1512 if out.Invalids > 0 {
1513 return graphql.Null
1514 }
1515
1516 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1517
1518 for label, dfs := range deferred {
1519 ec.processDeferredGroup(graphql.DeferredGroup{
1520 Label: label,
1521 Path: graphql.GetPath(ctx),
1522 FieldSet: dfs,
1523 Context: ctx,
1524 })
1525 }
1526
1527 return out
1528 }
1529
1530 var concreteNodeInterfaceImplementors = []string{"ConcreteNodeInterface", "Node"}
1531
1532 func (ec *executionContext) _ConcreteNodeInterface(ctx context.Context, sel ast.SelectionSet, obj ConcreteNodeInterface) graphql.Marshaler {
1533 fields := graphql.CollectFields(ec.OperationContext, sel, concreteNodeInterfaceImplementors)
1534
1535 out := graphql.NewFieldSet(fields)
1536 deferred := make(map[string]*graphql.FieldSet)
1537 for i, field := range fields {
1538 switch field.Name {
1539 case "__typename":
1540 out.Values[i] = graphql.MarshalString("ConcreteNodeInterface")
1541 case "id":
1542 out.Values[i] = ec._ConcreteNodeInterface_id(ctx, field, obj)
1543 if out.Values[i] == graphql.Null {
1544 out.Invalids++
1545 }
1546 case "child":
1547 out.Values[i] = ec._ConcreteNodeInterface_child(ctx, field, obj)
1548 if out.Values[i] == graphql.Null {
1549 out.Invalids++
1550 }
1551 default:
1552 panic("unknown field " + strconv.Quote(field.Name))
1553 }
1554 }
1555 out.Dispatch(ctx)
1556 if out.Invalids > 0 {
1557 return graphql.Null
1558 }
1559
1560 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1561
1562 for label, dfs := range deferred {
1563 ec.processDeferredGroup(graphql.DeferredGroup{
1564 Label: label,
1565 Path: graphql.GetPath(ctx),
1566 FieldSet: dfs,
1567 Context: ctx,
1568 })
1569 }
1570
1571 return out
1572 }
1573
1574 var coordinatesImplementors = []string{"Coordinates"}
1575
1576 func (ec *executionContext) _Coordinates(ctx context.Context, sel ast.SelectionSet, obj *Coordinates) graphql.Marshaler {
1577 fields := graphql.CollectFields(ec.OperationContext, sel, coordinatesImplementors)
1578
1579 out := graphql.NewFieldSet(fields)
1580 deferred := make(map[string]*graphql.FieldSet)
1581 for i, field := range fields {
1582 switch field.Name {
1583 case "__typename":
1584 out.Values[i] = graphql.MarshalString("Coordinates")
1585 case "x":
1586 out.Values[i] = ec._Coordinates_x(ctx, field, obj)
1587 if out.Values[i] == graphql.Null {
1588 out.Invalids++
1589 }
1590 case "y":
1591 out.Values[i] = ec._Coordinates_y(ctx, field, obj)
1592 if out.Values[i] == graphql.Null {
1593 out.Invalids++
1594 }
1595 default:
1596 panic("unknown field " + strconv.Quote(field.Name))
1597 }
1598 }
1599 out.Dispatch(ctx)
1600 if out.Invalids > 0 {
1601 return graphql.Null
1602 }
1603
1604 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1605
1606 for label, dfs := range deferred {
1607 ec.processDeferredGroup(graphql.DeferredGroup{
1608 Label: label,
1609 Path: graphql.GetPath(ctx),
1610 FieldSet: dfs,
1611 Context: ctx,
1612 })
1613 }
1614
1615 return out
1616 }
1617
1618 var dogImplementors = []string{"Dog", "Animal"}
1619
1620 func (ec *executionContext) _Dog(ctx context.Context, sel ast.SelectionSet, obj *Dog) graphql.Marshaler {
1621 fields := graphql.CollectFields(ec.OperationContext, sel, dogImplementors)
1622
1623 out := graphql.NewFieldSet(fields)
1624 deferred := make(map[string]*graphql.FieldSet)
1625 for i, field := range fields {
1626 switch field.Name {
1627 case "__typename":
1628 out.Values[i] = graphql.MarshalString("Dog")
1629 case "species":
1630 out.Values[i] = ec._Dog_species(ctx, field, obj)
1631 if out.Values[i] == graphql.Null {
1632 out.Invalids++
1633 }
1634 case "size":
1635 out.Values[i] = ec._Dog_size(ctx, field, obj)
1636 if out.Values[i] == graphql.Null {
1637 out.Invalids++
1638 }
1639 case "dogBreed":
1640 out.Values[i] = ec._Dog_dogBreed(ctx, field, obj)
1641 if out.Values[i] == graphql.Null {
1642 out.Invalids++
1643 }
1644 default:
1645 panic("unknown field " + strconv.Quote(field.Name))
1646 }
1647 }
1648 out.Dispatch(ctx)
1649 if out.Invalids > 0 {
1650 return graphql.Null
1651 }
1652
1653 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1654
1655 for label, dfs := range deferred {
1656 ec.processDeferredGroup(graphql.DeferredGroup{
1657 Label: label,
1658 Path: graphql.GetPath(ctx),
1659 FieldSet: dfs,
1660 Context: ctx,
1661 })
1662 }
1663
1664 return out
1665 }
1666
1667 var horseImplementors = []string{"Horse", "Mammalian", "Animal"}
1668
1669 func (ec *executionContext) _Horse(ctx context.Context, sel ast.SelectionSet, obj *Horse) graphql.Marshaler {
1670 fields := graphql.CollectFields(ec.OperationContext, sel, horseImplementors)
1671
1672 out := graphql.NewFieldSet(fields)
1673 deferred := make(map[string]*graphql.FieldSet)
1674 for i, field := range fields {
1675 switch field.Name {
1676 case "__typename":
1677 out.Values[i] = graphql.MarshalString("Horse")
1678 case "species":
1679 out.Values[i] = ec._Horse_species(ctx, field, obj)
1680 if out.Values[i] == graphql.Null {
1681 out.Invalids++
1682 }
1683 case "size":
1684 out.Values[i] = ec._Horse_size(ctx, field, obj)
1685 if out.Values[i] == graphql.Null {
1686 out.Invalids++
1687 }
1688 case "horseBreed":
1689 out.Values[i] = ec._Horse_horseBreed(ctx, field, obj)
1690 if out.Values[i] == graphql.Null {
1691 out.Invalids++
1692 }
1693 default:
1694 panic("unknown field " + strconv.Quote(field.Name))
1695 }
1696 }
1697 out.Dispatch(ctx)
1698 if out.Invalids > 0 {
1699 return graphql.Null
1700 }
1701
1702 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1703
1704 for label, dfs := range deferred {
1705 ec.processDeferredGroup(graphql.DeferredGroup{
1706 Label: label,
1707 Path: graphql.GetPath(ctx),
1708 FieldSet: dfs,
1709 Context: ctx,
1710 })
1711 }
1712
1713 return out
1714 }
1715
1716 var rectangleImplementors = []string{"Rectangle", "Shape", "ShapeUnion"}
1717
1718 func (ec *executionContext) _Rectangle(ctx context.Context, sel ast.SelectionSet, obj *Rectangle) graphql.Marshaler {
1719 fields := graphql.CollectFields(ec.OperationContext, sel, rectangleImplementors)
1720
1721 out := graphql.NewFieldSet(fields)
1722 deferred := make(map[string]*graphql.FieldSet)
1723 for i, field := range fields {
1724 switch field.Name {
1725 case "__typename":
1726 out.Values[i] = graphql.MarshalString("Rectangle")
1727 case "length":
1728 out.Values[i] = ec._Rectangle_length(ctx, field, obj)
1729 case "width":
1730 out.Values[i] = ec._Rectangle_width(ctx, field, obj)
1731 case "area":
1732 out.Values[i] = ec._Rectangle_area(ctx, field, obj)
1733 case "coordinates":
1734 out.Values[i] = ec._Rectangle_coordinates(ctx, field, obj)
1735 default:
1736 panic("unknown field " + strconv.Quote(field.Name))
1737 }
1738 }
1739 out.Dispatch(ctx)
1740 if out.Invalids > 0 {
1741 return graphql.Null
1742 }
1743
1744 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1745
1746 for label, dfs := range deferred {
1747 ec.processDeferredGroup(graphql.DeferredGroup{
1748 Label: label,
1749 Path: graphql.GetPath(ctx),
1750 FieldSet: dfs,
1751 Context: ctx,
1752 })
1753 }
1754
1755 return out
1756 }
1757
1758 var sizeImplementors = []string{"Size"}
1759
1760 func (ec *executionContext) _Size(ctx context.Context, sel ast.SelectionSet, obj *Size) graphql.Marshaler {
1761 fields := graphql.CollectFields(ec.OperationContext, sel, sizeImplementors)
1762
1763 out := graphql.NewFieldSet(fields)
1764 deferred := make(map[string]*graphql.FieldSet)
1765 for i, field := range fields {
1766 switch field.Name {
1767 case "__typename":
1768 out.Values[i] = graphql.MarshalString("Size")
1769 case "height":
1770 out.Values[i] = ec._Size_height(ctx, field, obj)
1771 if out.Values[i] == graphql.Null {
1772 out.Invalids++
1773 }
1774 case "weight":
1775 out.Values[i] = ec._Size_weight(ctx, field, obj)
1776 if out.Values[i] == graphql.Null {
1777 out.Invalids++
1778 }
1779 default:
1780 panic("unknown field " + strconv.Quote(field.Name))
1781 }
1782 }
1783 out.Dispatch(ctx)
1784 if out.Invalids > 0 {
1785 return graphql.Null
1786 }
1787
1788 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
1789
1790 for label, dfs := range deferred {
1791 ec.processDeferredGroup(graphql.DeferredGroup{
1792 Label: label,
1793 Path: graphql.GetPath(ctx),
1794 FieldSet: dfs,
1795 Context: ctx,
1796 })
1797 }
1798
1799 return out
1800 }
1801
1802
1803
1804
1805
1806 func (ec *executionContext) marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNode(ctx context.Context, sel ast.SelectionSet, v Node) graphql.Marshaler {
1807 if v == nil {
1808 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
1809 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
1810 }
1811 return graphql.Null
1812 }
1813 return ec._Node(ctx, sel, v)
1814 }
1815
1816 func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShapeUnion(ctx context.Context, sel ast.SelectionSet, v ShapeUnion) graphql.Marshaler {
1817 if v == nil {
1818 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
1819 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
1820 }
1821 return graphql.Null
1822 }
1823 return ec._ShapeUnion(ctx, sel, v)
1824 }
1825
1826 func (ec *executionContext) marshalNSize2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSize(ctx context.Context, sel ast.SelectionSet, v *Size) graphql.Marshaler {
1827 if v == nil {
1828 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
1829 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
1830 }
1831 return graphql.Null
1832 }
1833 return ec._Size(ctx, sel, v)
1834 }
1835
1836 func (ec *executionContext) marshalOAnimal2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐAnimal(ctx context.Context, sel ast.SelectionSet, v Animal) graphql.Marshaler {
1837 if v == nil {
1838 return graphql.Null
1839 }
1840 return ec._Animal(ctx, sel, v)
1841 }
1842
1843 func (ec *executionContext) marshalOBackedByInterface2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐBackedByInterface(ctx context.Context, sel ast.SelectionSet, v BackedByInterface) graphql.Marshaler {
1844 if v == nil {
1845 return graphql.Null
1846 }
1847 return ec._BackedByInterface(ctx, sel, v)
1848 }
1849
1850 func (ec *executionContext) marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCircle(ctx context.Context, sel ast.SelectionSet, v *Circle) graphql.Marshaler {
1851 if v == nil {
1852 return graphql.Null
1853 }
1854 return ec._Circle(ctx, sel, v)
1855 }
1856
1857 func (ec *executionContext) marshalOCoordinates2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCoordinates(ctx context.Context, sel ast.SelectionSet, v Coordinates) graphql.Marshaler {
1858 return ec._Coordinates(ctx, sel, &v)
1859 }
1860
1861 func (ec *executionContext) marshalODog2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐDog(ctx context.Context, sel ast.SelectionSet, v *Dog) graphql.Marshaler {
1862 if v == nil {
1863 return graphql.Null
1864 }
1865 return ec._Dog(ctx, sel, v)
1866 }
1867
1868 func (ec *executionContext) marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShape(ctx context.Context, sel ast.SelectionSet, v Shape) graphql.Marshaler {
1869 if v == nil {
1870 return graphql.Null
1871 }
1872 return ec._Shape(ctx, sel, v)
1873 }
1874
1875 func (ec *executionContext) marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShape(ctx context.Context, sel ast.SelectionSet, v []Shape) graphql.Marshaler {
1876 if v == nil {
1877 return graphql.Null
1878 }
1879 ret := make(graphql.Array, len(v))
1880 var wg sync.WaitGroup
1881 isLen1 := len(v) == 1
1882 if !isLen1 {
1883 wg.Add(len(v))
1884 }
1885 for i := range v {
1886 i := i
1887 fc := &graphql.FieldContext{
1888 Index: &i,
1889 Result: &v[i],
1890 }
1891 ctx := graphql.WithFieldContext(ctx, fc)
1892 f := func(i int) {
1893 defer func() {
1894 if r := recover(); r != nil {
1895 ec.Error(ctx, ec.Recover(ctx, r))
1896 ret = nil
1897 }
1898 }()
1899 if !isLen1 {
1900 defer wg.Done()
1901 }
1902 ret[i] = ec.marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐShape(ctx, sel, v[i])
1903 }
1904 if isLen1 {
1905 f(i)
1906 } else {
1907 go f(i)
1908 }
1909
1910 }
1911 wg.Wait()
1912
1913 return ret
1914 }
1915
1916
1917
View as plain text