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

Method Read

go/fory/set.go:522–552  ·  view source on GitHub ↗
(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value)

Source from the content-addressed store, hash-verified

520}
521
522func (s setSerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
523 buf := ctx.Buffer()
524 ctxErr := ctx.Err()
525 if refMode != RefModeNone {
526 refID, refErr := ctx.RefResolver().TryPreserveRefId(buf)
527 if refErr != nil {
528 ctx.SetError(FromError(refErr))
529 return
530 }
531 if refID < int32(NotNullValueFlag) {
532 // Reference found or null
533 obj := ctx.RefResolver().GetReadObject(refID)
534 if obj.IsValid() {
535 value.Set(obj)
536 }
537 return
538 }
539 }
540 if readType {
541 // Read and discard type ID for sets
542 typeID := uint32(buf.ReadUint8(ctxErr))
543 if ctx.HasError() {
544 return
545 }
546 if typeID != uint32(SET) {
547 ctx.SetError(DeserializationErrorf("set type mismatch: expected SET (%d), got %d", SET, typeID))
548 return
549 }
550 }
551 s.ReadData(ctx, value)
552}
553
554func (s setSerializer) ReadWithTypeInfo(ctx *ReadContext, refMode RefMode, typeInfo *TypeInfo, value reflect.Value) {
555 s.Read(ctx, refMode, false, false, value)

Callers 1

ReadWithTypeInfoMethod · 0.95

Calls 14

ReadDataMethod · 0.95
FromErrorFunction · 0.85
DeserializationErrorfFunction · 0.85
TryPreserveRefIdMethod · 0.80
GetReadObjectMethod · 0.80
ReadUint8Method · 0.80
int32Function · 0.50
uint32Function · 0.50
BufferMethod · 0.45
ErrMethod · 0.45
RefResolverMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected