{"id":42797,"library":"go-mysql-js","title":"go-mysql-js","description":"A Node.js library wrapping the Go go-mysql package to provide MySQL binlog replication and a MySQL client connector. Version 0.3.4 is the latest stable release, with irregular updates as a wrapper project. Key features include synchronous-style async connection, binlog event parsing, and table filtering via regex. Compared to mysql2 and @mysql/xdevapi, it focuses specifically on binlog streaming and is not a general-purpose MySQL driver.","status":"active","version":"0.3.4","language":"javascript","source_language":"en","source_url":"https://github.com/mcuelenaere/mysql-binlog-node","tags":["javascript","mysql","binlog","typescript"],"install":[{"cmd":"npm install go-mysql-js","lang":"bash","label":"npm"},{"cmd":"yarn add go-mysql-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add go-mysql-js","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Bundles native Go binary using node-gyp","package":"node-gyp-build","optional":false}],"imports":[{"note":"Package uses ESM default export. CJS require may not work without bundler.","wrong":"const MysqlBinlog = require('go-mysql-js')","symbol":"default","correct":"import MysqlBinlog from 'go-mysql-js'"},{"note":"TypeScript users can import the type separately for type annotations.","symbol":"MysqlBinlog (type)","correct":"import type { MysqlBinlog } from 'go-mysql-js'"},{"note":"Named export for configuration interface.","symbol":"MysqlBinlogOptions","correct":"import { MysqlBinlogOptions } from 'go-mysql-js'"}],"quickstart":{"code":"import MysqlBinlog from 'go-mysql-js';\n\nasync function main() {\n    const syncer = await MysqlBinlog.create({\n        hostname: process.env.DB_HOST ?? 'localhost',\n        port: Number(process.env.DB_PORT) || 3306,\n        username: process.env.DB_USER ?? 'root',\n        password: process.env.DB_PASS ?? '',\n        tableRegexes: ['Users'],\n        serverId: 100, // unique server ID for replication\n    });\n    syncer.on('event', (event) => {\n        console.log('got row event', event);\n    });\n    syncer.on('error', (err) => {\n        console.error('got error', err);\n    });\n    process.on('SIGINT', () => {\n        syncer.close();\n        process.exit(0);\n    });\n}\nmain().catch(err => {\n    console.error(err);\n    process.exit(1);\n});","lang":"typescript","description":"Creates a MySQL binlog syncer, listens for row events, and handles cleanup on interrupt."},"warnings":[{"fix":"Install Go (>=1.16) and ensure node-gyp dependencies (python, make, C++ compiler) are available.","message":"Native binary: requires Go installed and node-gyp build during install","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use simple table name, e.g., 'Users' instead of 'mydb.Users'.","message":"tableRegexes expects raw table names, not fully qualified db.table strings","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check latest docs; consider using 'connectionUri' option if available.","message":"Constructor options 'hostname' and 'port' may be deprecated in favor of connection URI","severity":"deprecated","affected_versions":"=0.3.4"},{"fix":"Await the result: const syncer = await MysqlBinlog.create(...)","message":"In v0.3.0, 'create' changed from synchronous to async, returning a Promise","severity":"breaking","affected_versions":">=0.3.0 <0.4.0"}],"env_vars":null,"search_vec":"'0.3.4':26 'async':45 'binlog':18,47,64,77 'client':23 'compar':55 'connect':46 'connector':24 'driver':74 'event':48 'featur':40 'filter':52 'focus':61 'general':71 'general-purpos':70 'go':2,10,12 'go-mysql':11 'go-mysql-j':1 'includ':41 'irregular':33 'javascript':75 'js':4 'key':39 'latest':29 'librari':7 'mysql':3,13,17,22,73,76 'mysql/xdevapi':59 'mysql2':57 'node.js':6 'packag':14 'pars':49 'project':38 'provid':16 'purpos':72 'regex':54 'releas':31 'replic':19 'specif':62 'stabl':30 'stream':65 'style':44 'synchron':43 'synchronous-styl':42 'tabl':51 'typescript':78 'updat':34 'version':25 'via':53 'wrap':8 'wrapper':37","created_at":"2026-06-05T16:56:42.643335+00:00","updated_at":"2026-06-05T16:56:42.643335+00:00","problems":[{"fix":"Run 'npm install go-mysql-js' and ensure no ESM/CJS mismatch in your bundler.","cause":"Package not installed or bundler misconfiguration","error":"Error: Module not found: Can't resolve 'go-mysql-js'"},{"fix":"Use import MysqlBinlog from 'go-mysql-js' (ESM default) or const { default: MysqlBinlog } = require(...) (CJS).","cause":"Using default import incorrectly (e.g., importing non-default instead of default)","error":"TypeError: MysqlBinlog.create is not a function"},{"fix":"Install Go (>=1.16) and required build tools (python, make, C++ compiler).","cause":"Missing Go installation or node-gyp build environment","error":"Error: Go binary build failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mcuelenaere/mysql-binlog-node","github":"https://github.com/mcuelenaere/mysql-binlog-node","docs":null,"changelog":null,"pypi":null,"npm":"go-mysql-js","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}