Skip to content

Commit

Permalink
🤖 Merge PR #66684 fix(pg): add missing default configuration option by …
Browse files Browse the repository at this point in the history
…@stuft2

* fix: add missing default configuration option

* test: add tests for each of the global defaults
  • Loading branch information
stuft2 committed Oct 9, 2023
1 parent e98bc2d commit f0cc246
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions types/pg/index.d.ts
Expand Up @@ -41,6 +41,7 @@ export interface Defaults extends ClientConfig {
reapIntervalMillis?: number | undefined;
binary?: boolean | undefined;
parseInt8?: boolean | undefined;
parseInputDatesAsUTC?: boolean | undefined;
}

export interface PoolConfig extends ClientConfig {
Expand Down
15 changes: 11 additions & 4 deletions types/pg/pg-tests.ts
@@ -1,12 +1,19 @@
import { connect } from "net";
import { Client, Connection, CustomTypesConfig, DatabaseError, Pool, QueryArrayConfig, types } from "pg";
import TypeOverrides = require("pg/lib/type-overrides");
import { NoticeMessage } from "pg-protocol/dist/messages";
import { connect } from 'net';
import { types, Client, CustomTypesConfig, QueryArrayConfig, Pool, DatabaseError, Connection, defaults } from 'pg';
import TypeOverrides = require('pg/lib/type-overrides');
import { NoticeMessage } from 'pg-protocol/dist/messages';

// https://github.com/brianc/node-pg-types
// tslint:disable-next-line no-unnecessary-callback-wrapper
types.setTypeParser(20, val => Number(val));

const poolSize: number | undefined = defaults.poolSize;
const poolIdleTimeout: number | undefined = defaults.poolIdleTimeout;
const reapIntervalMillis: number | undefined = defaults.reapIntervalMillis;
const binary: boolean | undefined = defaults.binary;
const parseInt8: boolean | undefined = defaults.parseInt8;
const parseInputDatesAsUTC: boolean | undefined = defaults.parseInputDatesAsUTC;

const client = new Client({
host: "my.database-server.com",
port: 5334,
Expand Down

0 comments on commit f0cc246

Please sign in to comment.