Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

PgConn

import type { PgConn } from "https://raw.githubusercontent.com/jakajancar/pgc4d/master/src/mod.ts";
interface PgConn extends [Deno.Closer] {
readonly done: Promise<Error | undefined>;
readonly pid: number;
readonly serverParams: Map<string, string>;
addListener(channel: string, listener: NotificationListener): Promise<void>;
close(): void;
prepare(text: string): Promise<PreparedStatement>;
query(text: string, params?: ColumnValue[]): Promise<BufferedQueryResult>;
queryStreaming(text: string, params?: ColumnValue[]): Promise<StreamingQueryResult>;
reloadTypes(): Promise<void>;
removeListener(channel: string, listener: NotificationListener): Promise<void>;
}

§Extends

§
[Deno.Closer]
[src]

§Properties

§
readonly done: Promise<Error | undefined>
[src]

Resolved when connection is closed, with Error if due to a problem, or undefined if due to close() being called. Never rejects.

§
readonly pid: number
[src]

Process ID of the server process attached to the current session. Same as the number returned by pg_backend_pid() function using SQL.

§
readonly serverParams: Map<string, string>
[src]

The current setting of server parameters such as client_encoding or DateStyle.

§Methods

§
addListener(channel: string, listener: NotificationListener): Promise<void>
[src]

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.

§
close(): void
[src]

Closes immediately, killing any queries in progress. They will reject. Not an issue if called multiple times. Subsequent calls will have no effect.

§
prepare(text: string): Promise<PreparedStatement>
[src]

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.

§
query(text: string, params?: ColumnValue[]): Promise<BufferedQueryResult>
[src]

Executes a query and returns a buffered result once all the rows are received.

§
queryStreaming(text: string, params?: ColumnValue[]): Promise<StreamingQueryResult>
[src]

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.

§
reloadTypes(): Promise<void>
[src]

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.

§
removeListener(channel: string, listener: NotificationListener): Promise<void>
[src]

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.