postgres library Open a database

Postgres connections for SQL execution and optional typed model views.

postgres opens an owning SQL runtime. Import package:orm/sql.dart for SQL operations, and package:orm/orm.dart to add a model view of that runtime. PostgresDriver remains available for explicit driver ownership and leasing.

Classes

Postgres
Type marker for PostgreSQL drivers and sessions.
PostgresDriver
Owns or borrows a PostgreSQL pool and leases one connection per callback.
PostgresOptions
Configuration for an owned PostgreSQL connection pool.

Enums

PostgresTls
Transport encryption and server identity checks for PostgreSQL connections.

Functions

postgres(PostgresOptions options, {void onQuery(QueryEvent)?, void onAcquire(AcquisitionEvent)?}) → SqlDatabase<Postgres>
Creates an owning SQL runtime with a lazily connected PostgreSQL pool.
postgresTypeRegistry() → TypeRegistry
Native calendar values and UTC instants, without integer overflow. Local calendar types cover PostgreSQL's full finite range; UTC instants additionally respect Dart DateTime's range. Pass this registry to PoolSettings before borrowing a pool with PostgresDriver.borrow(temporal: true).

Exceptions / Errors

PostgresFailure
A server-reported error, preserving SQLSTATE and the original exception.