Sortable v0.1.0 Sortable View Source
Sortable is a library to provide serialization with order reserved.
Link to this section Summary
Functions
Decode binary with Sortable format to list of binaries, floats or integers
Encode a list of binaries, floats or integers to binary with order reserved
Link to this section Types
Link to this section Functions
Link to this function
decode(data) View Source
Decode binary with Sortable format to list of binaries, floats or integers.
Example
iex> encoded = Sortable.encode(["foo", "bar", 123])
<<31, 102, 111, 111, 0, 31, 98, 97, 114, 0, 199>>
iex> Sortable.decode(encoded)
["foo", "bar", 123]
Link to this function
encode(list) View Source
Encode a list of binaries, floats or integers to binary with order reserved.
Example
iex> x = Sortable.encode(["foo", 99])
<<31, 102, 111, 111, 0, 175>>
iex> y = Sortable.encode(["foo", 1999])
<<31, 102, 111, 111, 0, 205, 7, 207>>
iex> x < y
true