{"id":43284,"library":"mysql-helper-es6","title":"mysql-helper-es6","description":"A lightweight MySQL helper library using async/await syntax (ES2017) for Node.js. Version 0.2.1 provides a singleton-based wrapper around the mysql package with methods for select, selectOne, insertInto, batchInsertInto, replaceInto, update, and delete. It supports simple and range WHERE conditions. Designed for Node.js v8+, it is a minimal alternative to more full-featured ORMs like Sequelize or TypeORM. No TypeScript types included; for TS support, see ts-mysql-helper.","status":"maintenance","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/bruce48x/mysql-helper-es6","tags":["javascript","mysql","async"],"install":[{"cmd":"npm install mysql-helper-es6","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-helper-es6","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-helper-es6","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for MySQL database connections and queries.","package":"mysql","optional":false}],"imports":[{"note":"Package does not provide ES module exports; use CommonJS require().","wrong":"import MysqlHelper from 'mysql-helper-es6'","symbol":"default","correct":"const MysqlHelper = require('mysql-helper-es6')"},{"note":"getInstance is a static factory method returning a singleton instance. Do not use 'new'.","wrong":"new MysqlHelper(config)","symbol":"getInstance","correct":"MysqlHelper.getInstance(config)"},{"note":"Methods return Promises, so both async/await and .then() work; no callback style.","wrong":"helper.select(table, fields, where, limit).then(...)","symbol":"select","correct":"await helper.select(table, fields, where, limit)"}],"quickstart":{"code":"const MysqlHelper = require('mysql-helper-es6');\nconst config = {\n  host: 'localhost',\n  port: 3306,\n  database: 'mydb',\n  user: 'root',\n  password: process.env.DB_PASSWORD ?? ''\n};\nconst helper = MysqlHelper.getInstance(config);\n\n(async () => {\n  try {\n    const rows = await helper.select('users', ['name', 'email'], { id: 1 }, 1);\n    console.log(rows);\n  } catch (err) {\n    console.error(err);\n  }\n})();","lang":"javascript","description":"Initialize the MySQL helper with connection config and perform a simple select query using async/await."},"warnings":[{"fix":"Consider migrating to mysql2 with promise wrapper, or use an ORM like Sequelize.","message":"Package is not actively maintained; last update was years ago. Newer alternatives like mysql2 or knex are recommended.","severity":"deprecated","affected_versions":"*"},{"fix":"If you need multiple connections, avoid using the singleton; instead manage separate instances manually.","message":"Singleton pattern: getInstance returns the same instance for the same config, but calling getInstance with different config does not create a new connection pool; it reuses the first one.","severity":"gotcha","affected_versions":"*"},{"fix":"Use mysql2 or another driver that exposes pool options, or wrap the library with custom pool management.","message":"No built-in connection pool configuration; relies on underlying mysql package's default pool settings which may not suit production loads.","severity":"gotcha","affected_versions":"*"},{"fix":"Refer to README for supported operators; for complex queries, consider writing raw SQL.","message":"The where clause supports operators like '>=', '<' inside objects, but the format is non-standard and may cause confusion for complex queries.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'0.2.1':17 'altern':54 'around':24 'async':79 'async/await':11 'base':22 'batchinsertinto':34 'condit':45 'delet':38 'design':46 'es2017':13 'es6':4 'featur':59 'full':58 'full-featur':57 'helper':3,8,76 'includ':68 'insertinto':33 'javascript':77 'librari':9 'lightweight':6 'like':61 'method':29 'minim':53 'mysql':2,7,26,75,78 'mysql-helper-es6':1 'node.js':15,48 'orm':60 'packag':27 'provid':18 'rang':43 'replaceinto':35 'see':72 'select':31 'selecton':32 'sequel':62 'simpl':41 'singleton':21 'singleton-bas':20 'support':40,71 'syntax':12 'ts':70,74 'ts-mysql-help':73 'type':67 'typeorm':64 'typescript':66 'updat':36 'use':10 'v8':49 'version':16 'wrapper':23","created_at":"2026-06-05T16:59:04.114620+00:00","updated_at":"2026-06-05T16:59:04.114620+00:00","problems":[{"fix":"Use const MysqlHelper = require('mysql-helper-es6');","cause":"Using ES module import syntax (import) instead of CommonJS require.","error":"TypeError: MysqlHelper.getInstance is not a function"},{"fix":"Run npm install mysql-helper-es6 and ensure you are not using a relative path incorrectly.","cause":"Package not installed or import path incorrect.","error":"Error: Cannot find module 'mysql-helper-es6'"},{"fix":"Ensure you call MysqlHelper.getInstance({host, user, password, database...}); config must have required fields.","cause":"Forgetting to pass config object to getInstance, or config is malformed.","error":"Error: getInstance(...) returns undefined"}],"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/bruce48x/mysql-helper-es6#readme","github":"https://github.com/bruce48x/mysql-helper-es6","docs":null,"changelog":null,"pypi":null,"npm":"mysql-helper-es6","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}}