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

Method ReadField

thrift/compact.go:115–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113}
114
115func (r *compactReader) ReadField() (Field, error) {
116 f := Field{}
117
118 b, err := r.ReadByte()
119 if err != nil {
120 return f, err
121 }
122
123 if Type(b) == STOP {
124 return f, nil
125 }
126
127 if (b >> 4) != 0 {
128 f = Field{ID: int16(b >> 4), Type: Type(b & 0xF), Delta: true}
129 } else {
130 i, err := r.ReadInt16()
131 if err != nil {
132 return f, dontExpectEOF(err)
133 }
134 f = Field{ID: i, Type: Type(b)}
135 }
136
137 return f, nil
138}
139
140func (r *compactReader) ReadList() (List, error) {
141 b, err := r.ReadByte()

Callers

nothing calls this directly

Calls 4

ReadByteMethod · 0.95
ReadInt16Method · 0.95
dontExpectEOFFunction · 0.85
TypeTypeAlias · 0.70

Tested by

no test coverage detected