PostgreSQLPool constructor

PostgreSQLPool(
  1. PostgreSQLConnection connectionFactory(), {
  2. PostgreSQLPoolSettings settings = const PostgreSQLPoolSettings(),
})

Implementation

PostgreSQLPool(PostgreSQLConnection Function() connectionFactory,
    {this.settings = const PostgreSQLPoolSettings()})
    : _connectionFactory = connectionFactory {
  _core = PoolCore<PostgreSQLConnection>(
    limits: PoolLimits(
      maxConnectionCount: settings.maxConnectionCount,
      maxConnectionAge: settings.maxConnectionAge,
      maxSessionUse: settings.maxSessionUse,
      maxErrorCount: settings.maxErrorCount,
      maxUseCount: settings.maxUseCount,
      idleTestThreshold: settings.idleTestThreshold,
      acquireTimeout: settings.acquireTimeout,
    ),
    open: _openConnection,
    close: (c) => c.close(),
    isClosed: (c) => c.isClosed,
    test: (c) => c.execute('SELECT 1', timeoutInSeconds: 5),
    shouldDiscard: _isInTransaction,
  );
}