Mapa eliksiru do nowej mapy
users_list = [
%{id: 1, name: "Alice", role: "user", age: 20},
%{id: 2, name: "Bob", role: "admin", age: 30},
%{id: 3, name: "John", role: "editor", age: 40}
]
users = Enum.map(users_list, fn user_struct ->
Map.take(user_struct, [:id, :name])
end)
# [
# %{id: 1, name: "Alice"},
# %{id: 2, name: "Bob"},
# %{id: 3, name: "John"}
# ]
patrick204nqh