Crecto
Search…
Constraints
Crecto provides validations and constraints which are turned into changeset errors.
Constraints errors are only applied after interacting with the database.
1
class User < Crecto::Model
2
schema "users" do
3
field :uuid, String
4
end
5
6
# If the database row has a UNIQUE constraint, the exception will be caught
7
# and returned as a `changeset` error.
8
unique_constraint :email
9
end
Copied!
Copy link