github.com/99designs/gqlgen@v0.17.45/codegen/testserver/followschema/panics.generated.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 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 // region ************************** generated!.gotpl ************************** 16 17 type PanicsResolver interface { 18 FieldScalarMarshal(ctx context.Context, obj *Panics) ([]MarshalPanic, error) 19 20 ArgUnmarshal(ctx context.Context, obj *Panics, u []MarshalPanic) (bool, error) 21 } 22 23 // endregion ************************** generated!.gotpl ************************** 24 25 // region ***************************** args.gotpl ***************************** 26 27 func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 28 var err error 29 args := map[string]interface{}{} 30 var arg0 []MarshalPanic 31 if tmp, ok := rawArgs["u"]; ok { 32 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) 33 arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp) 34 if err != nil { 35 return nil, err 36 } 37 } 38 args["u"] = arg0 39 return args, nil 40 } 41 42 func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 43 var err error 44 args := map[string]interface{}{} 45 var arg0 []MarshalPanic 46 if tmp, ok := rawArgs["u"]; ok { 47 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) 48 arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp) 49 if err != nil { 50 return nil, err 51 } 52 } 53 args["u"] = arg0 54 return args, nil 55 } 56 57 // endregion ***************************** args.gotpl ***************************** 58 59 // region ************************** directives.gotpl ************************** 60 61 // endregion ************************** directives.gotpl ************************** 62 63 // region **************************** field.gotpl ***************************** 64 65 func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { 66 fc, err := ec.fieldContext_Panics_fieldScalarMarshal(ctx, field) 67 if err != nil { 68 return graphql.Null 69 } 70 ctx = graphql.WithFieldContext(ctx, fc) 71 defer func() { 72 if r := recover(); r != nil { 73 ec.Error(ctx, ec.Recover(ctx, r)) 74 ret = graphql.Null 75 } 76 }() 77 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 78 ctx = rctx // use context from middleware stack in children 79 return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) 80 }) 81 82 if resTmp == nil { 83 if !graphql.HasFieldError(ctx, fc) { 84 ec.Errorf(ctx, "must not be null") 85 } 86 return graphql.Null 87 } 88 res := resTmp.([]MarshalPanic) 89 fc.Result = res 90 return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, field.Selections, res) 91 } 92 93 func (ec *executionContext) fieldContext_Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 94 fc = &graphql.FieldContext{ 95 Object: "Panics", 96 Field: field, 97 IsMethod: true, 98 IsResolver: true, 99 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 100 return nil, errors.New("field of type MarshalPanic does not have child fields") 101 }, 102 } 103 return fc, nil 104 } 105 106 func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { 107 fc, err := ec.fieldContext_Panics_fieldFuncMarshal(ctx, field) 108 if err != nil { 109 return graphql.Null 110 } 111 ctx = graphql.WithFieldContext(ctx, fc) 112 defer func() { 113 if r := recover(); r != nil { 114 ec.Error(ctx, ec.Recover(ctx, r)) 115 ret = graphql.Null 116 } 117 }() 118 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 119 ctx = rctx // use context from middleware stack in children 120 return obj.FieldFuncMarshal(ctx, fc.Args["u"].([]MarshalPanic)), nil 121 }) 122 123 if resTmp == nil { 124 if !graphql.HasFieldError(ctx, fc) { 125 ec.Errorf(ctx, "must not be null") 126 } 127 return graphql.Null 128 } 129 res := resTmp.([]MarshalPanic) 130 fc.Result = res 131 return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, field.Selections, res) 132 } 133 134 func (ec *executionContext) fieldContext_Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 135 fc = &graphql.FieldContext{ 136 Object: "Panics", 137 Field: field, 138 IsMethod: true, 139 IsResolver: false, 140 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 141 return nil, errors.New("field of type MarshalPanic does not have child fields") 142 }, 143 } 144 defer func() { 145 if r := recover(); r != nil { 146 err = ec.Recover(ctx, r) 147 ec.Error(ctx, err) 148 } 149 }() 150 ctx = graphql.WithFieldContext(ctx, fc) 151 if fc.Args, err = ec.field_Panics_fieldFuncMarshal_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { 152 ec.Error(ctx, err) 153 return fc, err 154 } 155 return fc, nil 156 } 157 158 func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { 159 fc, err := ec.fieldContext_Panics_argUnmarshal(ctx, field) 160 if err != nil { 161 return graphql.Null 162 } 163 ctx = graphql.WithFieldContext(ctx, fc) 164 defer func() { 165 if r := recover(); r != nil { 166 ec.Error(ctx, ec.Recover(ctx, r)) 167 ret = graphql.Null 168 } 169 }() 170 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 171 ctx = rctx // use context from middleware stack in children 172 return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, fc.Args["u"].([]MarshalPanic)) 173 }) 174 175 if resTmp == nil { 176 if !graphql.HasFieldError(ctx, fc) { 177 ec.Errorf(ctx, "must not be null") 178 } 179 return graphql.Null 180 } 181 res := resTmp.(bool) 182 fc.Result = res 183 return ec.marshalNBoolean2bool(ctx, field.Selections, res) 184 } 185 186 func (ec *executionContext) fieldContext_Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 187 fc = &graphql.FieldContext{ 188 Object: "Panics", 189 Field: field, 190 IsMethod: true, 191 IsResolver: true, 192 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 193 return nil, errors.New("field of type Boolean does not have child fields") 194 }, 195 } 196 defer func() { 197 if r := recover(); r != nil { 198 err = ec.Recover(ctx, r) 199 ec.Error(ctx, err) 200 } 201 }() 202 ctx = graphql.WithFieldContext(ctx, fc) 203 if fc.Args, err = ec.field_Panics_argUnmarshal_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { 204 ec.Error(ctx, err) 205 return fc, err 206 } 207 return fc, nil 208 } 209 210 // endregion **************************** field.gotpl ***************************** 211 212 // region **************************** input.gotpl ***************************** 213 214 // endregion **************************** input.gotpl ***************************** 215 216 // region ************************** interface.gotpl *************************** 217 218 // endregion ************************** interface.gotpl *************************** 219 220 // region **************************** object.gotpl **************************** 221 222 var panicsImplementors = []string{"Panics"} 223 224 func (ec *executionContext) _Panics(ctx context.Context, sel ast.SelectionSet, obj *Panics) graphql.Marshaler { 225 fields := graphql.CollectFields(ec.OperationContext, sel, panicsImplementors) 226 227 out := graphql.NewFieldSet(fields) 228 deferred := make(map[string]*graphql.FieldSet) 229 for i, field := range fields { 230 switch field.Name { 231 case "__typename": 232 out.Values[i] = graphql.MarshalString("Panics") 233 case "fieldScalarMarshal": 234 field := field 235 236 innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { 237 defer func() { 238 if r := recover(); r != nil { 239 ec.Error(ctx, ec.Recover(ctx, r)) 240 } 241 }() 242 res = ec._Panics_fieldScalarMarshal(ctx, field, obj) 243 if res == graphql.Null { 244 atomic.AddUint32(&fs.Invalids, 1) 245 } 246 return res 247 } 248 249 if field.Deferrable != nil { 250 dfs, ok := deferred[field.Deferrable.Label] 251 di := 0 252 if ok { 253 dfs.AddField(field) 254 di = len(dfs.Values) - 1 255 } else { 256 dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) 257 deferred[field.Deferrable.Label] = dfs 258 } 259 dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { 260 return innerFunc(ctx, dfs) 261 }) 262 263 // don't run the out.Concurrently() call below 264 out.Values[i] = graphql.Null 265 continue 266 } 267 268 out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) 269 case "fieldFuncMarshal": 270 field := field 271 272 innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { 273 defer func() { 274 if r := recover(); r != nil { 275 ec.Error(ctx, ec.Recover(ctx, r)) 276 } 277 }() 278 res = ec._Panics_fieldFuncMarshal(ctx, field, obj) 279 if res == graphql.Null { 280 atomic.AddUint32(&fs.Invalids, 1) 281 } 282 return res 283 } 284 285 if field.Deferrable != nil { 286 dfs, ok := deferred[field.Deferrable.Label] 287 di := 0 288 if ok { 289 dfs.AddField(field) 290 di = len(dfs.Values) - 1 291 } else { 292 dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) 293 deferred[field.Deferrable.Label] = dfs 294 } 295 dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { 296 return innerFunc(ctx, dfs) 297 }) 298 299 // don't run the out.Concurrently() call below 300 out.Values[i] = graphql.Null 301 continue 302 } 303 304 out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) 305 case "argUnmarshal": 306 field := field 307 308 innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { 309 defer func() { 310 if r := recover(); r != nil { 311 ec.Error(ctx, ec.Recover(ctx, r)) 312 } 313 }() 314 res = ec._Panics_argUnmarshal(ctx, field, obj) 315 if res == graphql.Null { 316 atomic.AddUint32(&fs.Invalids, 1) 317 } 318 return res 319 } 320 321 if field.Deferrable != nil { 322 dfs, ok := deferred[field.Deferrable.Label] 323 di := 0 324 if ok { 325 dfs.AddField(field) 326 di = len(dfs.Values) - 1 327 } else { 328 dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) 329 deferred[field.Deferrable.Label] = dfs 330 } 331 dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { 332 return innerFunc(ctx, dfs) 333 }) 334 335 // don't run the out.Concurrently() call below 336 out.Values[i] = graphql.Null 337 continue 338 } 339 340 out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) 341 default: 342 panic("unknown field " + strconv.Quote(field.Name)) 343 } 344 } 345 out.Dispatch(ctx) 346 if out.Invalids > 0 { 347 return graphql.Null 348 } 349 350 atomic.AddInt32(&ec.deferred, int32(len(deferred))) 351 352 for label, dfs := range deferred { 353 ec.processDeferredGroup(graphql.DeferredGroup{ 354 Label: label, 355 Path: graphql.GetPath(ctx), 356 FieldSet: dfs, 357 Context: ctx, 358 }) 359 } 360 361 return out 362 } 363 364 // endregion **************************** object.gotpl **************************** 365 366 // region ***************************** type.gotpl ***************************** 367 368 func (ec *executionContext) unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx context.Context, v interface{}) (MarshalPanic, error) { 369 var res MarshalPanic 370 err := res.UnmarshalGQL(v) 371 return res, graphql.ErrorOnPath(ctx, err) 372 } 373 374 func (ec *executionContext) marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx context.Context, sel ast.SelectionSet, v MarshalPanic) graphql.Marshaler { 375 return v 376 } 377 378 func (ec *executionContext) unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx context.Context, v interface{}) ([]MarshalPanic, error) { 379 var vSlice []interface{} 380 if v != nil { 381 vSlice = graphql.CoerceList(v) 382 } 383 var err error 384 res := make([]MarshalPanic, len(vSlice)) 385 for i := range vSlice { 386 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) 387 res[i], err = ec.unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx, vSlice[i]) 388 if err != nil { 389 return nil, err 390 } 391 } 392 return res, nil 393 } 394 395 func (ec *executionContext) marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx context.Context, sel ast.SelectionSet, v []MarshalPanic) graphql.Marshaler { 396 ret := make(graphql.Array, len(v)) 397 for i := range v { 398 ret[i] = ec.marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx, sel, v[i]) 399 } 400 401 for _, e := range ret { 402 if e == graphql.Null { 403 return graphql.Null 404 } 405 } 406 407 return ret 408 } 409 410 func (ec *executionContext) marshalOPanics2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPanics(ctx context.Context, sel ast.SelectionSet, v *Panics) graphql.Marshaler { 411 if v == nil { 412 return graphql.Null 413 } 414 return ec._Panics(ctx, sel, v) 415 } 416 417 // endregion ***************************** type.gotpl *****************************