Skip to content

DbPoolPg

do- edited this page Jan 7, 2023 · 15 revisions

DbPoolPg is a doix ResourcePool of connections to a PostgreSQL database.

It is a thin wrapper over the native driver's connection pool.

Constructor

The class is designed to provide some Application's initialization parameters:

const {Application} = require ('doix')
const {DbPoolPg} = require ('doix-db-postgresql')

const app = new Application ({
  pools: {
    db: new DbPoolPg ({
      db: {host: '127.0.0.1', port: 5432},
//    logger: ConsoleLogger.DEFAULT,
//    eventLoggerClass: require ('MySpecialDbLogger'),
    })
  }
})

Options

Name Description
db options forwarded to the native constructor
logger A winston like Logger object. Unless mentioned, all output goes to containing Job's loggers.
eventLoggerClass An EventLogger descendant class to create for each new client instance. By default, DbEventLoggerPg is used.
Clone this wiki locally