Ch.RowBinary (Ch v0.3.1)
View SourceHelpers for working with ClickHouse RowBinary
format.
Summary
Functions
Same as decode_rows/1
but the first element is a list of column names.
Decodes RowBinaryWithNamesAndTypes
into rows.
Decodes RowBinary
into rows.
Encodes a single row to RowBinary
as iodata.
Encodes multiple rows to RowBinary
as iodata.
Functions
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]]
Decodes RowBinaryWithNamesAndTypes
into rows.
Example:
iex> decode_rows(<<1, 3, "1+1"::bytes, 5, "UInt8"::bytes, 2>>)
[[2]]
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"]]
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"]]