github.com/99designs/gqlgen@v0.17.45/codegen/testserver/followschema/ptr_to_slice.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) _PtrToSliceContainer_ptrToSlice(ctx context.Context, field graphql.CollectedField, obj *PtrToSliceContainer) (ret graphql.Marshaler) { 30 fc, err := ec.fieldContext_PtrToSliceContainer_ptrToSlice(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.PtrToSlice, nil 44 }) 45 46 if resTmp == nil { 47 return graphql.Null 48 } 49 res := resTmp.(*[]string) 50 fc.Result = res 51 return ec.marshalOString2ᚖᚕstringᚄ(ctx, field.Selections, res) 52 } 53 54 func (ec *executionContext) fieldContext_PtrToSliceContainer_ptrToSlice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 55 fc = &graphql.FieldContext{ 56 Object: "PtrToSliceContainer", 57 Field: field, 58 IsMethod: false, 59 IsResolver: false, 60 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 61 return nil, errors.New("field of type String does not have child fields") 62 }, 63 } 64 return fc, nil 65 } 66 67 // endregion **************************** field.gotpl ***************************** 68 69 // region **************************** input.gotpl ***************************** 70 71 // endregion **************************** input.gotpl ***************************** 72 73 // region ************************** interface.gotpl *************************** 74 75 // endregion ************************** interface.gotpl *************************** 76 77 // region **************************** object.gotpl **************************** 78 79 var ptrToSliceContainerImplementors = []string{"PtrToSliceContainer"} 80 81 func (ec *executionContext) _PtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, obj *PtrToSliceContainer) graphql.Marshaler { 82 fields := graphql.CollectFields(ec.OperationContext, sel, ptrToSliceContainerImplementors) 83 84 out := graphql.NewFieldSet(fields) 85 deferred := make(map[string]*graphql.FieldSet) 86 for i, field := range fields { 87 switch field.Name { 88 case "__typename": 89 out.Values[i] = graphql.MarshalString("PtrToSliceContainer") 90 case "ptrToSlice": 91 out.Values[i] = ec._PtrToSliceContainer_ptrToSlice(ctx, field, obj) 92 default: 93 panic("unknown field " + strconv.Quote(field.Name)) 94 } 95 } 96 out.Dispatch(ctx) 97 if out.Invalids > 0 { 98 return graphql.Null 99 } 100 101 atomic.AddInt32(&ec.deferred, int32(len(deferred))) 102 103 for label, dfs := range deferred { 104 ec.processDeferredGroup(graphql.DeferredGroup{ 105 Label: label, 106 Path: graphql.GetPath(ctx), 107 FieldSet: dfs, 108 Context: ctx, 109 }) 110 } 111 112 return out 113 } 114 115 // endregion **************************** object.gotpl **************************** 116 117 // region ***************************** type.gotpl ***************************** 118 119 func (ec *executionContext) marshalNPtrToSliceContainer2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v PtrToSliceContainer) graphql.Marshaler { 120 return ec._PtrToSliceContainer(ctx, sel, &v) 121 } 122 123 func (ec *executionContext) marshalNPtrToSliceContainer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v *PtrToSliceContainer) graphql.Marshaler { 124 if v == nil { 125 if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { 126 ec.Errorf(ctx, "the requested element is null which the schema does not allow") 127 } 128 return graphql.Null 129 } 130 return ec._PtrToSliceContainer(ctx, sel, v) 131 } 132 133 // endregion ***************************** type.gotpl *****************************