TableQuery<R> class
final
Immutable query scope used by statically generated field-specific facades.
SQL field names resolve only within this physical table. Mutation return
shapes are decoded from RETURNING; no preparatory SELECT is performed.
PostgreSQL reads, updates and deletes use ONLY to exclude inherited rows.
SQLite column identities fold ASCII case; PostgreSQL quoted names retain it.
PostgreSQL identifiers must fit within 63 UTF-8 bytes. SQLite's sqlite_
table prefix and the migration history table are reserved.
Constructors
-
TableQuery(Session session, TableDefinition definition, RowDecoder<
R> decode)
Properties
-
decode
→ RowDecoder<
R> -
final
- definition → TableDefinition
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → Session
-
final
Methods
-
all(
) → Future< List< R> > - Reads complete rows in this immutable query scope.
-
count(
) → Future< int> - Counts matching rows in this scope, including limit and offset.
-
decrementById(
Object id, Map< String, num> values) → Future<R?> - Subtracts positive amounts with the same guards as incrementById.
-
deleteById(
Object id) → Future< int> - Deletes within the key and filters and returns the affected row count.
-
get(
Object id) → Future< R?> - Reads one key within the filters, or null. Rejects paging and sorting.
-
incrementById(
Object id, Map< String, num> values) → Future<R?> - Adds positive amounts atomically and returns the row, or null if the key, filters or signed 64-bit integer bounds do not match. SQLite also guards finite REAL bounds; PostgreSQL reports real overflow as a SQL error.
-
insert(
Map< String, Object?> values) → Future<R> - Inserts one row and returns the engine's RETURNING result. Requires an unfiltered scope and RETURNING capability. Omitted database defaults remain omitted; invalid fields and values fail before SQL.
-
insertIfAbsent(
Map< String, Object?> values, {required String conflictField}) → Future<R?> - Inserts a row, or returns null when its supplied unique key already exists. Other constraint failures propagate. The conflict field must be an insertable single-column primary/unique key with a provided non-null value. This operation never changes an existing row or executes a prior SELECT.
-
limit(
int count) → TableQuery< R> -
Limits reads to
countrows. Negative values throw before SQL. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offset(
int count) → TableQuery< R> -
Skips
countrows. Choose explicit ordering for stable pagination. -
orderByFields(
Map< String, Direction> fields) → TableQuery<R> - Use one field per call; chained calls preserve explicit sort precedence.
-
selectRows<
T> (List< String> fields, RowDecoder<T> decoder) → Future<List< T> > - Reads only the requested Dart fields and returns an immutable list. Field validation precedes execution; decoder failures propagate.
-
stream(
{int fetchSize = 500}) → Stream< R> - Bounded keyset batches within an explicit transaction. Non-primary-key ordering and offsets are rejected; the cursor never buffers all results.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateById(
Object id, Map< String, Object?> values) → Future<R?> - Updates supplied fields within the key and filters, returning the changed row or null. Omitted fields remain untouched; nullable null clears a field.
-
whereAnyFields(
Map< String, Filter< fields) → TableQuery<Object?> >R> - Adds field predicates joined by OR, combined with existing groups by AND. Empty or unknown fields throw before SQL. Values retain the same parameter binding, type checks and SQL null semantics as whereFields.
-
whereFields(
Map< String, Filter< fields) → TableQuery<Object?> >R> - Adds field predicates joined by AND, combined with existing groups by AND. Empty or unknown fields throw before SQL. Generated facades expose typed named field arguments.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited