MCPcopy Create free account
hub / github.com/cmoog/vscode-sql-notebook / createPostgresPool

Function createPostgresPool

src/driver.ts:225–257  ·  view source on GitHub ↗
({
  host,
  port,
  user,
  password,
  database,
  queryTimeout,
}: PostgresConfig)

Source from the content-addressed store, hash-verified

223const identity = <T>(input: T) => input;
224
225async function createPostgresPool({
226 host,
227 port,
228 user,
229 password,
230 database,
231 queryTimeout,
232}: PostgresConfig): Promise<Pool> {
233 const pool = new pg.Pool({
234 host,
235 port,
236 password,
237 database,
238 user,
239 query_timeout: queryTimeout,
240 types: {
241 getTypeParser(id, format) {
242 switch (id) {
243 case pg.types.builtins.TIMESTAMP:
244 case pg.types.builtins.TIMESTAMPTZ:
245 case pg.types.builtins.TIME:
246 case pg.types.builtins.TIMETZ:
247 case pg.types.builtins.DATE:
248 case pg.types.builtins.INTERVAL:
249 return identity;
250 default:
251 return pg.types.getTypeParser(id, format);
252 }
253 },
254 },
255 });
256 return postgresPool(pool);
257}
258
259function postgresPool(pool: pg.Pool): Pool {
260 return {

Callers 1

getPoolFunction · 0.85

Calls 1

postgresPoolFunction · 0.85

Tested by

no test coverage detected