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

Method FastRead

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

Source from the content-addressed store, hash-verified

1316}
1317
1318func (p *ExampleErrorResp) FastRead(b []byte) (off int, err error) {
1319 var ftyp thrift.TType
1320 var fid int16
1321 var l int
1322 x := thrift.BinaryProtocol{}
1323 for {
1324 ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
1325 off += l
1326 if err != nil {
1327 goto ReadFieldBeginError
1328 }
1329 if ftyp == thrift.STOP {
1330 break
1331 }
1332 switch uint32(fid)<<8 | uint32(ftyp) {
1333 case 0x20a: // p.Int64 ID:2 thrift.I64
1334 p.Int64, l, err = x.ReadI64(b[off:])
1335 off += l
1336 if err != nil {
1337 goto ReadFieldError
1338 }
1339 case 0x40b: // p.Xjson ID:4 thrift.STRING
1340 p.Xjson, l, err = x.ReadString(b[off:])
1341 off += l
1342 if err != nil {
1343 goto ReadFieldError
1344 }
1345 default:
1346 l, err = x.Skip(b[off:], ftyp)
1347 off += l
1348 if err != nil {
1349 goto SkipFieldError
1350 }
1351 }
1352 }
1353 return
1354ReadFieldBeginError:
1355 return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
1356ReadFieldError:
1357 return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleErrorResp[fid]), err)
1358SkipFieldError:
1359 return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
1360}
1361
1362func (p *ExampleInt2Float) BLength() int {
1363 if p == nil {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected