MCPcopy Create free account
hub / github.com/dwyl/learn-postgresql / connect

Function connect

server/db.js:21–32  ·  view source on GitHub ↗

* connnect ensures that a postgres connection is available before continuing * @param {function} callback - function called once connection is confirmed.

(callback)

Source from the content-addressed store, hash-verified

19 * @param {function} callback - function called once connection is confirmed.
20 */
21function connect (callback) {
22 // console.log('L45: PG_CLIENT._connecting:', PG_CLIENT._connecting,
23 // '| PG_CLIENT._connected:', PG_CLIENT._connected);
24 if (PG_CLIENT && !PG_CLIENT._connected && !PG_CLIENT._connecting) {
25 PG_CLIENT.connect(function (error, data) {
26 utils.log_error(error, data, new Error().stack);
27 return utils.exec_cb(callback, error, PG_CLIENT);
28 });
29 } else {
30 return utils.exec_cb(callback, null, PG_CLIENT);
31 }
32}
33
34/**
35 * end used in testing to end/close the Postgres connection:

Callers 9

db.jsFile · 0.85
insert_personFunction · 0.85
select_personFunction · 0.85
insert_orgFunction · 0.85
select_orgFunction · 0.85
insert_repoFunction · 0.85
select_repoFunction · 0.85
insert_log_itemFunction · 0.85
select_next_pageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected