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

79 lines
1.3 KiB
Go

package proto
import (
"github.com/go-faster/errors"
)
// Progress of query execution.
type Progress struct {
Rows uint64
Bytes uint64
TotalRows uint64
WroteRows uint64
WroteBytes uint64
ElapsedNs uint64
}
func (p Progress) EncodeAware(b *Buffer, version int) {
b.PutUVarInt(p.Rows)
b.PutUVarInt(p.Bytes)
b.PutUVarInt(p.TotalRows)
if FeatureClientWriteInfo.In(version) {
b.PutUVarInt(p.WroteRows)
b.PutUVarInt(p.WroteBytes)
}
if FeatureServerQueryTimeInProgress.In(version) {
b.PutUVarInt(p.ElapsedNs)
}
}
func (p *Progress) DecodeAware(r *Reader, version 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, "bytes")
}
p.Bytes = v
}
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "total rows")
}
p.TotalRows = v
}
if FeatureClientWriteInfo.In(version) {
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "wrote rows")
}
p.WroteRows = v
}
{
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "wrote bytes")
}
p.WroteBytes = v
}
}
if FeatureServerQueryTimeInProgress.In(version) {
v, err := r.UVarInt()
if err != nil {
return errors.Wrap(err, "wrote rows")
}
p.ElapsedNs = v
}
return nil
}