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