MCPcopy Create free account
hub / github.com/apache/fory / writeNumericValueByTypeID

Function writeNumericValueByTypeID

go/fory/union.go:469–495  ·  view source on GitHub ↗
(ctx *WriteContext, typeID TypeId, value reflect.Value)

Source from the content-addressed store, hash-verified

467}
468
469func writeNumericValueByTypeID(ctx *WriteContext, typeID TypeId, value reflect.Value) {
470 buf := ctx.Buffer()
471 switch typeID {
472 case INT32:
473 buf.WriteInt32(int32(value.Int()))
474 case VARINT32:
475 buf.WriteVarint32(int32(value.Int()))
476 case UINT32:
477 buf.WriteUint32(uint32(value.Uint()))
478 case VAR_UINT32:
479 buf.WriteVarUint32(uint32(value.Uint()))
480 case INT64:
481 buf.WriteInt64(value.Int())
482 case VARINT64:
483 buf.WriteVarint64(value.Int())
484 case TAGGED_INT64:
485 buf.WriteTaggedInt64(value.Int())
486 case UINT64:
487 buf.WriteUint64(value.Uint())
488 case VAR_UINT64:
489 buf.WriteVarUint64(value.Uint())
490 case TAGGED_UINT64:
491 buf.WriteTaggedUint64(value.Uint())
492 default:
493 ctx.SetError(SerializationErrorf("unsupported union numeric type id: %d", typeID))
494 }
495}
496
497func readNumericValueByTypeID(ctx *ReadContext, targetType reflect.Type, typeID TypeId) (reflect.Value, bool) {
498 buf := ctx.Buffer()

Callers 1

writeUnionOverrideValueFunction · 0.85

Calls 15

SerializationErrorfFunction · 0.85
WriteUint32Method · 0.80
WriteUint64Method · 0.80
WriteVarUint64Method · 0.80
WriteTaggedUint64Method · 0.80
int32Function · 0.50
uint32Function · 0.50
BufferMethod · 0.45
WriteInt32Method · 0.45
WriteVarint32Method · 0.45
WriteVarUint32Method · 0.45
WriteInt64Method · 0.45

Tested by

no test coverage detected