github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/slices.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) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { 29 fc, err := ec.fieldContext_Slices_test1(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.Test1, nil 43 }) 44 45 if resTmp == nil { 46 return graphql.Null 47 } 48 res := resTmp.([]*string) 49 fc.Result = res 50 return ec.marshalOString2ᚕᚖstring(ctx, field.Selections, res) 51 } 52 53 func (ec *executionContext) fieldContext_Slices_test1(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 54 fc = &graphql.FieldContext{ 55 Object: "Slices", 56 Field: field, 57 IsMethod: false, 58 IsResolver: false, 59 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 60 return nil, errors.New("field of type String does not have child fields") 61 }, 62 } 63 return fc, nil 64 } 65 66 func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { 67 fc, err := ec.fieldContext_Slices_test2(ctx, field) 68 if err != nil { 69 return graphql.Null 70 } 71 ctx = graphql.WithFieldContext(ctx, fc) 72 defer func() { 73 if r := recover(); r != nil { 74 ec.Error(ctx, ec.Recover(ctx, r)) 75 ret = graphql.Null 76 } 77 }() 78 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 79 ctx = rctx // use context from middleware stack in children 80 return obj.Test2, nil 81 }) 82 83 if resTmp == nil { 84 return graphql.Null 85 } 86 res := resTmp.([]string) 87 fc.Result = res 88 return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) 89 } 90 91 func (ec *executionContext) fieldContext_Slices_test2(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 92 fc = &graphql.FieldContext{ 93 Object: "Slices", 94 Field: field, 95 IsMethod: false, 96 IsResolver: false, 97 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 98 return nil, errors.New("field of type String does not have child fields") 99 }, 100 } 101 return fc, nil 102 } 103 104 func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { 105 fc, err := ec.fieldContext_Slices_test3(ctx, field) 106 if err != nil { 107 return graphql.Null 108 } 109 ctx = graphql.WithFieldContext(ctx, fc) 110 defer func() { 111 if r := recover(); r != nil { 112 ec.Error(ctx, ec.Recover(ctx, r)) 113 ret = graphql.Null 114 } 115 }() 116 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 117 ctx = rctx // use context from middleware stack in children 118 return obj.Test3, nil 119 }) 120 121 if resTmp == nil { 122 if !graphql.HasFieldError(ctx, fc) { 123 ec.Errorf(ctx, "must not be null") 124 } 125 return graphql.Null 126 } 127 res := resTmp.([]*string) 128 fc.Result = res 129 return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res) 130 } 131 132 func (ec *executionContext) fieldContext_Slices_test3(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 133 fc = &graphql.FieldContext{ 134 Object: "Slices", 135 Field: field, 136 IsMethod: false, 137 IsResolver: false, 138 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 139 return nil, errors.New("field of type String does not have child fields") 140 }, 141 } 142 return fc, nil 143 } 144 145 func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { 146 fc, err := ec.fieldContext_Slices_test4(ctx, field) 147 if err != nil { 148 return graphql.Null 149 } 150 ctx = graphql.WithFieldContext(ctx, fc) 151 defer func() { 152 if r := recover(); r != nil { 153 ec.Error(ctx, ec.Recover(ctx, r)) 154 ret = graphql.Null 155 } 156 }() 157 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 158 ctx = rctx // use context from middleware stack in children 159 return obj.Test4, nil 160 }) 161 162 if resTmp == nil { 163 if !graphql.HasFieldError(ctx, fc) { 164 ec.Errorf(ctx, "must not be null") 165 } 166 return graphql.Null 167 } 168 res := resTmp.([]string) 169 fc.Result = res 170 return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) 171 } 172 173 func (ec *executionContext) fieldContext_Slices_test4(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 174 fc = &graphql.FieldContext{ 175 Object: "Slices", 176 Field: field, 177 IsMethod: false, 178 IsResolver: false, 179 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 180 return nil, errors.New("field of type String does not have child fields") 181 }, 182 } 183 return fc, nil 184 } 185 186 // endregion **************************** field.gotpl ***************************** 187 188 // region **************************** input.gotpl ***************************** 189 190 // endregion **************************** input.gotpl ***************************** 191 192 // region ************************** interface.gotpl *************************** 193 194 // endregion ************************** interface.gotpl *************************** 195 196 // region **************************** object.gotpl **************************** 197 198 var slicesImplementors = []string{"Slices"} 199 200 func (ec *executionContext) _Slices(ctx context.Context, sel ast.SelectionSet, obj *Slices) graphql.Marshaler { 201 fields := graphql.CollectFields(ec.OperationContext, sel, slicesImplementors) 202 out := graphql.NewFieldSet(fields) 203 var invalids uint32 204 for i, field := range fields { 205 switch field.Name { 206 case "__typename": 207 out.Values[i] = graphql.MarshalString("Slices") 208 case "test1": 209 210 out.Values[i] = ec._Slices_test1(ctx, field, obj) 211 212 case "test2": 213 214 out.Values[i] = ec._Slices_test2(ctx, field, obj) 215 216 case "test3": 217 218 out.Values[i] = ec._Slices_test3(ctx, field, obj) 219 220 if out.Values[i] == graphql.Null { 221 invalids++ 222 } 223 case "test4": 224 225 out.Values[i] = ec._Slices_test4(ctx, field, obj) 226 227 if out.Values[i] == graphql.Null { 228 invalids++ 229 } 230 default: 231 panic("unknown field " + strconv.Quote(field.Name)) 232 } 233 } 234 out.Dispatch() 235 if invalids > 0 { 236 return graphql.Null 237 } 238 return out 239 } 240 241 // endregion **************************** object.gotpl **************************** 242 243 // region ***************************** type.gotpl ***************************** 244 245 func (ec *executionContext) unmarshalNBytes2ᚕbyte(ctx context.Context, v interface{}) ([]byte, error) { 246 res, err := UnmarshalBytes(v) 247 return res, graphql.ErrorOnPath(ctx, err) 248 } 249 250 func (ec *executionContext) marshalNBytes2ᚕbyte(ctx context.Context, sel ast.SelectionSet, v []byte) graphql.Marshaler { 251 if v == nil { 252 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 253 ec.Errorf(ctx, "the requested element is null which the schema does not allow") 254 } 255 return graphql.Null 256 } 257 res := MarshalBytes(v) 258 if res == graphql.Null { 259 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 260 ec.Errorf(ctx, "the requested element is null which the schema does not allow") 261 } 262 } 263 return res 264 } 265 266 func (ec *executionContext) marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSlices(ctx context.Context, sel ast.SelectionSet, v *Slices) graphql.Marshaler { 267 if v == nil { 268 return graphql.Null 269 } 270 return ec._Slices(ctx, sel, v) 271 } 272 273 // endregion ***************************** type.gotpl *****************************