github.com/operandinc/gqlgen@v0.16.1/codegen/testserver/followschema/complexity.generated.go (about) 1 // Code generated by github.com/operandinc/gqlgen, DO NOT EDIT. 2 3 package followschema 4 5 import ( 6 "context" 7 "strconv" 8 "sync/atomic" 9 10 "github.com/operandinc/gqlgen/graphql" 11 "github.com/vektah/gqlparser/v2/ast" 12 ) 13 14 // region ************************** generated!.gotpl ************************** 15 16 type OverlappingFieldsResolver interface { 17 OldFoo(ctx context.Context, obj *OverlappingFields) (int, error) 18 } 19 20 // endregion ************************** generated!.gotpl ************************** 21 22 // region ***************************** args.gotpl ***************************** 23 24 // endregion ***************************** args.gotpl ***************************** 25 26 // region ************************** directives.gotpl ************************** 27 28 // endregion ************************** directives.gotpl ************************** 29 30 // region **************************** field.gotpl ***************************** 31 32 func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { 33 defer func() { 34 if r := recover(); r != nil { 35 ec.Error(ctx, ec.Recover(ctx, r)) 36 ret = graphql.Null 37 } 38 }() 39 fc := &graphql.FieldContext{ 40 Object: "OverlappingFields", 41 Field: field, 42 Args: nil, 43 IsMethod: false, 44 IsResolver: false, 45 } 46 47 ctx = graphql.WithFieldContext(ctx, fc) 48 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 49 ctx = rctx // use context from middleware stack in children 50 return obj.Foo, nil 51 }) 52 53 if resTmp == nil { 54 if !graphql.HasFieldError(ctx, fc) { 55 ec.Errorf(ctx, "must not be null") 56 } 57 return graphql.Null 58 } 59 res := resTmp.(int) 60 fc.Result = res 61 return ec.marshalNInt2int(ctx, field.Selections, res) 62 } 63 64 func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { 65 defer func() { 66 if r := recover(); r != nil { 67 ec.Error(ctx, ec.Recover(ctx, r)) 68 ret = graphql.Null 69 } 70 }() 71 fc := &graphql.FieldContext{ 72 Object: "OverlappingFields", 73 Field: field, 74 Args: nil, 75 IsMethod: false, 76 IsResolver: false, 77 } 78 79 ctx = graphql.WithFieldContext(ctx, fc) 80 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 81 ctx = rctx // use context from middleware stack in children 82 return obj.Foo, nil 83 }) 84 85 if resTmp == nil { 86 if !graphql.HasFieldError(ctx, fc) { 87 ec.Errorf(ctx, "must not be null") 88 } 89 return graphql.Null 90 } 91 res := resTmp.(int) 92 fc.Result = res 93 return ec.marshalNInt2int(ctx, field.Selections, res) 94 } 95 96 func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { 97 defer func() { 98 if r := recover(); r != nil { 99 ec.Error(ctx, ec.Recover(ctx, r)) 100 ret = graphql.Null 101 } 102 }() 103 fc := &graphql.FieldContext{ 104 Object: "OverlappingFields", 105 Field: field, 106 Args: nil, 107 IsMethod: true, 108 IsResolver: true, 109 } 110 111 ctx = graphql.WithFieldContext(ctx, fc) 112 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 113 ctx = rctx // use context from middleware stack in children 114 return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) 115 }) 116 117 if resTmp == nil { 118 if !graphql.HasFieldError(ctx, fc) { 119 ec.Errorf(ctx, "must not be null") 120 } 121 return graphql.Null 122 } 123 res := resTmp.(int) 124 fc.Result = res 125 return ec.marshalNInt2int(ctx, field.Selections, res) 126 } 127 128 func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { 129 defer func() { 130 if r := recover(); r != nil { 131 ec.Error(ctx, ec.Recover(ctx, r)) 132 ret = graphql.Null 133 } 134 }() 135 fc := &graphql.FieldContext{ 136 Object: "OverlappingFields", 137 Field: field, 138 Args: nil, 139 IsMethod: false, 140 IsResolver: false, 141 } 142 143 ctx = graphql.WithFieldContext(ctx, fc) 144 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 145 ctx = rctx // use context from middleware stack in children 146 return obj.NewFoo, nil 147 }) 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.(int) 156 fc.Result = res 157 return ec.marshalNInt2int(ctx, field.Selections, res) 158 } 159 160 func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { 161 defer func() { 162 if r := recover(); r != nil { 163 ec.Error(ctx, ec.Recover(ctx, r)) 164 ret = graphql.Null 165 } 166 }() 167 fc := &graphql.FieldContext{ 168 Object: "OverlappingFields", 169 Field: field, 170 Args: nil, 171 IsMethod: false, 172 IsResolver: false, 173 } 174 175 ctx = graphql.WithFieldContext(ctx, fc) 176 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 177 ctx = rctx // use context from middleware stack in children 178 return obj.NewFoo, nil 179 }) 180 181 if resTmp == nil { 182 if !graphql.HasFieldError(ctx, fc) { 183 ec.Errorf(ctx, "must not be null") 184 } 185 return graphql.Null 186 } 187 res := resTmp.(int) 188 fc.Result = res 189 return ec.marshalNInt2int(ctx, field.Selections, res) 190 } 191 192 // endregion **************************** field.gotpl ***************************** 193 194 // region **************************** input.gotpl ***************************** 195 196 // endregion **************************** input.gotpl ***************************** 197 198 // region ************************** interface.gotpl *************************** 199 200 // endregion ************************** interface.gotpl *************************** 201 202 // region **************************** object.gotpl **************************** 203 204 var overlappingFieldsImplementors = []string{"OverlappingFields"} 205 206 func (ec *executionContext) _OverlappingFields(ctx context.Context, sel ast.SelectionSet, obj *OverlappingFields) graphql.Marshaler { 207 fields := graphql.CollectFields(ec.OperationContext, sel, overlappingFieldsImplementors) 208 out := graphql.NewFieldSet(fields) 209 var invalids uint32 210 for i, field := range fields { 211 switch field.Name { 212 case "__typename": 213 out.Values[i] = graphql.MarshalString("OverlappingFields") 214 case "oneFoo": 215 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 216 return ec._OverlappingFields_oneFoo(ctx, field, obj) 217 } 218 219 out.Values[i] = innerFunc(ctx) 220 221 if out.Values[i] == graphql.Null { 222 atomic.AddUint32(&invalids, 1) 223 } 224 case "twoFoo": 225 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 226 return ec._OverlappingFields_twoFoo(ctx, field, obj) 227 } 228 229 out.Values[i] = innerFunc(ctx) 230 231 if out.Values[i] == graphql.Null { 232 atomic.AddUint32(&invalids, 1) 233 } 234 case "oldFoo": 235 field := field 236 237 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 238 defer func() { 239 if r := recover(); r != nil { 240 ec.Error(ctx, ec.Recover(ctx, r)) 241 } 242 }() 243 res = ec._OverlappingFields_oldFoo(ctx, field, obj) 244 if res == graphql.Null { 245 atomic.AddUint32(&invalids, 1) 246 } 247 return res 248 } 249 250 out.Concurrently(i, func() graphql.Marshaler { 251 return innerFunc(ctx) 252 253 }) 254 case "newFoo": 255 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 256 return ec._OverlappingFields_newFoo(ctx, field, obj) 257 } 258 259 out.Values[i] = innerFunc(ctx) 260 261 if out.Values[i] == graphql.Null { 262 atomic.AddUint32(&invalids, 1) 263 } 264 case "new_foo": 265 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 266 return ec._OverlappingFields_new_foo(ctx, field, obj) 267 } 268 269 out.Values[i] = innerFunc(ctx) 270 271 if out.Values[i] == graphql.Null { 272 atomic.AddUint32(&invalids, 1) 273 } 274 default: 275 panic("unknown field " + strconv.Quote(field.Name)) 276 } 277 } 278 out.Dispatch() 279 if invalids > 0 { 280 return graphql.Null 281 } 282 return out 283 } 284 285 // endregion **************************** object.gotpl **************************** 286 287 // region ***************************** type.gotpl ***************************** 288 289 func (ec *executionContext) marshalOOverlappingFields2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐOverlappingFields(ctx context.Context, sel ast.SelectionSet, v *OverlappingFields) graphql.Marshaler { 290 if v == nil { 291 return graphql.Null 292 } 293 return ec._OverlappingFields(ctx, sel, v) 294 } 295 296 // endregion ***************************** type.gotpl *****************************