1
2
3 package followschema
4
5 import (
6 "context"
7 "errors"
8 "strconv"
9 "sync"
10 "sync/atomic"
11
12 "github.com/99designs/gqlgen/graphql"
13 "github.com/vektah/gqlparser/v2/ast"
14 )
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 func (ec *executionContext) _CheckIssue896_id(ctx context.Context, field graphql.CollectedField, obj *CheckIssue896) (ret graphql.Marshaler) {
31 fc, err := ec.fieldContext_CheckIssue896_id(ctx, field)
32 if err != nil {
33 return graphql.Null
34 }
35 ctx = graphql.WithFieldContext(ctx, fc)
36 defer func() {
37 if r := recover(); r != nil {
38 ec.Error(ctx, ec.Recover(ctx, r))
39 ret = graphql.Null
40 }
41 }()
42 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
43 ctx = rctx
44 return obj.ID, nil
45 })
46
47 if resTmp == nil {
48 return graphql.Null
49 }
50 res := resTmp.(*int)
51 fc.Result = res
52 return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
53 }
54
55 func (ec *executionContext) fieldContext_CheckIssue896_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
56 fc = &graphql.FieldContext{
57 Object: "CheckIssue896",
58 Field: field,
59 IsMethod: false,
60 IsResolver: false,
61 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
62 return nil, errors.New("field of type Int does not have child fields")
63 },
64 }
65 return fc, nil
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80 var checkIssue896Implementors = []string{"CheckIssue896"}
81
82 func (ec *executionContext) _CheckIssue896(ctx context.Context, sel ast.SelectionSet, obj *CheckIssue896) graphql.Marshaler {
83 fields := graphql.CollectFields(ec.OperationContext, sel, checkIssue896Implementors)
84
85 out := graphql.NewFieldSet(fields)
86 deferred := make(map[string]*graphql.FieldSet)
87 for i, field := range fields {
88 switch field.Name {
89 case "__typename":
90 out.Values[i] = graphql.MarshalString("CheckIssue896")
91 case "id":
92 out.Values[i] = ec._CheckIssue896_id(ctx, field, obj)
93 default:
94 panic("unknown field " + strconv.Quote(field.Name))
95 }
96 }
97 out.Dispatch(ctx)
98 if out.Invalids > 0 {
99 return graphql.Null
100 }
101
102 atomic.AddInt32(&ec.deferred, int32(len(deferred)))
103
104 for label, dfs := range deferred {
105 ec.processDeferredGroup(graphql.DeferredGroup{
106 Label: label,
107 Path: graphql.GetPath(ctx),
108 FieldSet: dfs,
109 Context: ctx,
110 })
111 }
112
113 return out
114 }
115
116
117
118
119
120 func (ec *executionContext) marshalNCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx context.Context, sel ast.SelectionSet, v *CheckIssue896) graphql.Marshaler {
121 if v == nil {
122 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
123 ec.Errorf(ctx, "the requested element is null which the schema does not allow")
124 }
125 return graphql.Null
126 }
127 return ec._CheckIssue896(ctx, sel, v)
128 }
129
130 func (ec *executionContext) marshalOCheckIssue8962ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx context.Context, sel ast.SelectionSet, v []*CheckIssue896) graphql.Marshaler {
131 if v == nil {
132 return graphql.Null
133 }
134 ret := make(graphql.Array, len(v))
135 var wg sync.WaitGroup
136 isLen1 := len(v) == 1
137 if !isLen1 {
138 wg.Add(len(v))
139 }
140 for i := range v {
141 i := i
142 fc := &graphql.FieldContext{
143 Index: &i,
144 Result: &v[i],
145 }
146 ctx := graphql.WithFieldContext(ctx, fc)
147 f := func(i int) {
148 defer func() {
149 if r := recover(); r != nil {
150 ec.Error(ctx, ec.Recover(ctx, r))
151 ret = nil
152 }
153 }()
154 if !isLen1 {
155 defer wg.Done()
156 }
157 ret[i] = ec.marshalOCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx, sel, v[i])
158 }
159 if isLen1 {
160 f(i)
161 } else {
162 go f(i)
163 }
164
165 }
166 wg.Wait()
167
168 return ret
169 }
170
171 func (ec *executionContext) marshalOCheckIssue8962ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896ᚄ(ctx context.Context, sel ast.SelectionSet, v []*CheckIssue896) graphql.Marshaler {
172 if v == nil {
173 return graphql.Null
174 }
175 ret := make(graphql.Array, len(v))
176 var wg sync.WaitGroup
177 isLen1 := len(v) == 1
178 if !isLen1 {
179 wg.Add(len(v))
180 }
181 for i := range v {
182 i := i
183 fc := &graphql.FieldContext{
184 Index: &i,
185 Result: &v[i],
186 }
187 ctx := graphql.WithFieldContext(ctx, fc)
188 f := func(i int) {
189 defer func() {
190 if r := recover(); r != nil {
191 ec.Error(ctx, ec.Recover(ctx, r))
192 ret = nil
193 }
194 }()
195 if !isLen1 {
196 defer wg.Done()
197 }
198 ret[i] = ec.marshalNCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx, sel, v[i])
199 }
200 if isLen1 {
201 f(i)
202 } else {
203 go f(i)
204 }
205
206 }
207 wg.Wait()
208
209 for _, e := range ret {
210 if e == graphql.Null {
211 return graphql.Null
212 }
213 }
214
215 return ret
216 }
217
218 func (ec *executionContext) marshalOCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx context.Context, sel ast.SelectionSet, v *CheckIssue896) graphql.Marshaler {
219 if v == nil {
220 return graphql.Null
221 }
222 return ec._CheckIssue896(ctx, sel, v)
223 }
224
225
226
View as plain text