Skip to content

Instantly share code, notes, and snippets.

defmodule Tester do
defstruct [:first, :second]
def foo_to_bar(struct = %{__struct__: struct_module}) do
updated_list =
struct
|> Map.from_struct
|> Enum.map(&transform_value/1)
struct(struct_module, updated_list)
end