https://github.com/vasyas/binlog-triggers-mysql
https://github.com/vasyas/binlog-triggers-mysql
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/vasyas/binlog-triggers-mysql
- Owner: vasyas
- License: mit
- Created: 2020-09-22T18:37:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-04T09:04:22.000Z (over 1 year ago)
- Last Synced: 2025-02-16T05:18:32.674Z (4 months ago)
- Language: TypeScript
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
API for listening to MySQL binlog events.
### Overview
This library provides API for listening to binlog events. Events can be filtered by table name
and/or operation type (insert, delete etc.)### Usage example
```typescript
import {BinlogTriggers, DbConfig} from "binlog-triggers-mysql"const binlogTriggers = new BinlogTriggers()
binlogTriggers.table("test", {
insert: (rows) => {
console.log("Got new rows", rows)
countRows++
}
})binlogTriggers.start({
database: "binlog_demo",
host: "localhost",
password: "test",
user: "test",
port: 3306,
})
```### Implementation details
To parse MySQL binlog messages, it uses https://github.com/nevill/zongji .
In addition to API `binlog-triggers-mysql` also provides MySQL reconnect. It is useful on
network issues or MySQL server restarts.