1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
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
}
|