SQL Injections vs Elixir Thinking Elixir 160: LiveView Async Pattern and Admin Tools

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/2 will drop them 👋
  • struct!/2 will raise an error 💥

Check it out! 👀

👉 https://www.elixirstreams.com/tips/turn-maps-into-structs-with-struct