Ecto.Repo's get_by/3 expects a set of clauses that will return exactly one entry from the repository. If multiple results are returned, it throws Ecto.MultipleResultsError.
iex> User.get_by is_active: true
# ** (Ecto.MultipleResultsError) expected at most one result but got 2 in query
SwissSchema's get_by/2 might be better off with a {:error, :some_atom_error}, which fits better with the tuple-based expected format for errors.
Ecto.Repo's
get_by/3
expects a set of clauses that will return exactly one entry from the repository. If multiple results are returned, it throwsEcto.MultipleResultsError
.SwissSchema's
get_by/2
might be better off with a{:error, :some_atom_error}
, which fits better with the tuple-based expected format for errors.