Schema-driven BSATN encoding. Inverse of RowDecoder.decode_value/2.
Encodes Elixir values into BSATN binary using algebraic type information from the schema, so callers don't need to know the wire format.
Summary
Functions
Encode reducer arguments from a map of param names to values.
Encode an Elixir value to BSATN binary given its algebraic type.
Functions
Encode reducer arguments from a map of param names to values.
Uses the reducer's param definitions (from schema) to encode each argument in the correct order as a BSATN product.
Parameters
args_map- Map of%{"param_name" => value}or%{param_name: value}params- List of%{name: String.t(), type: algebraic_type()}from schema
Encode an Elixir value to BSATN binary given its algebraic type.
Examples
iex> encode_value(42, :u32)
{:ok, <<42, 0, 0, 0>>}
iex> encode_value("hello", :string)
{:ok, <<5, 0, 0, 0, "hello">>}