update method

Future<int> update(
  1. DatabaseClient databaseClient,
  2. V value, {
  3. Finder? finder,
})

Update records matching a given finder.

Return the count updated. value is merged to the existing.

Implementation

Future<int> update(DatabaseClient databaseClient, V value, {Finder? finder}) {
  final client = getClient(databaseClient);
  value = client.sembastDatabase
      .sanitizeInputValue<V>(value as Value, update: true);
  return client.inTransaction((txn) async {
    return (await client.getSembastStore(this).txnUpdateWhere(
            txn, value as Value,
            finder: finder as SembastFinder?))
        .length;
  });
}