Skip to content

Instantly share code, notes, and snippets.

@leandrocp
Last active October 25, 2018 12:43
Show Gist options
  • Save leandrocp/01b3bcd443fd7933746a2ca745def960 to your computer and use it in GitHub Desktop.
Save leandrocp/01b3bcd443fd7933746a2ca745def960 to your computer and use it in GitHub Desktop.
art_bc_support_specs.ex
defmodule Support do
@type customer :: %{id: integer, last_ticket_id: integer}
@spec get_customer(integer) :: {:ok, customer} | {:error, binary}
def get_customer(customer_id) when is_integet(customer_id) do
# your logic here ...
# return the common pattern {:ok, data} or {:error, data}
{:ok, customer}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment