A MySQL query builder and database helper for Node.js, providing DatabaseManagement for connection pooling, SQLBuilder for constructing SELECT/INSERT/UPDATE/DELETE queries, and TableModel for CRUD operations. Version 1.0.8 is stable with TypeScript types included. Unlike raw mysql2, it offers higher-level abstractions like soft delete, central fields management, and multi-database support. Active development is infrequent; last release 2023.
npm install node-mysql-query-utilsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows connecting to MySQL using DatabaseManagement, creating a TableModel for CRUD, and manually building a SELECT query with SQLBuilder.
Update to version 1.0.0 or later and pass config object as { host, user, password, database }.Call connectSingleDatabase() multiple times with different identifiers.
Always call connectSingleDatabase() or connectMultipleDatabases() at app startup before any model usage.
Ensure columns array includes the primaryKey field and spelling matches.
Replace sqlBuilder.executeQuery() with db.query(sql, params).
Add isDeletedField to centralFields object when creating the TableModel.
Use DatabaseManagement.getInstance('db').createTableModel({...}) instead of new TableModel(...).Use: import { DatabaseManagement } from 'node-mysql-query-utils'Ensure connectSingleDatabase() is called before getInstance().
Use mainDB.createTableModel({...}) instead of new TableModel({...}).Check that identifier passed to getInstance matches one used in connectSingleDatabase().
Import as: import { sqlHelper } from 'node-mysql-query-utils' (lowercase 's').