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