github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/variadic.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 func (ec *executionContext) field_VariadicModel_value_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 21 var err error 22 args := map[string]interface{}{} 23 var arg0 int 24 if tmp, ok := rawArgs["rank"]; ok { 25 ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rank")) 26 arg0, err = ec.unmarshalNInt2int(ctx, tmp) 27 if err != nil { 28 return nil, err 29 } 30 } 31 args["rank"] = arg0 32 return args, nil 33 } 34 35 // endregion ***************************** args.gotpl ***************************** 36 37 // region ************************** directives.gotpl ************************** 38 39 // endregion ************************** directives.gotpl ************************** 40 41 // region **************************** field.gotpl ***************************** 42 43 func (ec *executionContext) _VariadicModel_value(ctx context.Context, field graphql.CollectedField, obj *VariadicModel) (ret graphql.Marshaler) { 44 fc, err := ec.fieldContext_VariadicModel_value(ctx, field) 45 if err != nil { 46 return graphql.Null 47 } 48 ctx = graphql.WithFieldContext(ctx, fc) 49 defer func() { 50 if r := recover(); r != nil { 51 ec.Error(ctx, ec.Recover(ctx, r)) 52 ret = graphql.Null 53 } 54 }() 55 resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { 56 ctx = rctx // use context from middleware stack in children 57 return obj.Value(ctx, fc.Args["rank"].(int)) 58 }) 59 60 if resTmp == nil { 61 return graphql.Null 62 } 63 res := resTmp.(string) 64 fc.Result = res 65 return ec.marshalOString2string(ctx, field.Selections, res) 66 } 67 68 func (ec *executionContext) fieldContext_VariadicModel_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { 69 fc = &graphql.FieldContext{ 70 Object: "VariadicModel", 71 Field: field, 72 IsMethod: true, 73 IsResolver: false, 74 Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { 75 return nil, errors.New("field of type String does not have child fields") 76 }, 77 } 78 defer func() { 79 if r := recover(); r != nil { 80 err = ec.Recover(ctx, r) 81 ec.Error(ctx, err) 82 } 83 }() 84 ctx = graphql.WithFieldContext(ctx, fc) 85 if fc.Args, err = ec.field_VariadicModel_value_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { 86 ec.Error(ctx, err) 87 return 88 } 89 return fc, nil 90 } 91 92 // endregion **************************** field.gotpl ***************************** 93 94 // region **************************** input.gotpl ***************************** 95 96 // endregion **************************** input.gotpl ***************************** 97 98 // region ************************** interface.gotpl *************************** 99 100 // endregion ************************** interface.gotpl *************************** 101 102 // region **************************** object.gotpl **************************** 103 104 var variadicModelImplementors = []string{"VariadicModel"} 105 106 func (ec *executionContext) _VariadicModel(ctx context.Context, sel ast.SelectionSet, obj *VariadicModel) graphql.Marshaler { 107 fields := graphql.CollectFields(ec.OperationContext, sel, variadicModelImplementors) 108 out := graphql.NewFieldSet(fields) 109 var invalids uint32 110 for i, field := range fields { 111 switch field.Name { 112 case "__typename": 113 out.Values[i] = graphql.MarshalString("VariadicModel") 114 case "value": 115 field := field 116 117 innerFunc := func(ctx context.Context) (res graphql.Marshaler) { 118 defer func() { 119 if r := recover(); r != nil { 120 ec.Error(ctx, ec.Recover(ctx, r)) 121 } 122 }() 123 res = ec._VariadicModel_value(ctx, field, obj) 124 return res 125 } 126 127 out.Concurrently(i, func() graphql.Marshaler { 128 return innerFunc(ctx) 129 130 }) 131 default: 132 panic("unknown field " + strconv.Quote(field.Name)) 133 } 134 } 135 out.Dispatch() 136 if invalids > 0 { 137 return graphql.Null 138 } 139 return out 140 } 141 142 // endregion **************************** object.gotpl **************************** 143 144 // region ***************************** type.gotpl ***************************** 145 146 func (ec *executionContext) marshalOVariadicModel2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐVariadicModel(ctx context.Context, sel ast.SelectionSet, v *VariadicModel) graphql.Marshaler { 147 if v == nil { 148 return graphql.Null 149 } 150 return ec._VariadicModel(ctx, sel, v) 151 } 152 153 // endregion ***************************** type.gotpl *****************************