mirror of
https://github.com/hanzo-ds/native.git
synced 2026-10-30 20:00:34 +00:00
proto.Name is sent in ClientHello and lands in the server's system.query_log, so it is wire visible; it now reads datastore/native and is covered by a test. Verified against the live server: the handshake succeeds and the new name appears in query_log. goimports' local-prefixes still named the upstream module, so it was not grouping this module's own imports. Doc comments, the deprecated-error markers in proto/error_codes.go and the package prose are swept. Dead references are removed rather than repointed: go-faster.org/docs/clickhouse and the mangled Datastore/clickhouse-cpp link both 404, and the list of other vendors' clients does not belong here. Four things deliberately keep the vendor name, and CI records why: LICENSE and AUTHORS are the copyright notices Apache-2.0 requires; db.system in query.go is an OpenTelemetry enum whose registered value for this DBMS is fixed by the specification, so emitting anything else would be non-conformant; and README names clickhouse-local, which is genuinely the binary our own server image ships. Numeric error codes and protocol revision constants are untouched.
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
//go:build !(amd64 || arm64 || riscv64) || purego
|
|
|
|
// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
|
|
|
|
package proto
|
|
|
|
import (
|
|
"encoding/binary"
|
|
|
|
"github.com/go-faster/errors"
|
|
)
|
|
|
|
var _ = binary.LittleEndian // the server uses LittleEndian
|
|
|
|
// DecodeColumn decodes Decimal32 rows from *Reader.
|
|
func (c *ColDecimal32) DecodeColumn(r *Reader, rows int) error {
|
|
if rows == 0 {
|
|
return nil
|
|
}
|
|
const size = 32 / 8
|
|
data, err := r.ReadRaw(rows * size)
|
|
if err != nil {
|
|
return errors.Wrap(err, "read")
|
|
}
|
|
v := *c
|
|
// Move bound check out of loop.
|
|
//
|
|
// See https://github.com/golang/go/issues/30945.
|
|
_ = data[len(data)-size]
|
|
for i := 0; i <= len(data)-size; i += size {
|
|
v = append(v,
|
|
Decimal32(binary.LittleEndian.Uint32(data[i:i+size])),
|
|
)
|
|
}
|
|
*c = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeColumn encodes Decimal32 rows to *Buffer.
|
|
func (c ColDecimal32) EncodeColumn(b *Buffer) {
|
|
v := c
|
|
if len(v) == 0 {
|
|
return
|
|
}
|
|
const size = 32 / 8
|
|
offset := len(b.Buf)
|
|
b.Buf = append(b.Buf, make([]byte, size*len(v))...)
|
|
for _, vv := range v {
|
|
binary.LittleEndian.PutUint32(
|
|
b.Buf[offset:offset+size],
|
|
uint32(vv),
|
|
)
|
|
offset += size
|
|
}
|
|
}
|
|
|
|
func (c ColDecimal32) WriteColumn(w *Writer) {
|
|
w.ChainBuffer(c.EncodeColumn)
|
|
}
|