github.com/99designs/gqlgen@v0.17.45/codegen/testserver/followschema/embedded.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 // endregion ************************** generated!.gotpl ************************** 18 19 // region ***************************** args.gotpl ***************************** 20 21 // endregion ***************************** args.gotpl ***************************** 22 23 // region ************************** directives.gotpl ************************** 24 25 // endregion ************************** directives.gotpl ************************** 26 27 // region **************************** field.gotpl ***************************** 28 29 func (ec *executionContext) _EmbeddedCase1_exportedEmbeddedPointerExportedMethod(ctx context.Context, field graphql.CollectedField, obj *EmbeddedCase1) (ret graphql.Marshaler) { 30 fc, err := ec.fieldContext_EmbeddedCase1_exportedEmbeddedPointerExportedMethod(ctx, field) 31 if err != nil { 32 return graphql.Null 33 } 34 ctx = graphql.WithFieldContext(ctx, fc) 35 defer func() { 36 if r := recover(); r != nil { 37 ec.Error(ctx, ec.Recover(ctx, r)) 38 ret = graphql.Null 39 } 40 }() 41 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 42 ctx = rctx // use context from middleware stack in children 43 return obj.ExportedEmbeddedPointerExportedMethod(), nil 44 }) 45 46 if resTmp == nil { 47 if !graphql.HasFieldError(ctx, fc) { 48 ec.Errorf(ctx, "must not be null") 49 } 50 return graphql.Null 51 } 52 res := resTmp.(string) 53 fc.Result = res 54 return ec.marshalNString2string(ctx, field.Selections, res) 55 } 56 57 func (ec *executionContext) fieldContext_EmbeddedCase1_exportedEmbeddedPointerExportedMethod(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 58 fc = &graphql.FieldContext{ 59 Object: "EmbeddedCase1", 60 Field: field, 61 IsMethod: true, 62 IsResolver: false, 63 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 64 return nil, errors.New("field of type String does not have child fields") 65 }, 66 } 67 return fc, nil 68 } 69 70 func (ec *executionContext) _EmbeddedCase2_unexportedEmbeddedPointerExportedMethod(ctx context.Context, field graphql.CollectedField, obj *EmbeddedCase2) (ret graphql.Marshaler) { 71 fc, err := ec.fieldContext_EmbeddedCase2_unexportedEmbeddedPointerExportedMethod(ctx, field) 72 if err != nil { 73 return graphql.Null 74 } 75 ctx = graphql.WithFieldContext(ctx, fc) 76 defer func() { 77 if r := recover(); r != nil { 78 ec.Error(ctx, ec.Recover(ctx, r)) 79 ret = graphql.Null 80 } 81 }() 82 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 83 ctx = rctx // use context from middleware stack in children 84 return obj.UnexportedEmbeddedPointerExportedMethod(), nil 85 }) 86 87 if resTmp == nil { 88 if !graphql.HasFieldError(ctx, fc) { 89 ec.Errorf(ctx, "must not be null") 90 } 91 return graphql.Null 92 } 93 res := resTmp.(string) 94 fc.Result = res 95 return ec.marshalNString2string(ctx, field.Selections, res) 96 } 97 98 func (ec *executionContext) fieldContext_EmbeddedCase2_unexportedEmbeddedPointerExportedMethod(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 99 fc = &graphql.FieldContext{ 100 Object: "EmbeddedCase2", 101 Field: field, 102 IsMethod: true, 103 IsResolver: false, 104 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 105 return nil, errors.New("field of type String does not have child fields") 106 }, 107 } 108 return fc, nil 109 } 110 111 func (ec *executionContext) _EmbeddedCase3_unexportedEmbeddedInterfaceExportedMethod(ctx context.Context, field graphql.CollectedField, obj *EmbeddedCase3) (ret graphql.Marshaler) { 112 fc, err := ec.fieldContext_EmbeddedCase3_unexportedEmbeddedInterfaceExportedMethod(ctx, field) 113 if err != nil { 114 return graphql.Null 115 } 116 ctx = graphql.WithFieldContext(ctx, fc) 117 defer func() { 118 if r := recover(); r != nil { 119 ec.Error(ctx, ec.Recover(ctx, r)) 120 ret = graphql.Null 121 } 122 }() 123 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 124 ctx = rctx // use context from middleware stack in children 125 return obj.UnexportedEmbeddedInterfaceExportedMethod(), nil 126 }) 127 128 if resTmp == nil { 129 if !graphql.HasFieldError(ctx, fc) { 130 ec.Errorf(ctx, "must not be null") 131 } 132 return graphql.Null 133 } 134 res := resTmp.(string) 135 fc.Result = res 136 return ec.marshalNString2string(ctx, field.Selections, res) 137 } 138 139 func (ec *executionContext) fieldContext_EmbeddedCase3_unexportedEmbeddedInterfaceExportedMethod(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 140 fc = &graphql.FieldContext{ 141 Object: "EmbeddedCase3", 142 Field: field, 143 IsMethod: true, 144 IsResolver: false, 145 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 146 return nil, errors.New("field of type String does not have child fields") 147 }, 148 } 149 return fc, nil 150 } 151 152 // endregion **************************** field.gotpl ***************************** 153 154 // region **************************** input.gotpl ***************************** 155 156 // endregion **************************** input.gotpl ***************************** 157 158 // region ************************** interface.gotpl *************************** 159 160 // endregion ************************** interface.gotpl *************************** 161 162 // region **************************** object.gotpl **************************** 163 164 var embeddedCase1Implementors = []string{"EmbeddedCase1"} 165 166 func (ec *executionContext) _EmbeddedCase1(ctx context.Context, sel ast.SelectionSet, obj *EmbeddedCase1) graphql.Marshaler { 167 fields := graphql.CollectFields(ec.OperationContext, sel, embeddedCase1Implementors) 168 169 out := graphql.NewFieldSet(fields) 170 deferred := make(map[string]*graphql.FieldSet) 171 for i, field := range fields { 172 switch field.Name { 173 case "__typename": 174 out.Values[i] = graphql.MarshalString("EmbeddedCase1") 175 case "exportedEmbeddedPointerExportedMethod": 176 out.Values[i] = ec._EmbeddedCase1_exportedEmbeddedPointerExportedMethod(ctx, field, obj) 177 if out.Values[i] == graphql.Null { 178 out.Invalids++ 179 } 180 default: 181 panic("unknown field " + strconv.Quote(field.Name)) 182 } 183 } 184 out.Dispatch(ctx) 185 if out.Invalids > 0 { 186 return graphql.Null 187 } 188 189 atomic.AddInt32(&ec.deferred, int32(len(deferred))) 190 191 for label, dfs := range deferred { 192 ec.processDeferredGroup(graphql.DeferredGroup{ 193 Label: label, 194 Path: graphql.GetPath(ctx), 195 FieldSet: dfs, 196 Context: ctx, 197 }) 198 } 199 200 return out 201 } 202 203 var embeddedCase2Implementors = []string{"EmbeddedCase2"} 204 205 func (ec *executionContext) _EmbeddedCase2(ctx context.Context, sel ast.SelectionSet, obj *EmbeddedCase2) graphql.Marshaler { 206 fields := graphql.CollectFields(ec.OperationContext, sel, embeddedCase2Implementors) 207 208 out := graphql.NewFieldSet(fields) 209 deferred := make(map[string]*graphql.FieldSet) 210 for i, field := range fields { 211 switch field.Name { 212 case "__typename": 213 out.Values[i] = graphql.MarshalString("EmbeddedCase2") 214 case "unexportedEmbeddedPointerExportedMethod": 215 out.Values[i] = ec._EmbeddedCase2_unexportedEmbeddedPointerExportedMethod(ctx, field, obj) 216 if out.Values[i] == graphql.Null { 217 out.Invalids++ 218 } 219 default: 220 panic("unknown field " + strconv.Quote(field.Name)) 221 } 222 } 223 out.Dispatch(ctx) 224 if out.Invalids > 0 { 225 return graphql.Null 226 } 227 228 atomic.AddInt32(&ec.deferred, int32(len(deferred))) 229 230 for label, dfs := range deferred { 231 ec.processDeferredGroup(graphql.DeferredGroup{ 232 Label: label, 233 Path: graphql.GetPath(ctx), 234 FieldSet: dfs, 235 Context: ctx, 236 }) 237 } 238 239 return out 240 } 241 242 var embeddedCase3Implementors = []string{"EmbeddedCase3"} 243 244 func (ec *executionContext) _EmbeddedCase3(ctx context.Context, sel ast.SelectionSet, obj *EmbeddedCase3) graphql.Marshaler { 245 fields := graphql.CollectFields(ec.OperationContext, sel, embeddedCase3Implementors) 246 247 out := graphql.NewFieldSet(fields) 248 deferred := make(map[string]*graphql.FieldSet) 249 for i, field := range fields { 250 switch field.Name { 251 case "__typename": 252 out.Values[i] = graphql.MarshalString("EmbeddedCase3") 253 case "unexportedEmbeddedInterfaceExportedMethod": 254 out.Values[i] = ec._EmbeddedCase3_unexportedEmbeddedInterfaceExportedMethod(ctx, field, obj) 255 if out.Values[i] == graphql.Null { 256 out.Invalids++ 257 } 258 default: 259 panic("unknown field " + strconv.Quote(field.Name)) 260 } 261 } 262 out.Dispatch(ctx) 263 if out.Invalids > 0 { 264 return graphql.Null 265 } 266 267 atomic.AddInt32(&ec.deferred, int32(len(deferred))) 268 269 for label, dfs := range deferred { 270 ec.processDeferredGroup(graphql.DeferredGroup{ 271 Label: label, 272 Path: graphql.GetPath(ctx), 273 FieldSet: dfs, 274 Context: ctx, 275 }) 276 } 277 278 return out 279 } 280 281 // endregion **************************** object.gotpl **************************** 282 283 // region ***************************** type.gotpl ***************************** 284 285 func (ec *executionContext) marshalOEmbeddedCase12ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedCase1(ctx context.Context, sel ast.SelectionSet, v *EmbeddedCase1) graphql.Marshaler { 286 if v == nil { 287 return graphql.Null 288 } 289 return ec._EmbeddedCase1(ctx, sel, v) 290 } 291 292 func (ec *executionContext) marshalOEmbeddedCase22ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedCase2(ctx context.Context, sel ast.SelectionSet, v *EmbeddedCase2) graphql.Marshaler { 293 if v == nil { 294 return graphql.Null 295 } 296 return ec._EmbeddedCase2(ctx, sel, v) 297 } 298 299 func (ec *executionContext) marshalOEmbeddedCase32ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐEmbeddedCase3(ctx context.Context, sel ast.SelectionSet, v *EmbeddedCase3) graphql.Marshaler { 300 if v == nil { 301 return graphql.Null 302 } 303 return ec._EmbeddedCase3(ctx, sel, v) 304 } 305 306 // endregion ***************************** type.gotpl *****************************