MCPcopy Create free account
hub / github.com/denodrivers/postgres / connect

Method connect

pool.ts:130–138  ·  view source on GitHub ↗

* This will return a new client from the available connections in * the pool * * In the case of lazy initialized pools, a new connection will be established * with the database if no other connections are available * * ```ts * import { Pool } from "jsr:@db/postgres"; * const

()

Source from the content-addressed store, hash-verified

128 * ```
129 */
130 async connect(): Promise<PoolClient> {
131 // Reinitialize pool if it has been terminated
132 if (this.#ended) {
133 this.#ready = this.#initialize();
134 }
135
136 await this.#ready;
137 return this.#available_connections!.pop();
138 }
139
140 /**
141 * This will close all open connections and set a terminated status in the pool

Callers 11

generatePoolClientTestFunction · 0.95
poolWrapperFunction · 0.95
#initializeMethod · 0.80
#openConnectionMethod · 0.80
generateSimpleClientTestFunction · 0.80
createProxyFunction · 0.80
connection_test.tsFile · 0.80
mockReconnectionFunction · 0.80
pool_test.tsFile · 0.80
connectThenReleaseFunction · 0.80
clientWrapperFunction · 0.80

Calls 2

#initializeMethod · 0.95
popMethod · 0.45

Tested by

no test coverage detected