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

35 lines
545 B
Smarty
Raw Normal View History

//go:build !amd64 && !arm64
package chschema
import (
"github.com/uptrace/go-clickhouse/ch/chproto"
)
{{- range . }}
2023-01-21 12:14:00 +02:00
{{ if eq .Size 0 }} {{ continue }} {{ end }}
func (c *{{ .Name }}Column) ReadFrom(rd *chproto.Reader, numRow int) error {
c.AllocForReading(numRow)
for i := range c.Column {
2023-01-21 12:14:00 +02:00
n, err := rd.{{ .Name }}()
if err != nil {
return err
}
c.Column[i] = n
}
return nil
}
2023-01-21 12:14:00 +02:00
func (c *{{ .Name }}Column) WriteTo(wr *chproto.Writer) error {
for _, n := range c.Column {
2023-01-21 12:14:00 +02:00
wr.{{ .Name }}(n)
}
return nil
}
{{- end }}