MCPcopy Create free account
hub / github.com/aws/smithy-go / decodeTag

Method decodeTag

document/cbor/decode.go:271–293  ·  view source on GitHub ↗
(tv *cbor.Tag, rv reflect.Value)

Source from the content-addressed store, hash-verified

269}
270
271func (d *decoder) decodeTag(tv *cbor.Tag, rv reflect.Value) error {
272 rvt := rv.Type()
273 switch {
274 case rvt.ConvertibleTo(serde.ReflectTypeOf.BigInt):
275 i, err := cbor.AsBigInt(tv)
276 if err != nil {
277 return &document.UnmarshalTypeError{Value: "tag", Type: rv.Type()}
278 }
279
280 rv.Set(reflect.ValueOf(*i).Convert(rvt))
281 return nil
282 case rvt.ConvertibleTo(serde.ReflectTypeOf.BigFloat):
283 i, err := asBigFloat(tv)
284 if err != nil {
285 return &document.UnmarshalTypeError{Value: "tag", Type: rv.Type()}
286 }
287
288 rv.Set(reflect.ValueOf(*i).Convert(rvt))
289 return nil
290 default:
291 return &document.UnmarshalTypeError{Value: "tag", Type: rv.Type()}
292 }
293}
294
295func (d *decoder) unsupportedType(rv reflect.Value) error {
296 if rv.Kind() == reflect.Interface && rv.NumMethod() != 0 {

Callers 1

decodeMethod · 0.95

Calls 3

AsBigIntFunction · 0.92
asBigFloatFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected