DbTransaction class abstract

A database transaction session.

Provides the same query methods as DartApiDB without the lifecycle methods (connect, close). Passed to the callback in DartApiDB.transaction. Implements QueryExecutor, so the fluent builder works inside transactions too: tx.query('users')....

await db.transaction((tx) async {
  await tx.insert('orders', orderData);
  await tx.insert('order_items', itemData);
});
Implemented types
Implementers
Available extensions

Constructors

DbTransaction()

Properties

hashCode int
The hash code for this object.
no setterinherited
paramStyle DbParamStyle
The SQL parameter placeholder style used by this executor.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String table, {required Map<String, dynamic> where}) Future<DbResult>
insert(String table, Map<String, dynamic> data) Future<DbResult>
insertBatch(String table, List<Map<String, dynamic>> rows) Future<DbResult>
Inserts multiple rows into table in a single batch operation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(String table) QueryBuilder

Available on QueryExecutor, provided by the DbQueryExtension extension

Returns a QueryBuilder targeting table.
rawQuery(String query, {Map<String, dynamic>? values}) Future<DbResult>
Executes a raw SQL statement with optional named values.
override
select(String table, {Map<String, dynamic>? where}) Future<DbResult>
toString() String
A string representation of this object.
inherited
update(String table, Map<String, dynamic> data, {required Map<String, dynamic> where}) Future<DbResult>

Operators

operator ==(Object other) bool
The equality operator.
inherited