Coerces RESP2 flat-list responses into RESP3-style types based on the command.
RESP3 natively returns HGETALL as a map and SMEMBERS as a set. RESP2 returns flat lists for both. This module bridges the gap so callers get consistent types regardless of protocol version.
Usage
result = Coerce.coerce(["f1", "v1", "f2", "v2"], "HGETALL")
#=> %{"f1" => "v1", "f2" => "v2"}
result = Coerce.coerce(["a", "b", "c"], "SMEMBERS")
#=> MapSet.new(["a", "b", "c"])
Summary
Functions
Coerces a RESP2 result based on the command name. Returns the result unchanged if no coercion applies.
Extracts the command name from a command list for coercion lookup.
Functions
Coerces a RESP2 result based on the command name. Returns the result unchanged if no coercion applies.
Extracts the command name from a command list for coercion lookup.