Cqrs.ValueObject behaviour (cqrs_tools v0.5.28) View Source
The ValueObject
macro allows you to define a typed struct with validation.
Options
require_all_fields
(:boolean) - Iftrue
, all fields will be required. Defaults totrue
Link to this section Summary
Functions
Defines a value object field.
Callbacks
Allows one to modify the fully validated command. The changes to the command are validated again after this callback.
Allows one to define any custom data validation aside from casting and requiring fields.
Link to this section Functions
Specs
Defines a value object field.
:name
- anyatom
:type
- any valid Ecto Schema type:opts
- any valid Ecto Schema field options. Plus::required
-true | false
. Defaults to therequire_all_fields
option.:description
- Documentation for the field.
Link to this section Callbacks
Specs
Allows one to modify the fully validated command. The changes to the command are validated again after this callback.
This callback is optional.
Invoked after the handle_validate/2
callback is called.
Specs
handle_validate( Ecto.Changeset.t(), keyword() ) :: Ecto.Changeset.t()
Allows one to define any custom data validation aside from casting and requiring fields.
This callback is optional.
Invoked when the new()
or new!()
function is called.