View Source Rivet.Utils.Ecto.Changeset (rivet_utils v1.0.2)
extensions for ecto change sets
Contributor: Brandon Gillespie
Link to this section Summary
Functions
If the key exists in the changeset, make sure it's a clean value
For a value that is a list of maps, validate each element with func
Convert keys map to atoms
(replacement for validate_format, which supports negation)
free-form updating, like a map
Link to this section Functions
If the key exists in the changeset, make sure it's a clean value
For a value that is a list of maps, validate each element with func
Convert keys map to atoms
(replacement for validate_format, which supports negation)
Validates a change has the given format.
The format has to be expressed as a regular expression.
options
Options
:message
- the message on failure, defaults to "has invalid format":not
- invert match for truth. default is false
examples
Examples
validate_rex(changeset, :email, ~r/@/)
validate_rex(changeset, :thing, ~r/[^a-z0-9]/, not: true)
free-form updating, like a map