replace method
Replaces the old version of entity
that is stored in the database with
the fields of the entity
provided here. This implicitly applies a
filter
clause to rows with the same primary key as entity
, so that only
the row representing outdated data will be replaced.
If entity
has absent values (set to null on the DataClass
or
explicitly to absent on the UpdateCompanion
), and a default value for
the field exists, that default value will be used. Otherwise, the field
will be reset to null. This behavior is different to update
, which simply
ignores such fields without changing them in the database.
Returns true if a row was affected by this operation.
Implementation
Future<bool> replace(Insertable<$Dataclass> entity) {
return $state.db.update($state._tableAsTableInfo).replace(entity);
}