(ctx *WriteContext, typeID TypeId, value reflect.Value)
| 467 | } |
| 468 | |
| 469 | func 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 | |
| 497 | func readNumericValueByTypeID(ctx *ReadContext, targetType reflect.Type, typeID TypeId) (reflect.Value, bool) { |
| 498 | buf := ctx.Buffer() |
no test coverage detected