Objection Model
The query context object.
The new model instance created on insert/update/patch. Keep in mind that, if the operation is a patch, the instance data might not be complete.
The old model instance (with the values prior to the update/patch operation). It is undefined
when the operation is an insert (as there is no previous instance), and inexistent/not passed when IOptions.old
is set to false
.
The type of operation the hook was executed for.
See obau()
.
A function definition of uniqueness.
false
, and fail when true
.Objection Model
New model instance being tested for uniqueness
Old instance, if the operation is an update/patch and it's available
Current operation
Generated using TypeDoc
Each of the
before
hooks to be run. SeeIOptions
.Should throw an error for failed checks. For consistency, it would be recommended that you use the built-in
ValidationError
viaModel.createValidationError()
to throw it. You can optionally also mutate the theinstance
object before it is persisted.