Basics
Note
Client protocol reference is in progress.
Most examples are only in Go.
This document describes binary protocol for ClickHouse TCP clients.
Varint
For lengths, packet codes and other cases the unsigned varint encoding is used. Use binary.PutUvarint and binary.ReadUvarint.
Note
Signed varint is not used.
String
Variable length strings are encoded as (length, value), where length is varint and value is utf8 string.
Info
Validate length to prevent OOM:
0 ≤ len < MAX
- Encode
- Decode
- Hex dump
- Base64
- Go
Integers
Tip
ClickHouse uses Little Endian for fixed size integers.
Int32
- Hex dump
- Base64
Boolean
Booleans are represented by single byte, 1
is true
and 0
is false
.