Files
zeekay 765c3d0aa1 hanzo-ds/native: de-branded native protocol lib (fork of clickhouse ch-go v0.71.0)
Module path, package names, and identifiers de-branded to native/proto/compress/
pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used
by hanzo-ds/go (proto + compress).
2026-07-10 13:10:07 -07:00

70 lines
1.3 KiB
Go

package proto
import "github.com/go-faster/errors"
type Profile struct {
Rows uint64
Blocks uint64
Bytes uint64
AppliedLimit bool
RowsBeforeLimit uint64
CalculatedRowsBeforeLimit bool
}
func (p *Profile) DecodeAware(r *Reader, _ int) error {
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "rows")
}
p.Rows = v
}
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "blocks")
}
p.Blocks = v
}
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "bytes")
}
p.Bytes = v
}
{
v, err := r.Bool()
if err != nil {
return errors.Wrap(err, "applied limit")
}
p.AppliedLimit = v
}
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "rows before limit")
}
p.RowsBeforeLimit = v
}
{
v, err := r.Bool()
if err != nil {
return errors.Wrap(err, "calculated rows before limit")
}
p.CalculatedRowsBeforeLimit = v
}
return nil
}
func (p Profile) EncodeAware(b *Buffer, _ int) {
ServerCodeProfile.Encode(b)
b.PutUVarInt(p.Rows)
b.PutUVarInt(p.Blocks)
b.PutUVarInt(p.Bytes)
b.PutBool(p.AppliedLimit)
b.PutUVarInt(p.RowsBeforeLimit)
b.PutBool(p.CalculatedRowsBeforeLimit)
}