Skip to content

egon-orm-workspace / @egon-orm/postgres / PostgresOptions

Interface: PostgresOptions ​

Defined in: postgres/src/options.ts:46

The options of postgres. Every option may also be given as undefined, which is the same as leaving it out (connectionString: process.env.DATABASE_URL).

Connect with connectionString, or with host, port, user, password, database and ssl, or both (the separate settings win). With none of them, pg reads the usual PG* environment variables.

Example ​

ts
const options: PostgresOptions = {
  connectionString: process.env.DATABASE_URL,
  pool: { max: 10, idleTimeoutMs: 30_000, connectionTimeoutMs: 5_000 },
  applicationName: "my-app",
};

Properties ​

applicationName? ​

ts
readonly applicationName?: string;

Defined in: postgres/src/options.ts:68

Shown in pg_stat_activity (Postgres application_name).


connectionString? ​

ts
readonly connectionString?: string;

Defined in: postgres/src/options.ts:48

A postgres:// URL.


database? ​

ts
readonly database?: string;

Defined in: postgres/src/options.ts:54


host? ​

ts
readonly host?: string;

Defined in: postgres/src/options.ts:49


password? ​

ts
readonly password?: string | (() => string | Promise<string>);

Defined in: postgres/src/options.ts:53

A password, or a function that returns one (for rotating credentials).


planCacheSize? ​

ts
readonly planCacheSize?: number;

Defined in: postgres/src/options.ts:64

How many compiled query shapes the adapter keeps. Default 1,000.


pool? ​

ts
readonly pool?: PostgresPoolOptions | Pool;

Defined in: postgres/src/options.ts:62

Settings for the pool the adapter creates, or an existing pg.Pool to use as it is. A pool you pass in stays yours: the adapter does not change its settings and close() does not end it.


port? ​

ts
readonly port?: number;

Defined in: postgres/src/options.ts:50


ssl? ​

ts
readonly ssl?: boolean | ConnectionOptions;

Defined in: postgres/src/options.ts:56

true, or TLS options for node:tls.


statementTimeoutMs? ​

ts
readonly statementTimeoutMs?: number;

Defined in: postgres/src/options.ts:66

A server-side limit for every statement, in milliseconds (Postgres statement_timeout).


user? ​

ts
readonly user?: string;

Defined in: postgres/src/options.ts:51