Sorcery.Schema (sorcery v0.4.4)

In sorcery, you must define your entity types as 'Schemas'

defmodule MyApp.Player do
  use Sorcery.Schema, fields: %{
    name: %{t: :string, min: 0, max: 45, default: "Nameless"},
    age: %{t: :integer, min: 0, max: 99, optional?: false},
  }
end

See the guide for a comprehensive table of all possible attributes for each :t.

After you do the above setup, The MyApp.Player module will have some neat superpowers. Go take a look in iex.

Summary

Functions

Link to this function

meta_defaults(module)