Binary reader primitives for the Quack wire format.
Provides field ids, LEB128 integers, strings/blobs, nullable values, optional indexes, fixed-width numbers, and DuckDB hugeint decoding with structured protocol errors on malformed input.
Summary
Types
@type read_result(value) :: {:ok, value, binary()} | {:error, QuackDB.Error.t()}
Functions
@spec read_blob(binary()) :: read_result(binary())
@spec read_bool(binary()) :: read_result(boolean())
@spec read_field_id(binary()) :: read_result(non_neg_integer())
@spec read_float32(binary()) :: read_result(float())
@spec read_float64(binary()) :: read_result(float())
@spec read_hugeint(binary()) :: read_result(integer())
@spec read_int8(binary()) :: read_result(integer())
@spec read_int16(binary()) :: read_result(integer())
@spec read_int32(binary()) :: read_result(integer())
@spec read_int64(binary()) :: read_result(integer())
@spec read_list(binary(), (binary() -> read_result(value))) :: read_result([value]) when value: term()
@spec read_nullable(binary(), (binary() -> read_result(value))) :: read_result(value | nil) when value: term()
@spec read_optional_index(binary()) :: read_result(non_neg_integer() | nil)
@spec read_sleb128(binary()) :: read_result(integer())
@spec read_string(binary()) :: read_result(String.t())
@spec read_uint8(binary()) :: read_result(non_neg_integer())
@spec read_uint16(binary()) :: read_result(non_neg_integer())
@spec read_uint32(binary()) :: read_result(non_neg_integer())
@spec read_uint64(binary()) :: read_result(non_neg_integer())
@spec read_uleb128(binary()) :: read_result(non_neg_integer())
@spec take(binary(), non_neg_integer()) :: read_result(binary())