What does %User{} = user means?

menw
Tue, 06 Sep 2022 06:02:04 +0000
Questions / Help

Hi, I’m new in ecto and elixir.
Well, I’m learning about phoenix, ecto and found this sample code

def change_registration(%User{} = user, params) do
    User.registration_changeset(user, params)
 end

Does %User{} = user make sense?
I thought the user = %User{} should be right because user is a variable, but
it isn’t in here.

Am I understanding structure and variables wrong?

4 posts - 3 participants