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