zongji2

0.4.7 • Public • Published

Base on zongji, wrap for result

Installation

  • Requires Node.js v4+

    $ npm install zongji2

Quick Start

const Listener = require('zongji2');
 
const binlog = new Listener({
  host: 'localhost',    // MySQL Connection Settings 
  user: 'user',
  password: 'password',
});
 
binlog.on(result => {
  console.log(result);    
  // get result and then do anything you want
});
 
binlog.start({
  serverId: 1,
  startAtEnd: true,
  includeEvents: ['rotate', 'tablemap', 'writerows', 'updaterows', 'deleterows'],  
  includeSchema: {
    'database': ['table_1', 'table_2'],  
  }
});

the result like below:

You can retry through binlogName and binlogNextPos if something error.

{
  binlogName: 'mysql-bin.000004',  
  binlogNextPos: 5670,
  action: 'WriteRows',
  database: 'database',
  table: 'table_1',
  rows:[ 
    { id: 1, username: 'name', sex: 'm' } 
  ]
}

For a complete implementation see zongji ...

Readme

Keywords

Package Sidebar

Install

npm i zongji2

Weekly Downloads

1

Version

0.4.7

License

MIT

Unpacked Size

76.3 kB

Total Files

21

Last publish

Collaborators

  • rifewang