Magik.Validator.validate_type

You're seeing just the function validate_type, go back to Magik.Validator module for more information.
Link to this function

validate_type(value, struct_name)

View Source

Validate data types.

iex(1)> Magik.Validator.validate_type("a string", :string)
:ok
iex(2)> Magik.Validator.validate_type("a string", :number)
{:error, "is not a number"}

Support built-in types:

  • boolean
  • integer
  • float
  • number (integer or float)
  • string | binary
  • tuple
  • map
  • array
  • atom
  • function
  • keyword

It can also check extend types

  • struct Ex: User
  • {:array, type} : array of type