rowbinary

package module
v0.0.0-...-0eefd46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BinaryTypeNothing                 = [1]byte{0x00}
	BinaryTypeUInt8                   = [1]byte{0x01}
	BinaryTypeUInt16                  = [1]byte{0x02}
	BinaryTypeUInt32                  = [1]byte{0x03}
	BinaryTypeUInt64                  = [1]byte{0x04}
	BinaryTypeUInt128                 = [1]byte{0x05}
	BinaryTypeUInt256                 = [1]byte{0x06}
	BinaryTypeInt8                    = [1]byte{0x07}
	BinaryTypeInt16                   = [1]byte{0x08}
	BinaryTypeInt32                   = [1]byte{0x09}
	BinaryTypeInt64                   = [1]byte{0x0A}
	BinaryTypeInt128                  = [1]byte{0x0B}
	BinaryTypeInt256                  = [1]byte{0x0C}
	BinaryTypeFloat32                 = [1]byte{0x0D}
	BinaryTypeFloat64                 = [1]byte{0x0E}
	BinaryTypeDate                    = [1]byte{0x0F}
	BinaryTypeDate32                  = [1]byte{0x10}
	BinaryTypeDateTime                = [1]byte{0x11}
	BinaryTypeDateTimeWithTimeZone    = [1]byte{0x12} // <var_uint_time_zone_name_size><time_zone_name_data>
	BinaryTypeDateTime64              = [1]byte{0x13} // <uint8_precision>
	BinaryTypeDateTime64WithTimeZone  = [1]byte{0x14} // <uint8_precision><var_uint_time_zone_name_size><time_zone_name_data>
	BinaryTypeString                  = [1]byte{0x15}
	BinaryTypeFixedString             = [1]byte{0x16} // <var_uint_size>
	BinaryTypeEnum8                   = [1]byte{0x17} // <var_uint_number_of_elements><var_uint_name_size_1><name_data_1><int8_value_1>...<var_uint_name_size_N><name_data_N><int8_value_N>
	BinaryTypeEnum16                  = [1]byte{0x18} // <var_uint_number_of_elements><var_uint_name_size_1><name_data_1><int16_little_endian_value_1>...><var_uint_name_size_N><name_data_N><int16_little_endian_value_N>
	BinaryTypeDecimal32               = [1]byte{0x19} // <uint8_precision><uint8_scale>
	BinaryTypeDecimal64               = [1]byte{0x1A} // <uint8_precision><uint8_scale>
	BinaryTypeDecimal128              = [1]byte{0x1B} // <uint8_precision><uint8_scale>
	BinaryTypeDecimal256              = [1]byte{0x1C} // <uint8_precision><uint8_scale>
	BinaryTypeUUID                    = [1]byte{0x1D}
	BinaryTypeArray                   = [1]byte{0x1E} // <nested_type_encoding>
	BinaryTypeTuple                   = [1]byte{0x1F} // <var_uint_number_of_elements><nested_type_encoding_1>...<nested_type_encoding_N>
	BinaryTypeTupleNamed              = [1]byte{0x20} // <var_uint_number_of_elements><var_uint_name_size_1><name_data_1><nested_type_encoding_1>...<var_uint_name_size_N><name_data_N><nested_type_encoding_N>
	BinaryTypeSet                     = [1]byte{0x21}
	BinaryTypeInterval                = [1]byte{0x22} // <interval_kind> (see interval kind binary encoding)
	BinaryTypeNullable                = [1]byte{0x23} // <nested_type_encoding>
	BinaryTypeFunction                = [1]byte{0x24} // <var_uint_number_of_arguments><argument_type_encoding_1>...<argument_type_encoding_N><return_type_encoding>
	BinaryTypeAggregateFunction       = [1]byte{0x25} // <var_uint_version><var_uint_function_name_size><function_name_data><var_uint_number_of_parameters><param_1>...<param_N><var_uint_number_of_arguments><argument_type_encoding_1>...<argument_type_encoding_N> (see aggregate function parameter binary encoding)
	BinaryTypeLowCardinality          = [1]byte{0x26} // <nested_type_encoding>
	BinaryTypeMap                     = [1]byte{0x27} // <key_type_encoding><value_type_encoding>
	BinaryTypeIPv4                    = [1]byte{0x28}
	BinaryTypeIPv6                    = [1]byte{0x29}
	BinaryTypeVariant                 = [1]byte{0x2A} // <var_uint_number_of_variants><variant_type_encoding_1>...<variant_type_encoding_N>
	BinaryTypeDynamic                 = [1]byte{0x2B} // <uint8_max_types>
	BinaryTypeCustom                  = [1]byte{0x2C} // <var_uint_type_name_size><type_name_data>
	BinaryTypeBool                    = [1]byte{0x2D}
	BinaryTypeSimpleAggregateFunction = [1]byte{0x2E} // <var_uint_function_name_size><function_name_data><var_uint_number_of_parameters><param_1>...<param_N><var_uint_number_of_arguments><argument_type_encoding_1>...<argument_type_encoding_N> (see aggregate function parameter binary encoding)
	BinaryTypeNested                  = [1]byte{0x2F} // <var_uint_number_of_elements><var_uint_name_size_1><name_data_1><nested_type_encoding_1>...<var_uint_name_size_N><name_data_N><nested_type_encoding_N>
	BinaryTypeJSON                    = [1]byte{0x30} // <uint8_serialization_version><var_int_max_dynamic_paths><uint8_max_dynamic_types><var_uint_number_of_typed_paths><var_uint_path_name_size_1><path_name_data_1><encoded_type_1>...<var_uint_number_of_skip_paths><var_uint_skip_path_size_1><skip_path_data_1>...<var_uint_number_of_skip_path_regexps><var_uint_skip_path_regexp_size_1><skip_path_data_regexp_1>...
	BinaryTypeBFloat16                = [1]byte{0x31}
	BinaryTypeTime                    = [1]byte{0x32}
	BinaryTypeTime64                  = [1]byte{0x34} // <uint8_precision>
)
View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func Array

