A Node.js library that wraps MySQL operations into an object-oriented interface to avoid writing raw SQL in application code. Current stable version is 1.1.0 (as of the last release). Provides batch insert, batch update, query chaining, and optional Redis caching. Key differentiators: simple API, no SQL required for common operations, and built-in Redis cache support. Compared to knex or sequelize, it is much lighter and more minimal, but lacks TypeScript types, transactions, migrations, and advanced query building. The project has low maintenance activity and a small community.
npm install mysql-simple-wrapNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates connection setup, table selection, basic CRUD (select, batch insert, update), and chained query builder with conditions.
Always pass an array to insert for batch operations. For single insert, you can pass an object (it will work), but be aware that insertId may not correspond to the actual row if multiple rows are inserted inadvertently.
Always provide a where object. To update all rows, pass an empty object {} (but be cautious).Wrap callback-style calls in a Promise manually if you need async/await. For example: const queryAsync = (sql) => new Promise((resolve, reject) => c.query(sql, (err, rows) => err ? reject(err) : resolve(rows)));
Ensure you either pass a valid redis client and set cache_on: true, or omit both settings entirely.
Run: npm install mysql
Use `const { Conn } = require('mysql-simple-wrap');` instead of `const Conn = require('mysql-simple-wrap');`Run `npm install mysql` in your project.
Ensure `teacher` is a Table instance obtained via `c.table('tablename')`. The .select() method is only available on Table instances.