MCPcopy Index your code
hub / github.com/redspread/spread / argFromJSONType

Function argFromJSONType

pkg/data/parameter.go:173–192  ·  view source on GitHub ↗
(data interface{})

Source from the content-addressed store, hash-verified

171}
172
173func argFromJSONType(data interface{}) (*pb.Argument, error) {
174 arg := &pb.Argument{}
175 switch typedData := data.(type) {
176 case bool:
177 arg.Value = &pb.Argument_Boolean{
178 Boolean: typedData,
179 }
180 case float64:
181 arg.Value = &pb.Argument_Number{
182 Number: typedData,
183 }
184 case string:
185 arg.Value = &pb.Argument_Str{
186 Str: typedData,
187 }
188 default:
189 return nil, fmt.Errorf("unknown type: %+v", typedData)
190 }
191 return arg, nil
192}
193
194// simpleArgApply is used when no formatting template string is given.
195func simpleArgApply(field *pb.Field, arg *pb.Argument) error {

Callers 1

ParseArgumentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected