1// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
2
3package graph
4
5import (
6 "context"
7 "errors"
8 "fmt"
9 "strconv"
10 "sync"
11 "sync/atomic"
12
13 "github.com/99designs/gqlgen/graphql"
14 "github.com/git-bug/git-bug/api/graphql/models"
15 "github.com/git-bug/git-bug/entities/bug"
16 "github.com/git-bug/git-bug/entity/dag"
17 "github.com/vektah/gqlparser/v2/ast"
18)
19
20// region ************************** generated!.gotpl **************************
21
22// endregion ************************** generated!.gotpl **************************
23
24// region ***************************** args.gotpl *****************************
25
26// endregion ***************************** args.gotpl *****************************
27
28// region ************************** directives.gotpl **************************
29
30// endregion ************************** directives.gotpl **************************
31
32// region **************************** field.gotpl *****************************
33
34func (ec *executionContext) _OperationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
35 fc, err := ec.fieldContext_OperationConnection_edges(ctx, field)
36 if err != nil {
37 return graphql.Null
38 }
39 ctx = graphql.WithFieldContext(ctx, fc)
40 defer func() {
41 if r := recover(); r != nil {
42 ec.Error(ctx, ec.Recover(ctx, r))
43 ret = graphql.Null
44 }
45 }()
46 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
47 ctx = rctx // use context from middleware stack in children
48 return obj.Edges, nil
49 })
50 if err != nil {
51 ec.Error(ctx, err)
52 return graphql.Null
53 }
54 if resTmp == nil {
55 if !graphql.HasFieldError(ctx, fc) {
56 ec.Errorf(ctx, "must not be null")
57 }
58 return graphql.Null
59 }
60 res := resTmp.([]*models.OperationEdge)
61 fc.Result = res
62 return ec.marshalNOperationEdge2ᚕᚖgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐOperationEdgeᚄ(ctx, field.Selections, res)
63}
64
65func (ec *executionContext) fieldContext_OperationConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
66 fc = &graphql.FieldContext{
67 Object: "OperationConnection",
68 Field: field,
69 IsMethod: false,
70 IsResolver: false,
71 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
72 switch field.Name {
73 case "cursor":
74 return ec.fieldContext_OperationEdge_cursor(ctx, field)
75 case "node":
76 return ec.fieldContext_OperationEdge_node(ctx, field)
77 }
78 return nil, fmt.Errorf("no field named %q was found under type OperationEdge", field.Name)
79 },
80 }
81 return fc, nil
82}
83
84func (ec *executionContext) _OperationConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
85 fc, err := ec.fieldContext_OperationConnection_nodes(ctx, field)
86 if err != nil {
87 return graphql.Null
88 }
89 ctx = graphql.WithFieldContext(ctx, fc)
90 defer func() {
91 if r := recover(); r != nil {
92 ec.Error(ctx, ec.Recover(ctx, r))
93 ret = graphql.Null
94 }
95 }()
96 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
97 ctx = rctx // use context from middleware stack in children
98 return obj.Nodes, nil
99 })
100 if err != nil {
101 ec.Error(ctx, err)
102 return graphql.Null
103 }
104 if resTmp == nil {
105 if !graphql.HasFieldError(ctx, fc) {
106 ec.Errorf(ctx, "must not be null")
107 }
108 return graphql.Null
109 }
110 res := resTmp.([]dag.Operation)
111 fc.Result = res
112 return ec.marshalNOperation2ᚕgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋentityᚋdagᚐOperationᚄ(ctx, field.Selections, res)
113}
114
115func (ec *executionContext) fieldContext_OperationConnection_nodes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
116 fc = &graphql.FieldContext{
117 Object: "OperationConnection",
118 Field: field,
119 IsMethod: false,
120 IsResolver: false,
121 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
122 return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE")
123 },
124 }
125 return fc, nil
126}
127
128func (ec *executionContext) _OperationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
129 fc, err := ec.fieldContext_OperationConnection_pageInfo(ctx, field)
130 if err != nil {
131 return graphql.Null
132 }
133 ctx = graphql.WithFieldContext(ctx, fc)
134 defer func() {
135 if r := recover(); r != nil {
136 ec.Error(ctx, ec.Recover(ctx, r))
137 ret = graphql.Null
138 }
139 }()
140 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
141 ctx = rctx // use context from middleware stack in children
142 return obj.PageInfo, nil
143 })
144 if err != nil {
145 ec.Error(ctx, err)
146 return graphql.Null
147 }
148 if resTmp == nil {
149 if !graphql.HasFieldError(ctx, fc) {
150 ec.Errorf(ctx, "must not be null")
151 }
152 return graphql.Null
153 }
154 res := resTmp.(*models.PageInfo)
155 fc.Result = res
156 return ec.marshalNPageInfo2ᚖgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
157}
158
159func (ec *executionContext) fieldContext_OperationConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
160 fc = &graphql.FieldContext{
161 Object: "OperationConnection",
162 Field: field,
163 IsMethod: false,
164 IsResolver: false,
165 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
166 switch field.Name {
167 case "hasNextPage":
168 return ec.fieldContext_PageInfo_hasNextPage(ctx, field)
169 case "hasPreviousPage":
170 return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field)
171 case "startCursor":
172 return ec.fieldContext_PageInfo_startCursor(ctx, field)
173 case "endCursor":
174 return ec.fieldContext_PageInfo_endCursor(ctx, field)
175 }
176 return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name)
177 },
178 }
179 return fc, nil
180}
181
182func (ec *executionContext) _OperationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
183 fc, err := ec.fieldContext_OperationConnection_totalCount(ctx, field)
184 if err != nil {
185 return graphql.Null
186 }
187 ctx = graphql.WithFieldContext(ctx, fc)
188 defer func() {
189 if r := recover(); r != nil {
190 ec.Error(ctx, ec.Recover(ctx, r))
191 ret = graphql.Null
192 }
193 }()
194 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
195 ctx = rctx // use context from middleware stack in children
196 return obj.TotalCount, nil
197 })
198 if err != nil {
199 ec.Error(ctx, err)
200 return graphql.Null
201 }
202 if resTmp == nil {
203 if !graphql.HasFieldError(ctx, fc) {
204 ec.Errorf(ctx, "must not be null")
205 }
206 return graphql.Null
207 }
208 res := resTmp.(int)
209 fc.Result = res
210 return ec.marshalNInt2int(ctx, field.Selections, res)
211}
212
213func (ec *executionContext) fieldContext_OperationConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
214 fc = &graphql.FieldContext{
215 Object: "OperationConnection",
216 Field: field,
217 IsMethod: false,
218 IsResolver: false,
219 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
220 return nil, errors.New("field of type Int does not have child fields")
221 },
222 }
223 return fc, nil
224}
225
226func (ec *executionContext) _OperationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) (ret graphql.Marshaler) {
227 fc, err := ec.fieldContext_OperationEdge_cursor(ctx, field)
228 if err != nil {
229 return graphql.Null
230 }
231 ctx = graphql.WithFieldContext(ctx, fc)
232 defer func() {
233 if r := recover(); r != nil {
234 ec.Error(ctx, ec.Recover(ctx, r))
235 ret = graphql.Null
236 }
237 }()
238 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
239 ctx = rctx // use context from middleware stack in children
240 return obj.Cursor, nil
241 })
242 if err != nil {
243 ec.Error(ctx, err)
244 return graphql.Null
245 }
246 if resTmp == nil {
247 if !graphql.HasFieldError(ctx, fc) {
248 ec.Errorf(ctx, "must not be null")
249 }
250 return graphql.Null
251 }
252 res := resTmp.(string)
253 fc.Result = res
254 return ec.marshalNString2string(ctx, field.Selections, res)
255}
256
257func (ec *executionContext) fieldContext_OperationEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
258 fc = &graphql.FieldContext{
259 Object: "OperationEdge",
260 Field: field,
261 IsMethod: false,
262 IsResolver: false,
263 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
264 return nil, errors.New("field of type String does not have child fields")
265 },
266 }
267 return fc, nil
268}
269
270func (ec *executionContext) _OperationEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) (ret graphql.Marshaler) {
271 fc, err := ec.fieldContext_OperationEdge_node(ctx, field)
272 if err != nil {
273 return graphql.Null
274 }
275 ctx = graphql.WithFieldContext(ctx, fc)
276 defer func() {
277 if r := recover(); r != nil {
278 ec.Error(ctx, ec.Recover(ctx, r))
279 ret = graphql.Null
280 }
281 }()
282 resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
283 ctx = rctx // use context from middleware stack in children
284 return obj.Node, nil
285 })
286 if err != nil {
287 ec.Error(ctx, err)
288 return graphql.Null
289 }
290 if resTmp == nil {
291 if !graphql.HasFieldError(ctx, fc) {
292 ec.Errorf(ctx, "must not be null")
293 }
294 return graphql.Null
295 }
296 res := resTmp.(dag.Operation)
297 fc.Result = res
298 return ec.marshalNOperation2githubᚗcomᚋgitᚑbugᚋgitᚑbugᚋentityᚋdagᚐOperation(ctx, field.Selections, res)
299}
300
301func (ec *executionContext) fieldContext_OperationEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
302 fc = &graphql.FieldContext{
303 Object: "OperationEdge",
304 Field: field,
305 IsMethod: false,
306 IsResolver: false,
307 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
308 return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE")
309 },
310 }
311 return fc, nil
312}
313
314// endregion **************************** field.gotpl *****************************
315
316// region **************************** input.gotpl *****************************
317
318// endregion **************************** input.gotpl *****************************
319
320// region ************************** interface.gotpl ***************************
321
322func (ec *executionContext) _Operation(ctx context.Context, sel ast.SelectionSet, obj dag.Operation) graphql.Marshaler {
323 switch obj := (obj).(type) {
324 case nil:
325 return graphql.Null
326 case *bug.SetTitleOperation:
327 if obj == nil {
328 return graphql.Null
329 }
330 return ec._BugSetTitleOperation(ctx, sel, obj)
331 case *bug.SetStatusOperation:
332 if obj == nil {
333 return graphql.Null
334 }
335 return ec._BugSetStatusOperation(ctx, sel, obj)
336 case *bug.LabelChangeOperation:
337 if obj == nil {
338 return graphql.Null
339 }
340 return ec._BugLabelChangeOperation(ctx, sel, obj)
341 case *bug.EditCommentOperation:
342 if obj == nil {
343 return graphql.Null
344 }
345 return ec._BugEditCommentOperation(ctx, sel, obj)
346 case *bug.CreateOperation:
347 if obj == nil {
348 return graphql.Null
349 }
350 return ec._BugCreateOperation(ctx, sel, obj)
351 case *bug.AddCommentOperation:
352 if obj == nil {
353 return graphql.Null
354 }
355 return ec._BugAddCommentOperation(ctx, sel, obj)
356 default:
357 panic(fmt.Errorf("unexpected type %T", obj))
358 }
359}
360
361// endregion ************************** interface.gotpl ***************************
362
363// region **************************** object.gotpl ****************************
364
365var operationConnectionImplementors = []string{"OperationConnection"}
366
367func (ec *executionContext) _OperationConnection(ctx context.Context, sel ast.SelectionSet, obj *models.OperationConnection) graphql.Marshaler {
368 fields := graphql.CollectFields(ec.OperationContext, sel, operationConnectionImplementors)
369
370 out := graphql.NewFieldSet(fields)
371 deferred := make(map[string]*graphql.FieldSet)
372 for i, field := range fields {
373 switch field.Name {
374 case "__typename":
375 out.Values[i] = graphql.MarshalString("OperationConnection")
376 case "edges":
377 out.Values[i] = ec._OperationConnection_edges(ctx, field, obj)
378 if out.Values[i] == graphql.Null {
379 out.Invalids++
380 }
381 case "nodes":
382 out.Values[i] = ec._OperationConnection_nodes(ctx, field, obj)
383 if out.Values[i] == graphql.Null {
384 out.Invalids++
385 }
386 case "pageInfo":
387 out.Values[i] = ec._OperationConnection_pageInfo(ctx, field, obj)
388 if out.Values[i] == graphql.Null {
389 out.Invalids++
390 }
391 case "totalCount":
392 out.Values[i] = ec._OperationConnection_totalCount(ctx, field, obj)
393 if out.Values[i] == graphql.Null {
394 out.Invalids++
395 }
396 default:
397 panic("unknown field " + strconv.Quote(field.Name))
398 }
399 }
400 out.Dispatch(ctx)
401 if out.Invalids > 0 {
402 return graphql.Null
403 }
404
405 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
406
407 for label, dfs := range deferred {
408 ec.processDeferredGroup(graphql.DeferredGroup{
409 Label: label,
410 Path: graphql.GetPath(ctx),
411 FieldSet: dfs,
412 Context: ctx,
413 })
414 }
415
416 return out
417}
418
419var operationEdgeImplementors = []string{"OperationEdge"}
420
421func (ec *executionContext) _OperationEdge(ctx context.Context, sel ast.SelectionSet, obj *models.OperationEdge) graphql.Marshaler {
422 fields := graphql.CollectFields(ec.OperationContext, sel, operationEdgeImplementors)
423
424 out := graphql.NewFieldSet(fields)
425 deferred := make(map[string]*graphql.FieldSet)
426 for i, field := range fields {
427 switch field.Name {
428 case "__typename":
429 out.Values[i] = graphql.MarshalString("OperationEdge")
430 case "cursor":
431 out.Values[i] = ec._OperationEdge_cursor(ctx, field, obj)
432 if out.Values[i] == graphql.Null {
433 out.Invalids++
434 }
435 case "node":
436 out.Values[i] = ec._OperationEdge_node(ctx, field, obj)
437 if out.Values[i] == graphql.Null {
438 out.Invalids++
439 }
440 default:
441 panic("unknown field " + strconv.Quote(field.Name))
442 }
443 }
444 out.Dispatch(ctx)
445 if out.Invalids > 0 {
446 return graphql.Null
447 }
448
449 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
450
451 for label, dfs := range deferred {
452 ec.processDeferredGroup(graphql.DeferredGroup{
453 Label: label,
454 Path: graphql.GetPath(ctx),
455 FieldSet: dfs,
456 Context: ctx,
457 })
458 }
459
460 return out
461}
462
463// endregion **************************** object.gotpl ****************************
464
465// region ***************************** type.gotpl *****************************
466
467func (ec *executionContext) marshalNOperation2githubᚗcomᚋgitᚑbugᚋgitᚑbugᚋentityᚋdagᚐOperation(ctx context.Context, sel ast.SelectionSet, v dag.Operation) graphql.Marshaler {
468 if v == nil {
469 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
470 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
471 }
472 return graphql.Null
473 }
474 return ec._Operation(ctx, sel, v)
475}
476
477func (ec *executionContext) marshalNOperation2ᚕgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋentityᚋdagᚐOperationᚄ(ctx context.Context, sel ast.SelectionSet, v []dag.Operation) graphql.Marshaler {
478 ret := make(graphql.Array, len(v))
479 var wg sync.WaitGroup
480 isLen1 := len(v) == 1
481 if !isLen1 {
482 wg.Add(len(v))
483 }
484 for i := range v {
485 i := i
486 fc := &graphql.FieldContext{
487 Index: &i,
488 Result: &v[i],
489 }
490 ctx := graphql.WithFieldContext(ctx, fc)
491 f := func(i int) {
492 defer func() {
493 if r := recover(); r != nil {
494 ec.Error(ctx, ec.Recover(ctx, r))
495 ret = nil
496 }
497 }()
498 if !isLen1 {
499 defer wg.Done()
500 }
501 ret[i] = ec.marshalNOperation2githubᚗcomᚋgitᚑbugᚋgitᚑbugᚋentityᚋdagᚐOperation(ctx, sel, v[i])
502 }
503 if isLen1 {
504 f(i)
505 } else {
506 go f(i)
507 }
508
509 }
510 wg.Wait()
511
512 for _, e := range ret {
513 if e == graphql.Null {
514 return graphql.Null
515 }
516 }
517
518 return ret
519}
520
521func (ec *executionContext) marshalNOperationConnection2githubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐOperationConnection(ctx context.Context, sel ast.SelectionSet, v models.OperationConnection) graphql.Marshaler {
522 return ec._OperationConnection(ctx, sel, &v)
523}
524
525func (ec *executionContext) marshalNOperationConnection2ᚖgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐOperationConnection(ctx context.Context, sel ast.SelectionSet, v *models.OperationConnection) graphql.Marshaler {
526 if v == nil {
527 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
528 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
529 }
530 return graphql.Null
531 }
532 return ec._OperationConnection(ctx, sel, v)
533}
534
535func (ec *executionContext) marshalNOperationEdge2ᚕᚖgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐOperationEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.OperationEdge) graphql.Marshaler {
536 ret := make(graphql.Array, len(v))
537 var wg sync.WaitGroup
538 isLen1 := len(v) == 1
539 if !isLen1 {
540 wg.Add(len(v))
541 }
542 for i := range v {
543 i := i
544 fc := &graphql.FieldContext{
545 Index: &i,
546 Result: &v[i],
547 }
548 ctx := graphql.WithFieldContext(ctx, fc)
549 f := func(i int) {
550 defer func() {
551 if r := recover(); r != nil {
552 ec.Error(ctx, ec.Recover(ctx, r))
553 ret = nil
554 }
555 }()
556 if !isLen1 {
557 defer wg.Done()
558 }
559 ret[i] = ec.marshalNOperationEdge2ᚖgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐOperationEdge(ctx, sel, v[i])
560 }
561 if isLen1 {
562 f(i)
563 } else {
564 go f(i)
565 }
566
567 }
568 wg.Wait()
569
570 for _, e := range ret {
571 if e == graphql.Null {
572 return graphql.Null
573 }
574 }
575
576 return ret
577}
578
579func (ec *executionContext) marshalNOperationEdge2ᚖgithubᚗcomᚋgitᚑbugᚋgitᚑbugᚋapiᚋgraphqlᚋmodelsᚐOperationEdge(ctx context.Context, sel ast.SelectionSet, v *models.OperationEdge) graphql.Marshaler {
580 if v == nil {
581 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
582 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
583 }
584 return graphql.Null
585 }
586 return ec._OperationEdge(ctx, sel, v)
587}
588
589// endregion ***************************** type.gotpl *****************************