Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    pg-live-tablepublic

    pg-live-table: Postgres live monitoring

    A javascript library to monitor in real time Postgresql database table.

    Build Status Code Climate Coverage Status NPM version

    Dependency Status

    Install

    $ npm install --save pg-live-table

    Usage

    import PgLiveTable from 'pg-live-table';
     
    let dbUrl = 'postgres://username:password@localhost/database';
    let liveTable = PgLiveTable({dbUrl: dbUrl);
     
    let ee = await liveTable.monitor('mytable');
    ee.on('insert', (payload) => {
      console.log(`GOT insert: data: ${payload.data}`);
    })
    .on('update', (payload) => {
      let {old_data, new_data} = payload;
      console.log(`GOT update: old: ${old_data}, new: ${new_data}`);
    })
    .on('delete', (payload) => {
      console.log(`GOT delete: data: ${payload.data}`);
    });
     
    await liveTable.listen();
     
    //When done, don't forget to call liveTable.close()
     

    Test

    Make sure Postgres is running locally before running the test

    $ npm test
    

    License

    MIT © Frederic Heem

    install

    npm i pg-live-table

    Downloadsweekly downloads

    0

    version

    1.2.2

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar