postgres function

SqlDatabase<Postgres> postgres(
  1. PostgresOptions options, {
  2. void onQuery(
    1. QueryEvent
    )?,
  3. void onAcquire(
    1. AcquisitionEvent
    )?,
})

Creates an owning SQL runtime with a lazily connected PostgreSQL pool.

The first operation acquires a connection; construction does not verify server reachability. Closing the returned runtime closes its driver and owned resources. Session and transaction callbacks borrow that runtime. Opening applies no schema. onQuery observes SQL execution; onAcquire observes connection acquisition. Model decoding observers belong to the optional ORM view.

Implementation

SqlDatabase<Postgres> postgres(
  PostgresOptions options, {
  void Function(QueryEvent)? onQuery,
  void Function(AcquisitionEvent)? onAcquire,
}) => SqlDatabase(
  PostgresDriver(options),
  onQuery: onQuery,
  onAcquire: onAcquire,
);