# ch_driver v0.1.1 - Table of Contents

> DBConnection driver speaking ClickHouse's native TCP protocol, including its LZ4/CityHash compression NIF and compressed-block wire envelope.

## Modules

- [ChDriver](ChDriver.md): Native ClickHouse TCP-protocol driver, exposed as a `DBConnection` pool.
- [ChDriver.Codec](ChDriver.Codec.md): LZ4 compression and CityHash checksums, backed by a Rust NIF.
- [ChDriver.Connection](ChDriver.Connection.md): Opens a TCP connection to ClickHouse and runs queries over it.
- [ChDriver.DBConnection](ChDriver.DBConnection.md): `DBConnection` behaviour implementation for ClickHouse's native TCP
protocol.
- [ChDriver.Params](ChDriver.Params.md): Converts Elixir values into ClickHouse query parameters.
- [ChDriver.Protocol](ChDriver.Protocol.md): Encodes and decodes ClickHouse native-protocol packets.
- [ChDriver.Protocol.Block.Compressed](ChDriver.Protocol.Block.Compressed.md): Encodes and decodes ClickHouse's compressed block envelope: a checksum
and a method marker wrapped around a block's bytes, LZ4-compressed or
plain.
- [ChDriver.Protocol.Block.Sparse](ChDriver.Protocol.Block.Sparse.md): Decodes ClickHouse's "sparse" column serialization.
- [ChDriver.Protocol.Block.Wrappers](ChDriver.Protocol.Block.Wrappers.md): Decoders for ClickHouse's wrapper and compound column types: `Nullable(T)`,
`Array(T)`, `Map(K, V)`, `LowCardinality(T)`, and `Decimal(P, S)`.
- [ChDriver.Protocol.ClientHello](ChDriver.Protocol.ClientHello.md): The initial packet sent by the client to open a connection.
- [ChDriver.Protocol.Messages](ChDriver.Protocol.Messages.md): Byte-level encoding and decoding for each ClickHouse native-protocol
message: Hello, Addendum, Query (with its ClientInfo sub-structure), the
empty Data packet, Ping, Exception, Progress, and ProfileInfo.
- [ChDriver.Protocol.NativeBlock](ChDriver.Protocol.NativeBlock.md): Decodes ClickHouse's "Native" block format — the columns and rows of a
query result, once any compression envelope has been stripped away.
- [ChDriver.Protocol.ServerHello](ChDriver.Protocol.ServerHello.md): The server's response to ClientHello, describing itself.
- [ChDriver.Protocol.Varint](ChDriver.Protocol.Varint.md): LEB128-style unsigned varint encoding used throughout ClickHouse's native
protocol for packet-type discriminants, lengths, revisions, and other
small-to-medium unsigned integers.
- [ChDriver.Query](ChDriver.Query.md): A query for `ChDriver.DBConnection`: a raw SQL string, plus enough parsed
state to bind parameters to it.
- [ChDriver.Result](ChDriver.Result.md): The result of executing a `ChDriver.Query`, returned from
`DBConnection.execute/3,4` via `ChDriver.query/2,3`.

- [ChDriver.Stream](ChDriver.Stream.md): An `Enumerable` that streams a query's rows one wire-protocol block at a
time, instead of loading the whole result into memory.
- [ChDriver.Types](ChDriver.Types.md): Parses ClickHouse column type strings, e.g. `"Nullable(String)"` or
`"Map(String, Decimal(10, 2))"`, into their component parts.
- [ChDriver.Types.Registry](ChDriver.Types.Registry.md): The scalar/fixed-width column type codec table, plus the primitive wire
readers it's built on.

- Exceptions
  - [ChDriver.Error](ChDriver.Error.md): Represents a `DB::Exception` (or `DB::NetException`) returned by the
server in an Exception packet (Server packet type 2).

