aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/client_data.go
blob: 286ddb48537425550891a3ca6388d2d1402c562a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package proto

import "github.com/go-faster/errors"

type ClientData struct {
	TableName string
}

func (c ClientData) EncodeAware(b *Buffer, version int) {
	if FeatureTempTables.In(version) {
		b.PutString(c.TableName)
	}
}

func (c *ClientData) DecodeAware(r *Reader, version int) error {
	if FeatureTempTables.In(version) {
		v, err := r.Str()
		if err != nil {
			return errors.Wrap(err, "temp tables")
		}
		c.TableName = v
	}
	return nil
}