Elixir Language Pattern matching Pattern matching on a map


Example

%{username: username} = %{username: "John Doe", id: 1}
# username == "John Doe"
%{username: username, id: 2} = %{username: "John Doe", id: 1}
** (MatchError) no match of right hand side value: %{id: 1, username: "John Doe"}