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) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) {
30 fc, err := ec.fieldContext_Slices_test1(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.Test1, nil
44 })
45
46 if resTmp == nil {
47 return graphql.Null
48 }
49 res := resTmp.([]*string)
50 fc.Result = res
51 return ec.marshalOString2ᚕᚖstring(ctx, field.Selections, res)
52 }
53
54 func (ec *executionContext) fieldContext_Slices_test1(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
55 fc = &graphql.FieldContext{
56 Object: "Slices",
57 Field: field,
58 IsMethod: false,
59 IsResolver: false,
60 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
61 return nil, errors.New("field of type String does not have child fields")
62 },
63 }
64 return fc, nil
65 }
66
67 func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) {
68 fc, err := ec.fieldContext_Slices_test2(ctx, field)
69 if err != nil {
70 return graphql.Null
71 }
72 ctx = graphql.WithFieldContext(ctx, fc)
73 defer func() {
74 if r := recover(); r != nil {
75 ec.Error(ctx, ec.Recover(ctx, r))
76 ret = graphql.Null
77 }
78 }()
79 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
80 ctx = rctx
81 return obj.Test2, nil
82 })
83
84 if resTmp == nil {
85 return graphql.Null
86 }
87 res := resTmp.([]string)
88 fc.Result = res
89 return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res)
90 }
91
92 func (ec *executionContext) fieldContext_Slices_test2(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
93 fc = &graphql.FieldContext{
94 Object: "Slices",
95 Field: field,
96 IsMethod: false,
97 IsResolver: false,
98 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
99 return nil, errors.New("field of type String does not have child fields")
100 },
101 }
102 return fc, nil
103 }
104
105 func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) {
106 fc, err := ec.fieldContext_Slices_test3(ctx, field)
107 if err != nil {
108 return graphql.Null
109 }
110 ctx = graphql.WithFieldContext(ctx, fc)
111 defer func() {
112 if r := recover(); r != nil {
113 ec.Error(ctx, ec.Recover(ctx, r))
114 ret = graphql.Null
115 }
116 }()
117 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
118 ctx = rctx
119 return obj.Test3, nil
120 })
121
122 if resTmp == nil {
123 if !graphql.HasFieldError(ctx, fc) {
124 ec.Errorf(ctx, "must not be null")
125 }
126 return graphql.Null
127 }
128 res := resTmp.([]*string)
129 fc.Result = res
130 return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res)
131 }
132
133 func (ec *executionContext) fieldContext_Slices_test3(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
134 fc = &graphql.FieldContext{
135 Object: "Slices",
136 Field: field,
137 IsMethod: false,
138 IsResolver: false,
139 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
140 return nil, errors.New("field of type String does not have child fields")
141 },
142 }
143 return fc, nil
144 }
145
146 func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) {
147 fc, err := ec.fieldContext_Slices_test4(ctx, field)
148 if err != nil {
149 return graphql.Null
150 }
151 ctx = graphql.WithFieldContext(ctx, fc)
152 defer func() {
153 if r := recover(); r != nil {
154 ec.Error(ctx, ec.Recover(ctx, r))
155 ret = graphql.Null
156 }
157 }()
158 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
159 ctx = rctx
160 return obj.Test4, nil
161 })
162
163 if resTmp == nil {
164 if !graphql.HasFieldError(ctx, fc) {
165 ec.Errorf(ctx, "must not be null")
166 }
167 return graphql.Null
168 }
169 res := resTmp.([]string)
170 fc.Result = res
171 return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
172 }
173
174 func (ec *executionContext) fieldContext_Slices_test4(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
175 fc = &graphql.FieldContext{
176 Object: "Slices",
177 Field: field,
178 IsMethod: false,
179 IsResolver: false,
180 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
181 return nil, errors.New("field of type String does not have child fields")
182 },
183 }
184 return fc, nil
185 }
186
187
188
189
190
191
192
193
194
195
196
197
198
199 var slicesImplementors = []string{"Slices"}
200
201 func (ec *executionContext) _Slices(ctx context.Context, sel ast.SelectionSet, obj *Slices) graphql.Marshaler {
202 fields := graphql.CollectFields(ec.OperationContext, sel, slicesImplementors)
203
204 out := graphql.NewFieldSet(fields)
205 deferred := make(map[string]*graphql.FieldSet)
206 for i, field := range fields {
207 switch field.Name {
208 case "__typename":
209 out.Values[i] = graphql.MarshalString("Slices")
210 case "test1":
211 out.Values[i] = ec._Slices_test1(ctx, field, obj)
212 case "test2":
213 out.Values[i] = ec._Slices_test2(ctx, field, obj)
214 case "test3":
215 out.Values[i] = ec._Slices_test3(ctx, field, obj)
216 if out.Values[i] == graphql.Null {
217 out.Invalids++
218 }
219 case "test4":
220 out.Values[i] = ec._Slices_test4(ctx, field, obj)
221 if out.Values[i] == graphql.Null {
222 out.Invalids++
223 }
224 default:
225 panic("unknown field " + strconv.Quote(field.Name))
226 }
227 }
228 out.Dispatch(ctx)
229 if out.Invalids > 0 {
230 return graphql.Null
231 }
232
233 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
234
235 for label, dfs := range deferred {
236 ec.processDeferredGroup(graphql.DeferredGroup{
237 Label: label,
238 Path: graphql.GetPath(ctx),
239 FieldSet: dfs,
240 Context: ctx,
241 })
242 }
243
244 return out
245 }
246
247
248
249
250
251 func (ec *executionContext) unmarshalNBytes2ᚕbyte(ctx context.Context, v interface{}) ([]byte, error) {
252 res, err := UnmarshalBytes(v)
253 return res, graphql.ErrorOnPath(ctx, err)
254 }
255
256 func (ec *executionContext) marshalNBytes2ᚕbyte(ctx context.Context, sel ast.SelectionSet, v []byte) graphql.Marshaler {
257 if v == nil {
258 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
259 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
260 }
261 return graphql.Null
262 }
263 res := MarshalBytes(v)
264 if res == graphql.Null {
265 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
266 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
267 }
268 }
269 return res
270 }
271
272 func (ec *executionContext) marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSlices(ctx context.Context, sel ast.SelectionSet, v *Slices) graphql.Marshaler {
273 if v == nil {
274 return graphql.Null
275 }
276 return ec._Slices(ctx, sel, v)
277 }
278
279
280
View as plain text