View Source Ch.RowBinary (Ch v0.1.13)

Helpers for working with ClickHouse RowBinary format.

Link to this section Summary

Functions

Encodes a single row to RowBinary as iodata.

Encodes multiple rows to RowBinary as iodata.

Prepares types for encoding.

Link to this section 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(done, types)

View Source

Encodes multiple rows to RowBinary as iodata.

Examples:

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

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

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

Prepares types for encoding.

Examples:

iex> encoding_types(["UInt8"])
[:u8]

iex> encoding_types(["UInt8", "String"])
[:u8, :string]