connectPg
import { connectPg } from "https://raw.githubusercontent.com/jakajancar/pgc4d/master/src/mod.ts";
Opens a new connection to a PostgreSQL server and resolves to the connection
(PgConn
) once authenticated and ready to accept queries.
Usage:
const db1 = await connectPg('postgres://username:password@hostname/database', { ... more opts ... });
const db2 = await connectPg({ hostname, username, password, database });
const db3 = await connectPg({ transport: 'unix', path: '/foo/bar.sock', username });
Requirements:
- tcp with ssl (default) requires
--allow-net
and--unstable
- tcp without ssl requires
--allow-net
- unix requires
--allow-read
and--unstable
§
Opens a new connection to a PostgreSQL server and resolves to the connection
(PgConn
) once authenticated and ready to accept queries.
Usage:
const db1 = await connectPg('postgres://username:password@hostname/database', { ... more opts ... });
const db2 = await connectPg({ hostname, username, password, database });
const db3 = await connectPg({ transport: 'unix', path: '/foo/bar.sock', username });
Requirements:
- tcp with ssl (default) requires
--allow-net
and--unstable
- tcp without ssl requires
--allow-net
- unix requires
--allow-read
and--unstable
§
connectPg(options: ConnectPgOptions): Promise<PgConn>
[src]§Parameters
§
options: ConnectPgOptions
[src]