Skip to content
This repository has been archived by the owner on Jul 24, 2022. It is now read-only.

Retun either {:ok, _} or :not_found when calling Repo.get(id) #50

Open
pedro-gutierrez opened this issue Oct 7, 2020 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed twelve

Comments

@pedro-gutierrez
Copy link
Contributor

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.

@pedro-gutierrez pedro-gutierrez added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed twelve
Projects
None yet
Development

No branches or pull requests

1 participant