MCPcopy Create free account
hub / github.com/apache/thrift / ReadFieldBegin

Method ReadFieldBegin

lib/go/thrift/json_protocol.go:263–281  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

261}
262
263func (p *TJSONProtocol) ReadFieldBegin(ctx context.Context) (string, TType, int16, error) {
264 b, _ := p.reader.Peek(1)
265 if len(b) < 1 || b[0] == JSON_RBRACE[0] || b[0] == JSON_RBRACKET[0] {
266 return "", STOP, -1, nil
267 }
268 fieldId, err := p.ReadI16(ctx)
269 if err != nil {
270 return "", STOP, fieldId, err
271 }
272 if _, err = p.ParseObjectStart(); err != nil {
273 return "", STOP, fieldId, err
274 }
275 sType, err := p.ReadString(ctx)
276 if err != nil {
277 return "", STOP, fieldId, err
278 }
279 fType, err := p.StringToTypeId(sType)
280 return "", fType, fieldId, err
281}
282
283func (p *TJSONProtocol) ReadFieldEnd(ctx context.Context) error {
284 return p.ParseObjectEnd()

Callers

nothing calls this directly

Calls 4

ReadI16Method · 0.95
ReadStringMethod · 0.95
StringToTypeIdMethod · 0.95
ParseObjectStartMethod · 0.80

Tested by

no test coverage detected