Class PoolClient

The RxJS wrapper for pg.PoolClient.

Note

A PoolClient is created automatically when connect is called from within Pool. This class is nearly identical to Client, except Client, except a standalone client is disconnected with end(), whereas a PoolClient is released with release().

Public Api

Hierarchy (view full)

Constructors

Properties

_clientNative: Client | PoolClient

Accessors

  • get onDrain(): Subject<void>
  • A Subject that emits drain events.

    Returns Subject<void>

  • get onEnd(): Subject<void>
  • A Subject that emits end events.

    Returns Subject<void>

  • get onError(): Subject<Error>
  • A Subject that emits error events.

    Returns Subject<Error>

  • get onNotice(): Subject<NoticeMessage>
  • A Subject that emits notice events.

    Returns Subject<NoticeMessage>

  • get onNotification(): Subject<Notification>
  • A Subject that emits notification events.

    Returns Subject<Notification>

Methods

  • Queries a database, returning query results after all results have been returned.

    Type Parameters

    • T extends QueryResultRow = any
    • I = any[]

    Parameters

    • config: QueryConfig<I> & {
          returnsCursors?: false;
          stream?: false;
      }

      Defines query parameters

    Returns Observable<QueryResult<T>>

  • Queries a database, streaming query results as they are read.

    Type Parameters

    • T = any
    • I = any[]

    Parameters

    Returns Observable<T>

  • Queries a database, returning query results by cursor after cursor has read all rows.

    Type Parameters

    • I = any[]

    Parameters

    • config: QueryConfig<I> & {
          returnsCursors: true;
          stream?: false;
      }

      Defines query parameters

    Returns Observable<QueryCursorResult>

  • Queries a database, streaming query results as cursor reads rows.

    Type Parameters

    • I = any[]

    Parameters

    Returns Observable<QueryCursorRow>

  • Completes after one drain event has been observed.

    Parameters

    • eventName: "drain"

    Returns Observable<void>

  • Completes after one end event has been observed.

    Parameters

    • eventName: "end"

    Returns Observable<void>

  • Completes after one error has been observed.

    Parameters

    • eventName: "error"

    Returns Observable<Error>

  • Completes after one NoticeMessage has been observed.

    Parameters

    • eventName: "notice"

    Returns Observable<NoticeMessage>

  • Completes after one Notification has been observed.

    Parameters

    • eventName: "notification"

    Returns Observable<Notification>

  • Unsubscribes from an event subject or all event subjects.

    Parameters

    • Optional eventName: "error" | "end" | "drain" | "notice" | "notification"

      A Client event name

    Returns this

  • Releases a connection opened in connect() and forwards the result of a successful query.

    Type Parameters

    • T

    Parameters

    • result: T

      The result of a successful query, useful for RxJS maps.

    Returns Observable<T>

  • Releases a connection opened in connect().

    Returns Observable<PoolClient>