# `Ch.RowBinary`
[🔗](https://github.com/plausible/ch/blob/v0.8.2/lib/ch/row_binary.ex#L1)

Helpers for working with ClickHouse [RowBinary](https://clickhouse.com/docs/en/interfaces/formats/RowBinary) format.

# `decode_names_and_rows`

Same as `decode_rows/1` but the first element is a list of column names.

Example:

    iex> decode_names_and_rows(<<1, 3, "1+1"::bytes, 5, "UInt8"::bytes, 2>>)
    [["1+1"], [2]]

# `decode_rows`

Decodes [RowBinaryWithNamesAndTypes](https://clickhouse.com/docs/en/interfaces/formats/RowBinaryWithNamesAndTypes) into rows.

Example:

    iex> decode_rows(<<1, 3, "1+1"::bytes, 5, "UInt8"::bytes, 2>>)
    [[2]]

# `decode_rows`

Decodes [RowBinary](https://clickhouse.com/docs/en/interfaces/formats/RowBinary) into rows.

Example:

    iex> decode_rows(<<1>>, ["UInt8"])
    [[1]]

# `encode_row`

Encodes a single row to [RowBinary](https://clickhouse.com/docs/en/interfaces/formats/RowBinary) as iodata.

Examples:

    iex> encode_row([], [])
    []

    iex> encode_row([1], ["UInt8"])
    [1]

    iex> encode_row([3, "hello"], ["UInt8", "String"])
    [3, [5 | "hello"]]

# `encode_rows`

Encodes multiple rows to [RowBinary](https://clickhouse.com/docs/en/interfaces/formats/RowBinary) as iodata.

Examples:

    iex> encode_rows([], [])
    []

    iex> encode_rows([[1]], ["UInt8"])
    [1]

    iex> encode_rows([[3, "hello"], [4, "hi"]], ["UInt8", "String"])
    [3, [5 | "hello"], 4, [2 | "hi"]]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
