github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/ptr_to_slice.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) _PtrToSliceContainer_ptrToSlice(ctx context.Context, field graphql.CollectedField, obj *PtrToSliceContainer) (ret graphql.Marshaler) { 29 fc, err := ec.fieldContext_PtrToSliceContainer_ptrToSlice(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.PtrToSlice, 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_PtrToSliceContainer_ptrToSlice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 54 fc = &graphql.FieldContext{ 55 Object: "PtrToSliceContainer", 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 // endregion **************************** field.gotpl ***************************** 67 68 // region **************************** input.gotpl ***************************** 69 70 // endregion **************************** input.gotpl ***************************** 71 72 // region ************************** interface.gotpl *************************** 73 74 // endregion ************************** interface.gotpl *************************** 75 76 // region **************************** object.gotpl **************************** 77 78 var ptrToSliceContainerImplementors = []string{"PtrToSliceContainer"} 79 80 func (ec *executionContext) _PtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, obj *PtrToSliceContainer) graphql.Marshaler { 81 fields := graphql.CollectFields(ec.OperationContext, sel, ptrToSliceContainerImplementors) 82 out := graphql.NewFieldSet(fields) 83 var invalids uint32 84 for i, field := range fields { 85 switch field.Name { 86 case "__typename": 87 out.Values[i] = graphql.MarshalString("PtrToSliceContainer") 88 case "ptrToSlice": 89 90 out.Values[i] = ec._PtrToSliceContainer_ptrToSlice(ctx, field, obj) 91 92 default: 93 panic("unknown field " + strconv.Quote(field.Name)) 94 } 95 } 96 out.Dispatch() 97 if invalids > 0 { 98 return graphql.Null 99 } 100 return out 101 } 102 103 // endregion **************************** object.gotpl **************************** 104 105 // region ***************************** type.gotpl ***************************** 106 107 func (ec *executionContext) marshalNPtrToSliceContainer2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v PtrToSliceContainer) graphql.Marshaler { 108 return ec._PtrToSliceContainer(ctx, sel, &v) 109 } 110 111 func (ec *executionContext) marshalNPtrToSliceContainer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v *PtrToSliceContainer) graphql.Marshaler { 112 if v == nil { 113 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 114 ec.Errorf(ctx, "the requested element is null which the schema does not allow") 115 } 116 return graphql.Null 117 } 118 return ec._PtrToSliceContainer(ctx, sel, v) 119 } 120 121 // endregion ***************************** type.gotpl *****************************