Let's say I have a map with some user data:
iex(1)> user_map #=> %{name: "Some User", email: " user@example.com ", password: "*********"}
How can I load this into the %User{} structure (hopefully using some Rubyish Elixir magic)?
I have tried this for now, but they all failed. Go to the Structs section of the Elixir website.
user_struct = %{ %User{} | user_map } user_struct = %{ %User{} | Enum.to_list(user_map) }
source share