Is your feature request related to a problem? Please describe.
At the moment, every time we ask for a model by id, we return turn the result of doing Repo.get(id) and this returns either a struct or nil. While this is fine, it is not so easy to pattern match in the caller code.
Describe the solution you'd like
Return a tuple {:ok, term()} when the model is found. Return :not_found when no such a row exists in the database.
Is your feature request related to a problem? Please describe. At the moment, every time we ask for a model by id, we return turn the result of doing
Repo.get(id)
and this returns either a struct or nil. While this is fine, it is not so easy to pattern match in the caller code.Describe the solution you'd like Return a tuple
{:ok, term()}
when the model is found. Return:not_found
when no such a row exists in the database.