mirror of https://github.com/AMT-Cheif/drift.git
move count to base table manager
This commit is contained in:
parent
270f8d2a49
commit
22ec0f77a6
|
@ -342,6 +342,12 @@ abstract class BaseTableManager<
|
|||
/// supports setting fields back to null.
|
||||
Future<int> update(Insertable<DT> Function(CU o) f) =>
|
||||
$state.buildUpdateStatement().write(f($state._getUpdateCompanionBuilder));
|
||||
|
||||
/// Return the count of rows matched by the built statement
|
||||
/// When counting rows, the query will only count distinct rows by default
|
||||
Future<int> count([bool distinct = true]) {
|
||||
return $state.copyWith(distinct: true).count();
|
||||
}
|
||||
}
|
||||
|
||||
/// A table manager that can be used to select rows from a table
|
||||
|
@ -362,12 +368,6 @@ abstract class ProcessedTableManager<
|
|||
/// Create a new [ProcessedTableManager] instance
|
||||
const ProcessedTableManager(super.$state);
|
||||
|
||||
/// Return the count of rows matched by the built statement
|
||||
/// When counting rows, the query will only count distinct rows by default
|
||||
Future<int> count([bool distinct = true]) {
|
||||
return $state.copyWith(distinct: true).count();
|
||||
}
|
||||
|
||||
/// Checks whether any rows exist
|
||||
Future<bool> exists() => $state.exists();
|
||||
|
||||
|
|
Loading…
Reference in New Issue