pg-rx-listen API
    Preparing search index...

    Interface IPoolClient<M>

    Minimum connection-client interface required by this library, and compatible with the Client interface from node-postgres.

    interface IPoolClient<M = any> {
        on(event: "error", listener: (err: any) => void): any;
        on(event: "notification", listener: (msg: M) => void): any;
        query(sql: string, values?: any[]): Promise<any>;
        release(err?: any): void;
    }

    Type Parameters

    • M = any

    Hierarchy

    • EventEmitter
      • IPoolClient
    Index

    Methods

    Methods

    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Parameters

      • event: "error"
      • listener: (err: any) => void

        The callback function

      Returns any

      v0.1.101

    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Parameters

      • event: "notification"
      • listener: (msg: M) => void

        The callback function

      Returns any

      v0.1.101

    • Parameters

      • sql: string
      • Optionalvalues: any[]

      Returns Promise<any>

    • Parameters

      • Optionalerr: any

      Returns void