Bulk rekey your maps. Simple bud. (☞゚ ヮ ゚)☞
Simply because I am super lazy, and writing out functions to take maps and convert them to different keys was boring (and irritating) me.
Stop writing defp from_x_to_y(data), do: %{ "another_id" => data["id"], "name" => data["title"] }
.
- Macro:
content<~>transformation
, content is your data, transformation is your rules. - Content: Any map. BYOD.
- Transformation:
from=>to
. Left is the original key, right is the new key.
def deps do
[
{:map_rewire, "~> 0.3.0"}
]
end
byjord | halostatue |