View Source Ch.RowBinary (Ch v0.2.7)

Helpers for working with ClickHouse RowBinary format.

Summary

Functions

Link to this function

decode_rows(row_binary_with_names_and_types)

View Source

Decodes RowBinaryWithNamesAndTypes into rows.

Example:

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

decode_rows(row_binary, types)

View Source

Decodes RowBinary into rows.

Example:

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

Encodes a single row to RowBinary as iodata.

Examples:

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

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

iex> encode_row([3, "hello"], ["UInt8", "String"])
[3, [5 | "hello"]]
Link to this function

encode_rows(rows, types)

View Source

Encodes multiple rows to 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"]]