feat(pg): rework constructor documentation. Closes #41167 (#41174)

- remove outdated comment
- add link to the documentation
- update test with parameterless ctor

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2019-12-23 10:02:41 -06:00
committed by Andrew Branch
parent 8a0e74bb2f
commit 07fcb1bd3d
2 changed files with 14 additions and 3 deletions
+8 -3
View File
@@ -144,10 +144,15 @@ export class Connection extends events.EventEmitter {
end(): void;
}
/**
* {@link https://node-postgres.com/api/pool}
*/
export class Pool extends events.EventEmitter {
// `new Pool('pg://user@localhost/mydb')` is not allowed.
// But it passes type check because of issue:
// https://github.com/Microsoft/TypeScript/issues/7485
/**
* Every field of the config object is entirely optional.
* The config passed to the pool is also passed to every client
* instance within the pool when the pool creates that client.
*/
constructor(config?: PoolConfig);
readonly totalCount: number;
+6
View File
@@ -124,6 +124,12 @@ client.end()
.then(() => console.log('client has disconnected'))
.catch(err => console.error('error during disconnection', err.stack));
// pg.Pool
// https://node-postgres.com/api/pool
// no params ctor
const poolParameterlessCtor = new Pool();
const poolOne = new Pool({
connectionString: 'postgresql://dbuser:secretpassword@database.server.com:3211/mydb'
});