update<T extends Table, D> method

void update<T extends Table, D>(
  1. TableInfo<T, D> table,
  2. Insertable<D> row,
  3. {Expression<bool> where(
    1. T table
    )?}
)

Writes all present columns from the row into all rows in the table that match the where clause.

For more details on how updates work in drift, check out UpdateStatement.write or the documentation with examples

Implementation

void update<T extends Table, D>(TableInfo<T, D> table, Insertable<D> row,
    {Expression<bool> Function(T table)? where}) {
  _addUpdate(table, UpdateKind.update);
  final stmt = UpdateStatement(_user, table);
  if (where != null) stmt.where(where);

  stmt.write(row, dontExecute: true);
  final context = stmt.constructQuery();
  _addContext(context);
}