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

Function marshalTestValue

go/fory/fory_test.go:567–578  ·  view source on GitHub ↗

TestSerializeZeroCopy is temporarily disabled during API refactoring TODO: Re-enable when zero-copy serialization API is updated * func TestSerializeZeroCopy(t *testing.T) { fory := NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(true)) list := []any{"str", make([]byte, 1000)} buf

(value any)

Source from the content-addressed store, hash-verified

565*/
566
567func marshalTestValue(value any) any {
568 if value == nil {
569 return value
570 }
571 valueRef := reflect.ValueOf(value)
572 if valueRef.Kind() == reflect.Struct {
573 ptr := reflect.New(valueRef.Type())
574 ptr.Elem().Set(valueRef)
575 return ptr.Interface()
576 }
577 return value
578}
579
580func serDeserializeTo(t *testing.T, fory *Fory, value any, to any) {
581 marshalValue := marshalTestValue(value)

Callers 2

serDeserializeToFunction · 0.85
serdeFunction · 0.85

Calls 3

KindMethod · 0.80
TypeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected