MCPcopy Create free account
hub / github.com/cloudwego/dynamicgo / FastRead

Method FastRead

testdata/kitex_gen/example3/k-example3.go:2551–2599  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

2549}
2550
2551func (p *InnerJSON) FastRead(b []byte) (off int, err error) {
2552 var ftyp thrift.TType
2553 var fid int16
2554 var l int
2555 x := thrift.BinaryProtocol{}
2556 for {
2557 ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
2558 off += l
2559 if err != nil {
2560 goto ReadFieldBeginError
2561 }
2562 if ftyp == thrift.STOP {
2563 break
2564 }
2565 switch uint32(fid)<<8 | uint32(ftyp) {
2566 case 0x10b: // p.A ID:1 thrift.STRING
2567 p.A, l, err = x.ReadString(b[off:])
2568 off += l
2569 if err != nil {
2570 goto ReadFieldError
2571 }
2572 case 0x20a: // p.B ID:2 thrift.I64
2573 p.B, l, err = x.ReadI64(b[off:])
2574 off += l
2575 if err != nil {
2576 goto ReadFieldError
2577 }
2578 case 0x304: // p.InnerForm ID:3 thrift.DOUBLE
2579 p.InnerForm, l, err = x.ReadDouble(b[off:])
2580 off += l
2581 if err != nil {
2582 goto ReadFieldError
2583 }
2584 default:
2585 l, err = x.Skip(b[off:], ftyp)
2586 off += l
2587 if err != nil {
2588 goto SkipFieldError
2589 }
2590 }
2591 }
2592 return
2593ReadFieldBeginError:
2594 return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
2595ReadFieldError:
2596 return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_InnerJSON[fid]), err)
2597SkipFieldError:
2598 return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
2599}
2600
2601func (p *ExamplePostForm) BLength() int {
2602 if p == nil {

Callers

nothing calls this directly

Calls 5

ReadFieldBeginMethod · 0.95
ReadStringMethod · 0.95
ReadI64Method · 0.95
ReadDoubleMethod · 0.95
SkipMethod · 0.95

Tested by

no test coverage detected