PostgresAdapter class
PostgreSQL database adapter.
Example usage:
final connection = await pg.Connection.open(
pg.Endpoint(
host: 'localhost',
database: 'mydb',
username: 'user',
password: 'password',
),
);
final adapter = PostgresAdapter(connection);
final prisma = PrismaClient(adapter: adapter);
- Implemented types
Constructors
-
PostgresAdapter(Connection connection, {ConnectionInfo? connectionInfo, Future<
Connection> connectionFactory()?}) - PostgresAdapter.pooled(Pool pool, {ConnectionInfo? connectionInfo})
-
Pooled adapter (#70). Non-transactional queries run on connections
borrowed from
pool; each transaction pins a dedicated pool connection for its lifetime. Construct the pool withpg.Pool.withEndpoints(...)orpg.Pool.withUrl(...).
Properties
- adapterName → String
-
Adapter package name (e.g., '@prisma/adapter-pg')
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPooled → bool
-
Whether this adapter is pool-backed.
no setter
- provider → String
-
Database provider name (e.g., 'postgresql', 'mysql', 'sqlite')
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → Future< void> -
Close the connection and clean up resources
override
-
executeRaw(
SqlQuery query) → Future< int> -
Execute a raw SQL command and return affected row count
override
-
executeScript(
String script) → Future< void> -
Execute a SQL script (multiple statements)
override
-
getConnectionInfo(
) → ConnectionInfo? -
Get connection information (schema, capabilities, etc.)
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queryRaw(
SqlQuery query) → Future< SqlResultSet> -
Execute a raw SQL query and return results
override
-
startTransaction(
[IsolationLevel? isolationLevel]) → Future< Transaction> -
Start a new database transaction
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parsePgBinaryArray(
List< int> bytes) → List<String?> ? - Parse the PostgreSQL binary ARRAY wire format (one-dimensional) into a List of UTF-8 element strings (enum labels, text, …).
-
parsePgTextArray(
String text) → List< String?> - Parse a PostgreSQL text-format array literal ({A,B,"c d",NULL}) into a List of element strings.