1
0
mirror of https://github.com/uptrace/go-clickhouse.git synced 2025-06-08 23:26:11 +02:00
go-clickhouse/ch/internal/codegen/column_safe.tpl

33 lines
497 B
Smarty
Raw Normal View History

//go:build !amd64 && !arm64
package chschema
import (
"github.com/uptrace/go-clickhouse/ch/chproto"
)
{{- range . }}
func (c *{{ .CHType }}Column) ReadFrom(rd *chproto.Reader, numRow int) error {
c.Alloc(numRow)
for i := range c.Column {
n, err := rd.{{ .CHType }}()
if err != nil {
return err
}
c.Column[i] = n
}
return nil
}
func (c *{{ .CHType }}Column) WriteTo(wr *chproto.Writer) error {
for _, n := range c.Column {
wr.{{ .CHType }}(n)
}
return nil
}
{{- end }}