pool
PostgreSQL connection pool instance for executing database queries.
Import
import { pool } from '@evershop/evershop/lib/postgres';
import { select } from '@evershop/evershop/lib/postgres/query';
const product = await select()
.from('product')
.where('product_id', '=', 123)
.load(pool);
Typed wrapper
Query builders come from @evershop/evershop/lib/postgres/query — EverShop's first-party typed wrapper around @evershop/postgres-query-builder, adding column types for every known EverShop table. The raw package is still available as an untyped lower-level fallback. The pool itself always comes from @evershop/evershop/lib/postgres.
The pool never needs releasing: the query builder's auto-release is a no-op on a Pool. Use it for reads and single statements, and reserve getConnection() for transactions.
Type
Pool
The pool is a PostgreSQL connection pool instance from the pg library.
Configuration
The pool is configured using environment variables or configuration file:
Environment Variables
DB_HOST- Database hostDB_PORT- Database portDB_USER- Database userDB_PASSWORD- Database passwordDB_NAME- Database nameDB_SSLMODE- SSL mode (disable, require, prefer, verify-ca, verify-full, no-verify)DB_SSLROOTCERT- Path to SSL root certificateDB_SSLCERT- Path to SSL certificateDB_SSLKEY- Path to SSL key
See Also
- getConnection - Get a dedicated database connection
- getConfig - Get configuration values