Skip to content

Instantly share code, notes, and snippets.

@moroz
Created April 5, 2021 10:10
Show Gist options
  • Save moroz/7a4a140cd3910fd2dd61101c0347c725 to your computer and use it in GitHub Desktop.
Save moroz/7a4a140cd3910fd2dd61101c0347c725 to your computer and use it in GitHub Desktop.
Custom Elixir guard for IDs
defmodule MyApp.Guards do
defguard is_id(id) when is_binary(id) or is_integer(id)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment