DoUpdate<T extends Table, D>.withExcluded constructor

DoUpdate<T extends Table, D>.withExcluded(
  1. Insertable<D> update(
    1. T old,
    2. T excluded
    ), {
  2. List<Column>? target,
  3. Expression<bool?> where(
    1. T old,
    2. T excluded
    )?,
})

Creates a DO UPDATE clause.

The update function will be used to construct an Insertable used to update an old row that prevented an insert. It can refer to the values from the old row in the first parameter and to columns in the row that couldn't be inserted with the excluded parameter.

The optional where clause can be used to disable the update based on the old value. If a where clause is set and it evaluates to false, a conflict will keep the old row without applying the update.

For an example, see InsertStatement.insert.

Implementation

DoUpdate.withExcluded(Insertable<D> Function(T old, T excluded) update,
    {this.target, Expression<bool?> Function(T old, T excluded)? where})
    : _creator = update,
      _usesExcludedTable = true,
      _where = where == null
          ? null
          : ((old, excluded) => Where(where(old, excluded)));