postgres function
Database<Postgres>
postgres(
- PostgresOptions options, {
- void onQuery()?,
- void onAcquire()?,
- void onDecode()?,
Creates a typed database that owns a lazily connected PostgreSQL pool.
Returns synchronously after validating options. A successful return does
not prove the server is reachable: authentication, TLS and network failures
are reported when an operation first acquires a connection. Execute an
explicit query if application startup must verify connectivity.
onAcquire includes pool lease acquisition; onQuery and onDecode observe
runtime SQL and result decoding. Await Database.close to close the owned
pool. Creating the database does not generate or apply a schema.
Implementation
Database<Postgres> postgres(
PostgresOptions options, {
void Function(QueryEvent)? onQuery,
void Function(AcquisitionEvent)? onAcquire,
void Function(DecodeEvent)? onDecode,
}) => Database(
PostgresDriver(options),
onQuery: onQuery,
onAcquire: onAcquire,
onDecode: onDecode,
);