constructor v1.0.0-rc.0 Constructor behaviour
Documentation for Constructor.
Link to this section Summary
Callbacks
Implement this callback if you have some complex, multi-field validations that don't make sense in
the constructor/2
macro. Or, if you prefer to eschew the constructor/2
macro entirely. Make a
best-effort to rescue any errors and convert them to a {:error, any}
tuple
Implement this callback if you have some complex, multi-field conversions that don't make sense in
the constructor/2
macro. Or, if you prefer to eschew the constructor/2
macro entirely
Link to this section Types
conversion()
new_opts()
new_opts() :: [{:field_name, atom()}]
new_opts() :: [{:field_name, atom()}]
validation()
Link to this section Functions
constructor(opts \\ [], list) (macro)
Link to this section Callbacks
after_construct(struct)
Implement this callback if you have some complex, multi-field validations that don't make sense in
the constructor/2
macro. Or, if you prefer to eschew the constructor/2
macro entirely. Make a
best-effort to rescue any errors and convert them to a {:error, any}
tuple.
before_construct(any)
Implement this callback if you have some complex, multi-field conversions that don't make sense in
the constructor/2
macro. Or, if you prefer to eschew the constructor/2
macro entirely.