// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.

package proto

import (
	"encoding/binary"

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

var _ = binary.LittleEndian // clickHouse uses LittleEndian

// DecodeColumn decodes UInt8 rows from *Reader.
func (c *ColUInt8) DecodeColumn(r *Reader, rows int) error {
	if rows == 0 {
		return nil
	}
	data, err := r.ReadRaw(rows)
	if err != nil {
		return errors.Wrap(err, "read")
	}
	*c = append(*c, data...)
	return nil
}

// EncodeColumn encodes UInt8 rows to *Buffer.
func (c ColUInt8) EncodeColumn(b *Buffer) {
	v := c
	if len(v) == 0 {
		return
	}
	b.Buf = append(b.Buf, v...)
}

func (c ColUInt8) WriteColumn(w *Writer) {
	w.ChainWrite([]byte(c))
}
