watch method
- DatabaseSession session, {
- WhereExpressionBuilder<
MethodInfoTable> ? where, - int? limit,
- int? offset,
- OrderByBuilder<
MethodInfoTable> ? orderBy, - OrderByListBuilder<
MethodInfoTable> ? orderByList, - Duration? throttle = const Duration(milliseconds: 30),
- Iterable<
Table> ? alsoTriggerOnTables,
Emits MethodInfos matching the given query parameters every time the source tables are modified.
Use where to specify which items to include in the return value.
If none is specified, all items will be returned.
To specify the order of the items use orderBy or orderByList
when sorting by multiple columns.
The maximum number of items can be set by limit. If no limit is set,
all items matching the query will be returned.
offset defines how many items to skip, after which limit (or all)
items are read from the database.
Use throttle to specify the minimum interval between queries. It can
also be set to null, in which case the stream will only be throttled
when its subscription is paused.
Source tables are collected from the queried table, where, orderBy,
orderByList, and the include graph. alsoTriggerOnTables is added
to that set. Pass Table instances such as MethodInfo.t.
Raw Expression SQL is not inspected. Tables referenced only in raw
SQL must be passed via alsoTriggerOnTables.
The stream always reads committed state and never joins an ambient Transaction. Emissions for a write fire after that write commits.
Currently only supported on SQLite. Calling this method on PostgreSQL throws an UnsupportedError.
var subscription = Persons.db.watch(
session,
where: (t) => t.lastName.equals('Jones'),
orderBy: (t) => t.firstName,
limit: 100,
).listen((persons) {
// Handle the latest matching rows.
});
Implementation
_ida.Stream<List<MethodInfo>> watch(
_is.DatabaseSession session, {
_is.WhereExpressionBuilder<MethodInfoTable>? where,
int? limit,
int? offset,
_is.OrderByBuilder<MethodInfoTable>? orderBy,
_is.OrderByListBuilder<MethodInfoTable>? orderByList,
Duration? throttle = const Duration(milliseconds: 30),
Iterable<_is.Table>? alsoTriggerOnTables,
}) {
return session.db.watch<MethodInfo>(
where: where?.call(MethodInfo.t),
orderBy: orderBy?.call(MethodInfo.t),
orderByList: orderByList?.call(MethodInfo.t),
limit: limit,
offset: offset,
throttle: throttle,
alsoTriggerOnTables: alsoTriggerOnTables,
);
}