mirror of
https://github.com/hanzo-ds/native.git
synced 2026-10-30 20:00:34 +00:00
Module path, package names, and identifiers de-branded to native/proto/compress/ pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used by hanzo-ds/go (proto + compress).
49 lines
979 B
Go
49 lines
979 B
Go
//go:build (amd64 || arm64 || riscv64) && !purego
|
|
|
|
// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
|
|
|
|
package proto
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/go-faster/errors"
|
|
)
|
|
|
|
// DecodeColumn decodes Int8 rows from *Reader.
|
|
func (c *ColInt8) DecodeColumn(r *Reader, rows int) error {
|
|
if rows == 0 {
|
|
return nil
|
|
}
|
|
*c = append(*c, make([]int8, rows)...)
|
|
s := *(*slice)(unsafe.Pointer(c))
|
|
dst := *(*[]byte)(unsafe.Pointer(&s))
|
|
if err := r.ReadFull(dst); err != nil {
|
|
return errors.Wrap(err, "read full")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeColumn encodes Int8 rows to *Buffer.
|
|
func (c ColInt8) EncodeColumn(b *Buffer) {
|
|
v := c
|
|
if len(v) == 0 {
|
|
return
|
|
}
|
|
offset := len(b.Buf)
|
|
b.Buf = append(b.Buf, make([]byte, len(v))...)
|
|
s := *(*slice)(unsafe.Pointer(&v))
|
|
src := *(*[]byte)(unsafe.Pointer(&s))
|
|
dst := b.Buf[offset:]
|
|
copy(dst, src)
|
|
}
|
|
|
|
func (c ColInt8) WriteColumn(w *Writer) {
|
|
v := c
|
|
if len(v) == 0 {
|
|
return
|
|
}
|
|
src := *(*[]byte)(unsafe.Pointer(&v))
|
|
w.ChainWrite(src)
|
|
}
|