func Array[V any](valueType Type[V]) *typeArray[V]

func ArrayAny

func ArrayAny(valueType Any) *typeArrayAny

func Decimal

func Decimal(precision uint8, scale uint8) *typeDecimal

func Eq

func Eq(a, b Any) bool

func FixedString

func FixedString(length int) *typeFixedString

func LowCardinality

func LowCardinality[V any](valueType Type[V]) *typeLowCardinality[V]

func LowCardinalityAny

func LowCardinalityAny(valueType Any) *typeLowCardinalityAny

func Map

func Map[K comparable, V any](keyType Type[K], valueType Type[V]) *typeMap[K, V]

func MapAny

func MapAny(keyType Any, valueType Any) *typeMapAny

func Nullable

func Nullable[V any](valueType Type[V]) *typeNullable[V]

func NullableAny

func NullableAny(valueType Any) *typeNullableAny

func Read

func Read[V any](r *FormatReader, tp Type[V]) (V, error)

func TupleAny

func TupleAny(valueTypes ...Any) *typeTupleAny

func UseBinaryHeader

func UseBinaryHeader(value bool) useBinaryHeaderType

func Write

func Write[V any](w *FormatWriter, tp Type[V], value V) error

Types

type Any

type Any interface {
	String() string
	Binary() []byte
	ReadAny(r Reader) (any, error)
	WriteAny(w Writer, v any) error
}

func DecodeBinaryType

func DecodeBinaryType(r decodeBinaryTypeReader) (Any, error)

DecodeBinaryType decodes a binary type from the given reader.

type Column

type Column struct {
	// contains filtered or unexported fields
}

func NewColumn

func NewColumn(name string, tp Any) Column

type Format

type Format int
const (
	RowBinary                  Format = 0
	RowBinaryWithNames         Format = 1
	RowBinaryWithNamesAndTypes Format = 2
)

func (Format) Eq

func (f Format) Eq(other Format) bool

func (Format) In

func (f Format) In(other ...Format) bool

func (Format) String

func (f Format) String() string

type FormatOption

type FormatOption interface {
	// contains filtered or unexported methods
}

type FormatReader

type FormatReader struct {
	// contains filtered or unexported fields
}

func NewFormatReader

func NewFormatReader(wrap io.Reader, opts ...FormatOption) *FormatReader

func (*FormatReader) Err

func (r *FormatReader) Err() error

func (*FormatReader) Next

func (r *FormatReader) Next() bool

func (*FormatReader) ReadAny

func (r *FormatReader) ReadAny() (any, error)

type FormatWriter

type FormatWriter struct {
	// contains filtered or unexported fields
}

func NewFormatWriter

func NewFormatWriter(wrap io.Writer, opts ...FormatOption) *FormatWriter

func (*FormatWriter) Err

func (w *FormatWriter) Err() error

func (*FormatWriter) WriteAny

func (w *FormatWriter) WriteAny(values ...any) error

func (*FormatWriter) WriteHeader

func (w *FormatWriter) WriteHeader() error

type Reader

type Reader interface {
	io.Reader
	io.ByteScanner
	// contains filtered or unexported methods
}

func NewReader

func NewReader(r io.Reader) Reader

type Type

type Type[T any] interface {
	String() string
	Binary() []byte // https://clickhouse.com/docs/sql-reference/data-types/data-types-binary-encoding
	Read(r Reader) (T, error)
	Write(w Writer, v T) error
	ReadAny(r Reader) (any, error)
	WriteAny(w Writer, v any) error
}
var Bool Type[bool] = &typeBool{}
var Date Type[time.Time] = &typeDate{}
var DateTime Type[time.Time] = &typeDateTime{}
var Float32 Type[float32] = &typeFloat32{}
var Float64 Type[float64] = &typeFloat64{}
var Int16 Type[int16] = &typeInt16{}
var Int32 Type[int32] = &typeInt32{}
var Int64 Type[int64] = &typeInt64{}
var Int8 Type[int8] = &typeInt8{}
var MapUInt32UInt32 Type[map[uint32]uint32] = Map(UInt32, UInt32)
var Nothing Type[any] = &typeNothing{}
var String Type[string] = &typeString{}
var UInt16 Type[uint16] = &typeUInt16{}
var UInt32 Type[uint32] = &typeUInt32{}
var UInt64 Type[uint64] = &typeUInt64{}
var UInt8 Type[uint8] = &typeUInt8{}
var UUID Type[uuid.UUID] = &typeUUID{}
var UVarint Type[uint64] = &typeUVarint{}

type Writer

type Writer interface {
	io.Writer
	io.ByteWriter
	// contains filtered or unexported methods
}

func NewWriter

func NewWriter(w io.Writer) Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL