github.com/operandinc/gqlgen@v0.16.1/codegen/testserver/followschema/v-ok.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) _VOkCaseNil_value(ctx context.Context, field graphql.CollectedField, obj *VOkCaseNil) (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: "VOkCaseNil", 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 v, ok := obj.Value() 46 if !ok { 47 return nil, nil 48 } 49 return v, nil 50 }) 51 52 if resTmp == nil { 53 return graphql.Null 54 } 55 res := resTmp.(string) 56 fc.Result = res 57 return ec.marshalOString2string(ctx, field.Selections, res) 58 } 59 60 func (ec *executionContext) _VOkCaseValue_value(ctx context.Context, field graphql.CollectedField, obj *VOkCaseValue) (ret graphql.Marshaler) { 61 defer func() { 62 if r := recover(); r != nil { 63 ec.Error(ctx, ec.Recover(ctx, r)) 64 ret = graphql.Null 65 } 66 }() 67 fc := &graphql.FieldContext{ 68 Object: "VOkCaseValue", 69 Field: field, 70 Args: nil, 71 IsMethod: true, 72 IsResolver: false, 73 } 74 75 ctx = graphql.WithFieldContext(ctx, fc) 76 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 77 ctx = rctx // use context from middleware stack in children 78 v, ok := obj.Value() 79 if !ok { 80 return nil, nil 81 } 82 return v, nil 83 }) 84 85 if resTmp == nil { 86 return graphql.Null 87 } 88 res := resTmp.(string) 89 fc.Result = res 90 return ec.marshalOString2string(ctx, field.Selections, res) 91 } 92 93 // endregion **************************** field.gotpl ***************************** 94 95 // region **************************** input.gotpl ***************************** 96 97 // endregion **************************** input.gotpl ***************************** 98 99 // region ************************** interface.gotpl *************************** 100 101 // endregion ************************** interface.gotpl *************************** 102 103 // region **************************** object.gotpl **************************** 104 105 var vOkCaseNilImplementors = []string{"VOkCaseNil"} 106 107 func (ec *executionContext) _VOkCaseNil(ctx context.Context, sel ast.SelectionSet, obj *VOkCaseNil) graphql.Marshaler { 108 fields := graphql.CollectFields(ec.OperationContext, sel, vOkCaseNilImplementors) 109 out := graphql.NewFieldSet(fields) 110 var invalids uint32 111 for i, field := range fields { 112 switch field.Name { 113 case "__typename": 114 out.Values[i] = graphql.MarshalString("VOkCaseNil") 115 case "value": 116 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 117 return ec._VOkCaseNil_value(ctx, field, obj) 118 } 119 120 out.Values[i] = innerFunc(ctx) 121 122 default: 123 panic("unknown field " + strconv.Quote(field.Name)) 124 } 125 } 126 out.Dispatch() 127 if invalids > 0 { 128 return graphql.Null 129 } 130 return out 131 } 132 133 var vOkCaseValueImplementors = []string{"VOkCaseValue"} 134 135 func (ec *executionContext) _VOkCaseValue(ctx context.Context, sel ast.SelectionSet, obj *VOkCaseValue) graphql.Marshaler { 136 fields := graphql.CollectFields(ec.OperationContext, sel, vOkCaseValueImplementors) 137 out := graphql.NewFieldSet(fields) 138 var invalids uint32 139 for i, field := range fields { 140 switch field.Name { 141 case "__typename": 142 out.Values[i] = graphql.MarshalString("VOkCaseValue") 143 case "value": 144 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 145 return ec._VOkCaseValue_value(ctx, field, obj) 146 } 147 148 out.Values[i] = innerFunc(ctx) 149 150 default: 151 panic("unknown field " + strconv.Quote(field.Name)) 152 } 153 } 154 out.Dispatch() 155 if invalids > 0 { 156 return graphql.Null 157 } 158 return out 159 } 160 161 // endregion **************************** object.gotpl **************************** 162 163 // region ***************************** type.gotpl ***************************** 164 165 func (ec *executionContext) marshalOVOkCaseNil2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐVOkCaseNil(ctx context.Context, sel ast.SelectionSet, v *VOkCaseNil) graphql.Marshaler { 166 if v == nil { 167 return graphql.Null 168 } 169 return ec._VOkCaseNil(ctx, sel, v) 170 } 171 172 func (ec *executionContext) marshalOVOkCaseValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐVOkCaseValue(ctx context.Context, sel ast.SelectionSet, v *VOkCaseValue) graphql.Marshaler { 173 if v == nil { 174 return graphql.Null 175 } 176 return ec._VOkCaseValue(ctx, sel, v) 177 } 178 179 // endregion ***************************** type.gotpl *****************************