...
1
2
3 package followschema
4
5 import (
6 "context"
7 "errors"
8 "strconv"
9 "sync/atomic"
10
11 "github.com/99designs/gqlgen/graphql"
12 "github.com/vektah/gqlparser/v2/ast"
13 )
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) {
30 fc, err := ec.fieldContext_Map_id(ctx, field)
31 if err != nil {
32 return graphql.Null
33 }
34 ctx = graphql.WithFieldContext(ctx, fc)
35 defer func() {
36 if r := recover(); r != nil {
37 ec.Error(ctx, ec.Recover(ctx, r))
38 ret = graphql.Null
39 }
40 }()
41 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
42 ctx = rctx
43 return obj.ID, nil
44 })
45
46 if resTmp == nil {
47 if !graphql.HasFieldError(ctx, fc) {
48 ec.Errorf(ctx, "must not be null")
49 }
50 return graphql.Null
51 }
52 res := resTmp.(string)
53 fc.Result = res
54 return ec.marshalNID2string(ctx, field.Selections, res)
55 }
56
57 func (ec *executionContext) fieldContext_Map_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
58 fc = &graphql.FieldContext{
59 Object: "Map",
60 Field: field,
61 IsMethod: false,
62 IsResolver: false,
63 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
64 return nil, errors.New("field of type ID does not have child fields")
65 },
66 }
67 return fc, nil
68 }
69
70
71
72
73
74
75
76
77
78
79
80
81
82 var mapImplementors = []string{"Map"}
83
84 func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj *Map) graphql.Marshaler {
85 fields := graphql.CollectFields(ec.OperationContext, sel, mapImplementors)
86
87 out := graphql.NewFieldSet(fields)
88 deferred := make(map[string]*graphql.FieldSet)
89 for i, field := range fields {
90 switch field.Name {
91 case "__typename":
92 out.Values[i] = graphql.MarshalString("Map")
93 case "id":
94 out.Values[i] = ec._Map_id(ctx, field, obj)
95 if out.Values[i] == graphql.Null {
96 out.Invalids++
97 }
98 default:
99 panic("unknown field " + strconv.Quote(field.Name))
100 }
101 }
102 out.Dispatch(ctx)
103 if out.Invalids > 0 {
104 return graphql.Null
105 }
106
107 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
108
109 for label, dfs := range deferred {
110 ec.processDeferredGroup(graphql.DeferredGroup{
111 Label: label,
112 Path: graphql.GetPath(ctx),
113 FieldSet: dfs,
114 Context: ctx,
115 })
116 }
117
118 return out
119 }
120
121
122
123
124
125
126
View as plain text