Last active
December 15, 2018 16:51
-
-
Save nyo16/dd9a7c6a40d049f916f046b08a5dc78b to your computer and use it in GitHub Desktop.
example in elixir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_active(nil), do: {:error, :not_found} | |
def is_active(%User{accounts: []}), do: {:error, :no_active_account} | |
def is_active(%User{accounts: accounts} = user), do: {:ok, user} | |
def is_active(_), do: {:error, :something_happend} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment