Hi,
I have a feeling that his would very stupid question, but I really can’t understand where is the problem.
I have the following code extract:
with {:ok, user_id} <- UserAuthentication.get_user_id(guest),
{:ok, user_name} <- UserAuthentication.get_user_name(guest),
{:ok, user_avatar} <- UserAuthentication.get_user_avatar(guest)
do
user = %{id: user_id, name: user_name, avatar: user_avatar}
end
UserAuthentication
def get_user_id(%AuthenticationStruct{} = auth_struct) do
{ :ok, auth_struct.uid }
end
auth_struct.uid - is just a binary string
When I run the above code the following error.
# no with clause matching: "Bim Bom"
The questions is why there is no match ?
why it is trying to match only string ? When the function get_user_id returns {ok, id } ?