Skip to content

Instantly share code, notes, and snippets.

@PragTob
Created July 24, 2017 19:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save PragTob/5b708fda67d2e0bbcd63a513390430e5 to your computer and use it in GitHub Desktop.
railway oriented programming
with {:ok, record} <- validate_data(params),
{:ok, record} <- validate_in_other_system(record),
{:ok, record} <- Repo.insert(record) do
{:ok, record}
else
{:error, changeset} -> {:error, changeset}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment