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