Validate.present constructor

const Validate.present(
  1. {bool onUpdate = true,
  2. bool onInsert = true}
)

A validator for ensuring a property always has a value when being inserted or updated.

This metadata requires that a property must be set in Query.values before an update or insert. The value may be null, if the property's Column.isNullable allow it.

If onUpdate is true (the default), this validation requires a property to be present for update queries. If onInsert is true (the default), this validation requires a property to be present for insert queries.

Implementation

const Validate.present({bool onUpdate = true, bool onInsert = true})
    : this._(
          onUpdate: onUpdate,
          onInsert: onInsert,
          validator: ValidateType.present);