BaseTableManager<$Database extends GeneratedDatabase, $Table extends Table, $Dataclass, $FilterComposer extends Composer<$Database, $Table> , $OrderingComposer extends Composer<$Database, $Table> , $ComputedFieldComposer extends Composer<$Database, $Table> , $CreateCompanionCallback extends Function, $UpdateCompanionCallback extends Function, $DataclassWithReferences, $ActiveDataclass, $CreatePrefetchHooksCallback extends Function> class
abstract
Base class for all table managers Most of this classes functionality is kept in a separate TableManagerState class This is so that the state can be passed down to lower level managers
- Inheritance
-
- Object
- Selectable<
$ActiveDataclass> - BaseTableManager
- Implementers
- Annotations
-
- @immutable
Constructors
-
BaseTableManager(TableManagerState<
$Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $ActiveDataclass, $CreatePrefetchHooksCallback> $state) - Create a new BaseTableManager instance
Properties
-
$state
→ TableManagerState<
$Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $ActiveDataclass, $CreatePrefetchHooksCallback> -
The state for this manager
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
asyncMap<
N> (FutureOr< N> mapper($ActiveDataclass)) → Selectable<N> -
Maps this selectable by the
mapper
function.inherited -
count(
{bool distinct = true}) → Future< int> - Return the count of rows matched by the built statement When counting rows, the query will only count distinct rows by default
-
delete(
) → Future< int> - Deletes all rows matched by built statement
-
exists(
) → Future< bool> - Checks whether any rows exist
-
filter(
Expression< bool> f($FilterComposer f)) → ProcessedTableManager<$Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $ActiveDataclass, $CreatePrefetchHooksCallback> - Add a filter to the statement
-
get(
{bool distinct = false, int? limit, int? offset}) → Future< List< $ActiveDataclass> > -
Executes the statement and returns all rows as a list.
override
-
getSingle(
{bool distinct = true}) → Future< $ActiveDataclass> -
Executes this statement, like get, but only returns one
value. If the query returns no or too many rows, the returned future will
complete with an error.
override
-
getSingleOrNull(
{bool distinct = true}) → Future< $ActiveDataclass?> -
Executes this statement, like get, but only returns one
value. If the result too many values, this method will throw. If no
row is returned,
null
will be returned instead.override -
limit(
int limit, {int? offset}) → ProcessedTableManager< $Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $ActiveDataclass, $CreatePrefetchHooksCallback> - Add a limit to the statement
-
map<
N> (N mapper($ActiveDataclass)) → Selectable< N> -
Maps this selectable by the
mapper
function.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orderBy(
ComposableOrdering o($OrderingComposer o)) → ProcessedTableManager< $Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $ActiveDataclass, $CreatePrefetchHooksCallback> - Add ordering to the statement
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Insertable< $Dataclass> f($UpdateCompanionCallback o)) → Future<int> -
Writes all non-null fields from the entity into the columns of all rows
that match the filter clause. Warning: That also means that, when you're
not setting a where clause explicitly, this method will update all rows in
the
$state.table
. -
watch(
{bool distinct = false, int? limit, int? offset}) → Stream< List< $ActiveDataclass> > -
Creates an auto-updating stream of the result that emits new items
whenever any table used in this statement changes.
override
-
watchSingle(
{bool distinct = true}) → Stream< $ActiveDataclass> -
Creates an auto-updating stream of this statement, similar to
watch. However, it is assumed that the query will only emit
one result, so instead of returning a
Stream<List<D>>
, this returns aStream<D>
. If, at any point, the query emits no or more than one rows, an error will be added to the stream instead.override -
watchSingleOrNull(
{bool distinct = true}) → Stream< $ActiveDataclass?> -
Creates an auto-updating stream of this statement, similar to
watch. However, it is assumed that the query will only
emit one result, so instead of returning a
Stream<List<D>>
, this returns aStream<D?>
. If the query emits more than one row at some point, an error will be emitted to the stream instead. If the query emits zero rows at some point,null
will be added to the stream instead.override -
withFields(
Iterable< BaseComputedField< computedFields) → ProcessedTableManager<Object, $Table> >$Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $DataclassWithReferences, $CreatePrefetchHooksCallback> - Add computed fields to the statement which will be used to add additional columns to the query These columns will be returned in the result set and can be used in filters/orderings
-
withReferences(
[PrefetchHooks prefetch($CreatePrefetchHooksCallback prefetch)?]) → ProcessedTableManager< $Database, $Table, $Dataclass, $FilterComposer, $OrderingComposer, $ComputedFieldComposer, $CreateCompanionCallback, $UpdateCompanionCallback, $DataclassWithReferences, $DataclassWithReferences, $CreatePrefetchHooksCallback> - This function with return a new manager which will return each item in the database with its references
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited