@types/pg

  • Version 8.6.5
  • Published
  • 12.9 kB
  • 3 dependencies
  • MIT license

Install

npm i @types/pg
yarn add @types/pg
pnpm add @types/pg

Overview

TypeScript definitions for pg

Index

Variables

variable defaults

const defaults: Defaults & ClientConfig;

    variable native

    const native: typeof Pg;

      variable types

      const types: any;

        Classes

        class Client

        class Client extends ClientBase {}

          constructor

          constructor(config?: string | ClientConfig);

            property database

            database?: string;

              property host

              host: string;

                property password

                password?: string;

                  property port

                  port: number;

                    property ssl

                    ssl: boolean;

                      property user

                      user?: string;

                        method end

                        end: { (): Promise<void>; (callback: (err: Error) => void): void };

                          class ClientBase

                          class ClientBase extends events.EventEmitter {}

                            constructor

                            constructor(config?: string | ClientConfig);

                              method connect

                              connect: { (): Promise<void>; (callback: (err: Error) => void): void };

                                method copyFrom

                                copyFrom: (queryText: string) => stream.Writable;

                                  method copyTo

                                  copyTo: (queryText: string) => stream.Readable;

                                    method escapeIdentifier

                                    escapeIdentifier: (str: string) => string;

                                      method escapeLiteral

                                      escapeLiteral: (str: string) => string;

                                        method on

                                        on: {
                                        (event: 'drain', listener: () => void): this;
                                        (event: 'error', listener: (err: Error) => void): this;
                                        (event: 'notice', listener: (notice: NoticeMessage) => void): this;
                                        (event: 'notification', listener: (message: Notification) => void): this;
                                        (event: 'end', listener: () => void): this;
                                        };

                                          method pauseDrain

                                          pauseDrain: () => void;

                                            method query

                                            query: {
                                            <T extends Submittable>(queryStream: T): T;
                                            <R extends any[] = any[], I extends any[] = any[]>(
                                            queryConfig: QueryArrayConfig<I>,
                                            values?: I
                                            ): Promise<QueryArrayResult<R>>;
                                            <R extends QueryResultRow = any, I extends any[] = any[]>(
                                            queryConfig: QueryConfig<I>
                                            ): Promise<QueryResult<R>>;
                                            <R extends QueryResultRow = any, I extends any[] = any[]>(
                                            queryTextOrConfig: string | QueryConfig<I>,
                                            values?: I
                                            ): Promise<QueryResult<R>>;
                                            <R extends any[] = any[], I extends any[] = any[]>(
                                            queryConfig: QueryArrayConfig<I>,
                                            callback: (err: Error, result: QueryArrayResult<R>) => void
                                            ): void;
                                            <R extends QueryResultRow = any, I extends any[] = any[]>(
                                            queryTextOrConfig: string | QueryConfig<I>,
                                            callback: (err: Error, result: QueryResult<R>) => void
                                            ): void;
                                            <R extends QueryResultRow = any, I extends any[] = any[]>(
                                            queryText: string,
                                            values: any[],
                                            callback: (err: Error, result: QueryResult<R>) => void
                                            ): void;
                                            };

                                              method resumeDrain

                                              resumeDrain: () => void;

                                                class Connection

                                                class Connection extends events.EventEmitter {}

                                                  constructor

                                                  constructor(config?: ClientConfig);

                                                    property stream

                                                    readonly stream: stream.Duplex;

                                                      method bind

                                                      bind: (config: BindConfig | null, more: boolean) => void;

                                                        method close

                                                        close: (msg: MessageConfig, more: boolean) => void;

                                                          method describe

                                                          describe: (msg: MessageConfig, more: boolean) => void;

                                                            method end

                                                            end: () => void;

                                                              method execute

                                                              execute: (config: ExecuteConfig | null, more: boolean) => void;

                                                                method flush

                                                                flush: () => void;

                                                                  method parse

                                                                  parse: (query: QueryParse, more: boolean) => void;

                                                                    method query

                                                                    query: (text: string) => void;

                                                                      method sync

                                                                      sync: () => void;

                                                                        class Events

                                                                        class Events extends events.EventEmitter {}

                                                                          method on

                                                                          on: (event: 'error', listener: (err: Error, client: Client) => void) => this;

                                                                            class Pool

                                                                            class Pool extends events.EventEmitter {}

                                                                            constructor

                                                                            constructor(config?: PoolConfig);
                                                                            • Every field of the config object is entirely optional. The config passed to the pool is also passed to every client instance within the pool when the pool creates that client.

                                                                            property idleCount

                                                                            readonly idleCount: number;

                                                                              property totalCount

                                                                              readonly totalCount: number;

                                                                                property waitingCount

                                                                                readonly waitingCount: number;

                                                                                  method connect

                                                                                  connect: {
                                                                                  (): Promise<PoolClient>;
                                                                                  (
                                                                                  callback: (
                                                                                  err: Error,
                                                                                  client: PoolClient,
                                                                                  done: (release?: any) => void
                                                                                  ) => void
                                                                                  ): void;
                                                                                  };

                                                                                    method end

                                                                                    end: { (): Promise<void>; (callback: () => void): void };

                                                                                      method on

                                                                                      on: {
                                                                                      (event: 'error', listener: (err: Error, client: PoolClient) => void): this;
                                                                                      (
                                                                                      event: 'connect' | 'acquire' | 'remove',
                                                                                      listener: (client: PoolClient) => void
                                                                                      ): this;
                                                                                      };

                                                                                        method query

                                                                                        query: {
                                                                                        <T extends Submittable>(queryStream: T): T;
                                                                                        <R extends any[] = any[], I extends any[] = any[]>(
                                                                                        queryConfig: QueryArrayConfig<I>,
                                                                                        values?: I
                                                                                        ): Promise<QueryArrayResult<R>>;
                                                                                        <R extends QueryResultRow = any, I extends any[] = any[]>(
                                                                                        queryConfig: QueryConfig<I>
                                                                                        ): Promise<QueryResult<R>>;
                                                                                        <R extends QueryResultRow = any, I extends any[] = any[]>(
                                                                                        queryTextOrConfig: string | QueryConfig<I>,
                                                                                        values?: I
                                                                                        ): Promise<QueryResult<R>>;
                                                                                        <R extends any[] = any[], I extends any[] = any[]>(
                                                                                        queryConfig: QueryArrayConfig<I>,
                                                                                        callback: (err: Error, result: QueryArrayResult<R>) => void
                                                                                        ): void;
                                                                                        <R extends QueryResultRow = any, I extends any[] = any[]>(
                                                                                        queryTextOrConfig: string | QueryConfig<I>,
                                                                                        callback: (err: Error, result: QueryResult<R>) => void
                                                                                        ): void;
                                                                                        <R extends QueryResultRow = any, I extends any[] = any[]>(
                                                                                        queryText: string,
                                                                                        values: I,
                                                                                        callback: (err: Error, result: QueryResult<R>) => void
                                                                                        ): void;
                                                                                        };

                                                                                          class Query

                                                                                          class Query<R extends QueryResultRow = any, I extends any[] = any>
                                                                                          extends events.EventEmitter
                                                                                          implements Submittable {}

                                                                                            constructor

                                                                                            constructor(queryTextOrConfig?: string | QueryConfig<I>, values?: any[]);

                                                                                              property submit

                                                                                              submit: (connection: Connection) => void;

                                                                                                method on

                                                                                                on: {
                                                                                                (event: 'row', listener: (row: R, result?: ResultBuilder<R>) => void): this;
                                                                                                (event: 'error', listener: (err: Error) => void): this;
                                                                                                (event: 'end', listener: (result: ResultBuilder<R>) => void): this;
                                                                                                };

                                                                                                  Interfaces

                                                                                                  interface BindConfig

                                                                                                  interface BindConfig {}

                                                                                                    property binary

                                                                                                    binary?: string | undefined;

                                                                                                      property portal

                                                                                                      portal?: string | undefined;

                                                                                                        property statement

                                                                                                        statement?: string | undefined;

                                                                                                          property values

                                                                                                          values?: Array<Buffer | null | undefined | string> | undefined;

                                                                                                            interface ClientConfig

                                                                                                            interface ClientConfig {}

                                                                                                              property application_name

                                                                                                              application_name?: string | undefined;

                                                                                                                property connectionString

                                                                                                                connectionString?: string | undefined;

                                                                                                                  property connectionTimeoutMillis

                                                                                                                  connectionTimeoutMillis?: number | undefined;

                                                                                                                    property database

                                                                                                                    database?: string | undefined;

                                                                                                                      property host

                                                                                                                      host?: string | undefined;

                                                                                                                        property idle_in_transaction_session_timeout

                                                                                                                        idle_in_transaction_session_timeout?: number | undefined;

                                                                                                                          property keepAlive

                                                                                                                          keepAlive?: boolean | undefined;

                                                                                                                            property keepAliveInitialDelayMillis

                                                                                                                            keepAliveInitialDelayMillis?: number | undefined;

                                                                                                                              property options

                                                                                                                              options?: string | undefined;

                                                                                                                                property parseInputDatesAsUTC

                                                                                                                                parseInputDatesAsUTC?: boolean | undefined;

                                                                                                                                  property password

                                                                                                                                  password?: string | (() => string | Promise<string>) | undefined;

                                                                                                                                    property port

                                                                                                                                    port?: number | undefined;

                                                                                                                                      property query_timeout

                                                                                                                                      query_timeout?: number | undefined;

                                                                                                                                        property ssl

                                                                                                                                        ssl?: boolean | ConnectionOptions | undefined;

                                                                                                                                          property statement_timeout

                                                                                                                                          statement_timeout?: false | number | undefined;

                                                                                                                                            property stream

                                                                                                                                            stream?: stream.Duplex | undefined;

                                                                                                                                              property types

                                                                                                                                              types?: CustomTypesConfig | undefined;

                                                                                                                                                property user

                                                                                                                                                user?: string | undefined;

                                                                                                                                                  interface CustomTypesConfig

                                                                                                                                                  interface CustomTypesConfig {}

                                                                                                                                                    property getTypeParser

                                                                                                                                                    getTypeParser: typeof pgTypes.getTypeParser;

                                                                                                                                                      interface Defaults

                                                                                                                                                      interface Defaults extends ClientConfig {}

                                                                                                                                                        property binary

                                                                                                                                                        binary?: boolean | undefined;

                                                                                                                                                          property parseInt8

                                                                                                                                                          parseInt8?: boolean | undefined;

                                                                                                                                                            property poolIdleTimeout

                                                                                                                                                            poolIdleTimeout?: number | undefined;

                                                                                                                                                              property poolSize

                                                                                                                                                              poolSize?: number | undefined;

                                                                                                                                                                property reapIntervalMillis

                                                                                                                                                                reapIntervalMillis?: number | undefined;

                                                                                                                                                                  interface ExecuteConfig

                                                                                                                                                                  interface ExecuteConfig {}

                                                                                                                                                                    property portal

                                                                                                                                                                    portal?: string | undefined;

                                                                                                                                                                      property rows

                                                                                                                                                                      rows?: string | undefined;

                                                                                                                                                                        interface FieldDef

                                                                                                                                                                        interface FieldDef {}

                                                                                                                                                                          property columnID

                                                                                                                                                                          columnID: number;

                                                                                                                                                                            property dataTypeID

                                                                                                                                                                            dataTypeID: number;

                                                                                                                                                                              property dataTypeModifier

                                                                                                                                                                              dataTypeModifier: number;

                                                                                                                                                                                property dataTypeSize

                                                                                                                                                                                dataTypeSize: number;

                                                                                                                                                                                  property format

                                                                                                                                                                                  format: string;

                                                                                                                                                                                    property name

                                                                                                                                                                                    name: string;

                                                                                                                                                                                      property tableID

                                                                                                                                                                                      tableID: number;

                                                                                                                                                                                        interface MessageConfig

                                                                                                                                                                                        interface MessageConfig {}

                                                                                                                                                                                          property name

                                                                                                                                                                                          name?: string | undefined;

                                                                                                                                                                                            property type

                                                                                                                                                                                            type: string;

                                                                                                                                                                                              interface Notification

                                                                                                                                                                                              interface Notification {}

                                                                                                                                                                                                property channel

                                                                                                                                                                                                channel: string;

                                                                                                                                                                                                  property payload

                                                                                                                                                                                                  payload?: string | undefined;

                                                                                                                                                                                                    property processId

                                                                                                                                                                                                    processId: number;

                                                                                                                                                                                                      interface PoolClient

                                                                                                                                                                                                      interface PoolClient extends ClientBase {}

                                                                                                                                                                                                        method release

                                                                                                                                                                                                        release: (err?: Error | boolean) => void;

                                                                                                                                                                                                          interface PoolConfig

                                                                                                                                                                                                          interface PoolConfig extends ClientConfig {}

                                                                                                                                                                                                            property allowExitOnIdle

                                                                                                                                                                                                            allowExitOnIdle?: boolean | undefined;

                                                                                                                                                                                                              property idleTimeoutMillis

                                                                                                                                                                                                              idleTimeoutMillis?: number | undefined;

                                                                                                                                                                                                                property log

                                                                                                                                                                                                                log?: ((...messages: any[]) => void) | undefined;

                                                                                                                                                                                                                  property max

                                                                                                                                                                                                                  max?: number | undefined;

                                                                                                                                                                                                                    property maxUses

                                                                                                                                                                                                                    maxUses?: number | undefined;

                                                                                                                                                                                                                      property min

                                                                                                                                                                                                                      min?: number | undefined;

                                                                                                                                                                                                                        property Promise

                                                                                                                                                                                                                        Promise?: PromiseConstructorLike | undefined;

                                                                                                                                                                                                                          interface QueryArrayConfig

                                                                                                                                                                                                                          interface QueryArrayConfig<I extends any[] = any[]> extends QueryConfig<I> {}

                                                                                                                                                                                                                            property rowMode

                                                                                                                                                                                                                            rowMode: 'array';

                                                                                                                                                                                                                              interface QueryArrayResult

                                                                                                                                                                                                                              interface QueryArrayResult<R extends any[] = any[]> extends QueryResultBase {}

                                                                                                                                                                                                                                property rows

                                                                                                                                                                                                                                rows: R[];

                                                                                                                                                                                                                                  interface QueryConfig

                                                                                                                                                                                                                                  interface QueryConfig<I extends any[] = any[]> {}

                                                                                                                                                                                                                                    property name

                                                                                                                                                                                                                                    name?: string | undefined;

                                                                                                                                                                                                                                      property text

                                                                                                                                                                                                                                      text: string;

                                                                                                                                                                                                                                        property types

                                                                                                                                                                                                                                        types?: CustomTypesConfig | undefined;

                                                                                                                                                                                                                                          property values

                                                                                                                                                                                                                                          values?: I | undefined;

                                                                                                                                                                                                                                            interface QueryParse

                                                                                                                                                                                                                                            interface QueryParse {}

                                                                                                                                                                                                                                              property name

                                                                                                                                                                                                                                              name: string;

                                                                                                                                                                                                                                                property text

                                                                                                                                                                                                                                                text: string;

                                                                                                                                                                                                                                                  property types

                                                                                                                                                                                                                                                  types: string[];

                                                                                                                                                                                                                                                    interface QueryResult

                                                                                                                                                                                                                                                    interface QueryResult<R extends QueryResultRow = any> extends QueryResultBase {}

                                                                                                                                                                                                                                                      property rows

                                                                                                                                                                                                                                                      rows: R[];

                                                                                                                                                                                                                                                        interface QueryResultBase

                                                                                                                                                                                                                                                        interface QueryResultBase {}

                                                                                                                                                                                                                                                          property command

                                                                                                                                                                                                                                                          command: string;

                                                                                                                                                                                                                                                            property fields

                                                                                                                                                                                                                                                            fields: FieldDef[];

                                                                                                                                                                                                                                                              property oid

                                                                                                                                                                                                                                                              oid: number;

                                                                                                                                                                                                                                                                property rowCount

                                                                                                                                                                                                                                                                rowCount: number;

                                                                                                                                                                                                                                                                  interface QueryResultRow

                                                                                                                                                                                                                                                                  interface QueryResultRow {}

                                                                                                                                                                                                                                                                    index signature

                                                                                                                                                                                                                                                                    [column: string]: any;

                                                                                                                                                                                                                                                                      interface ResultBuilder

                                                                                                                                                                                                                                                                      interface ResultBuilder<R extends QueryResultRow = any> extends QueryResult<R> {}

                                                                                                                                                                                                                                                                        method addRow

                                                                                                                                                                                                                                                                        addRow: (row: R) => void;

                                                                                                                                                                                                                                                                          interface Submittable

                                                                                                                                                                                                                                                                          interface Submittable {}

                                                                                                                                                                                                                                                                            property submit

                                                                                                                                                                                                                                                                            submit: (connection: Connection) => void;

                                                                                                                                                                                                                                                                              Type Aliases

                                                                                                                                                                                                                                                                              type ConnectionConfig

                                                                                                                                                                                                                                                                              type ConnectionConfig = ClientConfig;

                                                                                                                                                                                                                                                                                Package Files (1)

                                                                                                                                                                                                                                                                                Dependencies (3)

                                                                                                                                                                                                                                                                                Dev Dependencies (0)

                                                                                                                                                                                                                                                                                No dev dependencies.

                                                                                                                                                                                                                                                                                Peer Dependencies (0)

                                                                                                                                                                                                                                                                                No peer dependencies.

                                                                                                                                                                                                                                                                                Badge

                                                                                                                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/pg.

                                                                                                                                                                                                                                                                                • Markdown
                                                                                                                                                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/pg)
                                                                                                                                                                                                                                                                                • HTML
                                                                                                                                                                                                                                                                                  <a href="https://www.jsdocs.io/package/@types/pg"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>