PgConn
import type { PgConn } from "https://raw.githubusercontent.com/jakajancar/pgc4d/master/src/mod.ts";
§Properties
Resolved when connection is closed, with Error if due to a problem, or undefined if due to close() being called. Never rejects.
§Methods
Adds a listener for a channel. If this is the first listener for the channel,
issues a LISTEN
query against the database. Returned promise resolves after
the connection is confirmed to be subscribed.
Closes immediately, killing any queries in progress. They will reject. Not an issue if called multiple times. Subsequent calls will have no effect.
Creates a prepared statement on the server which you can later execute several times using different parameter values. Should offer improved performance compared to executing completely independent queries.
Executes a query and returns a streaming result as soon as the query has been accepted by the server. Rows will be retrieved as you consume them.
pgc4d loads the pg_type
table to obtain the definitions of user-defined types.
You can call reloadTypes()
after doing e.g. CREATE TYPE ... AS ENUM
to
have the type recognized without re-connecting.
Removes a listener for a channel. Listener is removed immediately and will not
receive any further events. If this is the last listener for the channel, issues
an UNLISTEN
query against the database. Returned promise resolves after
the connection is unsubscribed if the last listener is being removed, immediately
otherwise.