A MySQL wrapper for co or Koa that adapts the mysql library to work with generators and promises. Version 1.0.0 is the final release; the package is in maintenance mode with no active development. It wraps a mysql connection pool (or connection) to return promise-based query results, enabling use with co or async/await. Compared to directly using thunkify or promisify on mysql, co-mysql provides a simpler wrapper, but the author now recommends using thunkify or promisify directly. It has a small user base and is only relevant for legacy projects using co or Koa v1 generators.
npm install co-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Wraps a mysql pool and executes a query using co generator, demonstrating promise-based query result.
Replace with thunkify(mysql.pool) or promisify(mysql.pool) from appropriate libraries.
Use async/await with a promisified mysql library instead of generators.
Always create a pool or connection first, then pass it to the wrapper.
Use CommonJS require: `const wrapper = require('co-mysql');`Switch to using thunkify or promisify from libraries like `thunkify` or `util.promisify` on the mysql pool.
Wrap the pool with `const p = wrapper(pool);` and then yield `p.query(...)`.