View Source Flint.Extensions.Block (Flint v0.6.0)
Adds support for do
block in field
and field!
to add validation_condition -> error_message
pairs to the field.
Block validations can be specified using do
blocks in field
and field!
. These are specified as lists of error_condition -> error_message
pairs. If the error condition returns true
, then the corresponding error_message
will be inserted into the changeset when using the generated changeset
, new
, and new!
functions.
Within these validations, you can pass custom bindings, meaning that you can define these validations with respect to variables only available at runtime.
In addition to any bindings you pass, the calues of the fields themselves will be available as a variable with the same name as the field.
You can also refer to local and imported / aliased function within these validations as well.
Summary
Functions
Uses the quoted expressions from the Flint.Schema.field
and Flint.Schema.field!
do
blocks to validate the changeset.
Functions
Uses the quoted expressions from the Flint.Schema.field
and Flint.Schema.field!
do
blocks to validate the changeset.
You can optionally pass bindings to be added to the evaluation context.