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

Method ReadFieldBegin

lib/go/thrift/simple_json_protocol.go:381–405  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

379}
380
381func (p *TSimpleJSONProtocol) ReadFieldBegin(ctx context.Context) (string, TType, int16, error) {
382 if err := p.ParsePreValue(); err != nil {
383 return "", STOP, 0, err
384 }
385 b, _ := p.reader.Peek(1)
386 if len(b) > 0 {
387 switch b[0] {
388 case JSON_RBRACE[0]:
389 return "", STOP, 0, nil
390 case JSON_QUOTE:
391 p.reader.ReadByte()
392 name, err := p.ParseStringBody()
393 // simplejson is not meant to be read back into thrift
394 // - see http://wiki.apache.org/thrift/ThriftUsageJava
395 // - use JSON instead
396 if err != nil {
397 return name, STOP, 0, err
398 }
399 return name, STOP, -1, p.ParsePostValue()
400 }
401 e := fmt.Errorf("Expected \"}\" or '\"', but found: '%s'", string(b))
402 return "", STOP, 0, NewTProtocolExceptionWithType(INVALID_DATA, e)
403 }
404 return "", STOP, 0, NewTProtocolException(io.EOF)
405}
406
407func (p *TSimpleJSONProtocol) ReadFieldEnd(ctx context.Context) error {
408 return nil

Callers

nothing calls this directly

Calls 7

ParsePreValueMethod · 0.95
ParseStringBodyMethod · 0.95
ParsePostValueMethod · 0.95
stringFunction · 0.85
NewTProtocolExceptionFunction · 0.85
ReadByteMethod · 0.65

Tested by

no test coverage detected