MCPcopy Create free account
hub / github.com/segmentio/encoding / readStruct

Function readStruct

thrift/decode.go:584–613  ·  view source on GitHub ↗
(r Reader, f func(Reader, Field) error)

Source from the content-addressed store, hash-verified

582}
583
584func readStruct(r Reader, f func(Reader, Field) error) error {
585 lastFieldID := int16(0)
586 numFields := 0
587
588 for {
589 x, err := r.ReadField()
590 if err != nil {
591 if numFields > 0 {
592 err = dontExpectEOF(err)
593 }
594 return err
595 }
596
597 if x.Type == STOP {
598 return nil
599 }
600
601 if x.Delta {
602 x.ID += lastFieldID
603 x.Delta = false
604 }
605
606 if err := f(r, x); err != nil {
607 return with(dontExpectEOF(err), &decodeErrorField{cause: x})
608 }
609
610 lastFieldID = x.ID
611 numFields++
612 }
613}
614
615func skip(r Reader, t Type) error {
616 var err error

Callers 2

decodeMethod · 0.85
skipStructFunction · 0.85

Calls 3

dontExpectEOFFunction · 0.85
withFunction · 0.85
ReadFieldMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…