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