Mysql is a high-level wrapper around the MySQL driver that
provides:
- Query execution returning data as a
Table. - Bulk INSERT operations.
- UPDATE with custom conditions.
- UPSERT via
INSERT ... ON DUPLICATE KEY UPDATE. - Table existence checks and schema inspection via
information_schema. - Automatic conversion of JavaScript types (Date, boolean, null) into SQL expressions.
// Basic usage
const db = new Mysql({
host: "localhost",
user: "root",
password: "password",
database: "test"
});
const users = await db.query("SELECT id, name FROM users");
console.log(users.length, users.rows[0].name);