Turn maps (and keyword lists) into structs
One nice way of turning a map or keyword list into an existing struct is to use struct/2 or struct!/2.
What about attributes that aren’t defined in the struct?
-
struct/2will drop them 👋 -
struct!/2will raise an error 💥
Check it out! 👀
👉 https://www.elixirstreams.com/tips/turn-maps-into-structs-with-struct
Read next Thinking Elixir 160: LiveView Async Pattern and Admin Tools
