import { connectPg } from "https://deno.land/x/pgc4d@v1.3.6/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
Parameters
optional
options: ConnectPgOptionsParameters
options: ConnectPgOptions