dal/pkg/proto/row_gen.go
Anton Nesterov 920098e80c
[wip] proto: streaming rows with msgpack
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-15 06:23:46 +02:00

154 lines
3.1 KiB
Go

package proto
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
import (
"github.com/tinylib/msgp/msgp"
)
// DecodeMsg implements msgp.Decodable
func (z *Row) DecodeMsg(dc *msgp.Reader) (err error) {
var field []byte
_ = field
var zb0001 uint32
zb0001, err = dc.ReadMapHeader()
if err != nil {
err = msgp.WrapError(err)
return
}
for zb0001 > 0 {
zb0001--
field, err = dc.ReadMapKeyPtr()
if err != nil {
err = msgp.WrapError(err)
return
}
switch msgp.UnsafeString(field) {
case "r":
var zb0002 uint32
zb0002, err = dc.ReadArrayHeader()
if err != nil {
err = msgp.WrapError(err, "Data")
return
}
if cap(z.Data) >= int(zb0002) {
z.Data = (z.Data)[:zb0002]
} else {
z.Data = make([]interface{}, zb0002)
}
for za0001 := range z.Data {
z.Data[za0001], err = dc.ReadIntf()
if err != nil {
err = msgp.WrapError(err, "Data", za0001)
return
}
}
default:
err = dc.Skip()
if err != nil {
err = msgp.WrapError(err)
return
}
}
}
return
}
// EncodeMsg implements msgp.Encodable
func (z *Row) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 1
// write "r"
err = en.Append(0x81, 0xa1, 0x72)
if err != nil {
return
}
err = en.WriteArrayHeader(uint32(len(z.Data)))
if err != nil {
err = msgp.WrapError(err, "Data")
return
}
for za0001 := range z.Data {
err = en.WriteIntf(z.Data[za0001])
if err != nil {
err = msgp.WrapError(err, "Data", za0001)
return
}
}
return
}
// MarshalMsg implements msgp.Marshaler
func (z *Row) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 1
// string "r"
o = append(o, 0x81, 0xa1, 0x72)
o = msgp.AppendArrayHeader(o, uint32(len(z.Data)))
for za0001 := range z.Data {
o, err = msgp.AppendIntf(o, z.Data[za0001])
if err != nil {
err = msgp.WrapError(err, "Data", za0001)
return
}
}
return
}
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Row) UnmarshalMsg(bts []byte) (o []byte, err error) {
var field []byte
_ = field
var zb0001 uint32
zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
for zb0001 > 0 {
zb0001--
field, bts, err = msgp.ReadMapKeyZC(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
switch msgp.UnsafeString(field) {
case "r":
var zb0002 uint32
zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Data")
return
}
if cap(z.Data) >= int(zb0002) {
z.Data = (z.Data)[:zb0002]
} else {
z.Data = make([]interface{}, zb0002)
}
for za0001 := range z.Data {
z.Data[za0001], bts, err = msgp.ReadIntfBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Data", za0001)
return
}
}
default:
bts, err = msgp.Skip(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
}
}
o = bts
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *Row) Msgsize() (s int) {
s = 1 + 2 + msgp.ArrayHeaderSize
for za0001 := range z.Data {
s += msgp.GuessSize(z.Data[za0001])
}
return
}