Redix.Protocol.parse

You're seeing just the function parse, go back to Redix.Protocol module for more information.

Specs

parse(binary()) :: on_parse(redis_value())

Parses a RESP-encoded value from the given data.

Returns {:ok, value, rest} if a value is parsed successfully, or a continuation in the form {:continuation, fun} if the data is incomplete.

Examples

iex> Redix.Protocol.parse("+OK\r\ncruft")
{:ok, "OK", "cruft"}

iex> Redix.Protocol.parse("-ERR wrong type\r\n")
{:ok, %Redix.Error{message: "ERR wrong type"}, ""}

iex> {:continuation, fun} = Redix.Protocol.parse("+OK")
iex> fun.("\r\n")
{:ok, "OK", ""}