PostgresConnection class final Getting Started
Connection backed by package:postgres (v3, async). Pairs the
PostgresDialect ($N placeholders) with the dialect-agnostic
QueryBuilder; it implements the exact same interface as the SQLite backend.
Transactions delegate to the driver's native runTx, which holds the
connection's operation lock for the transaction's lifetime — parallel
transaction calls queue rather than interleaving, and the driver throws if
the raw connection is used while a transaction is active. Inside a
transaction, use the handle passed to the callback, not this connection.
Properties
- dialect → SqlDialect
-
Dialect used to serialize queries for this connection.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> -
execute(
WriteStatement statement) → Future< int> -
Runs an INSERT/UPDATE/DELETE and returns the affected-row count.
inherited
-
executeReturning<
R> (ReturningQuery< R> statement) → Future<List< R> > -
Runs an INSERT/UPDATE/DELETE ... RETURNING and maps each returned row to
R(build withstmt.returning([...]).map(...)).inherited -
executeSql(
String sql, [List< Object?> params = const []]) → Future<void> -
Escape hatch for raw SQL (DDL, migrations).
inherited
-
fetch<
R> (SelectQuery< R> statement) → Future<List< R> > -
Runs a
SELECT(single-table or joined) and maps each row toR.inherited -
introspect(
) → Future< List< IntrospectedTable> > -
Reads the database schema into a dialect-neutral model (for codegen).
Each backend maps its own catalog and native types into the canonical form.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queryRaw(
String sql, [List< Object?> params = const []]) → Future<List< Map< >String, Object?> > -
Escape hatch for raw read queries (introspection, ad-hoc SQL). Each row is
a
column-name -> valuemap.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
transaction<
T> (FutureOr< T> action(Connection tx)) → Future<T> -
Runs
actionin a transaction, committing on success and rolling back on error.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited