Registry / database / easy-mysql-js

easy-mysql-js

JSON →
library1.0.5jsnpmunverified

Easy MySQL for NodeJS provides a simplified interface for MySQL database operations including select, insert, update, delete, and insertOrUpdate. Built on top of Prisma, it requires Prisma initialization and schema configuration. Current stable version is 1.0.5. Release strategy is unknown. Key differentiators: leverages Prisma for database pulling and generation, supports MySQL and MSSQL, and offers a promise-based API.

npm install easy-mysql-js
INSTALL
IMPORT
SIG · EASY-MYSQL-JS
E
easy-mysql-js
databasejavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Select
const { Select } = require('easy-mysql-js')
const Select = require('easy-mysql-js')
Named export, not default. Use destructuring.
SelectSingle
const { SelectSingle } = require('easy-mysql-js')
Named export for single record query.
Insert
const { Insert } = require('easy-mysql-js')
Named export for insert operation.
Update
const { Update } = require('easy-mysql-js')
Named export for update operation.
InsertOrUpdate
const { InsertOrUpdate } = require('easy-mysql-js')
Named export for upsert operation.
Delete
const { Delete } = require('easy-mysql-js')
Named export for delete operation.

Shows how to perform basic CRUD operations using the package functions.

const { Select, SelectSingle, SelectMulti, Insert, Update, InsertOrUpdate, Delete } = require('easy-mysql-js'); async function example() { // Select with raw query const results = await Select('SELECT * FROM users WHERE id = 1'); console.log('Select:', results); // SelectSingle (requires unique column) const user = await SelectSingle('users', { id: 1 }, { id: true, name: true, email: true }); console.log('SelectSingle:', user); // Insert const insertResult = await Insert('users', { name: 'John', email: 'john@example.com' }); console.log('Insert:', insertResult); // Update const updateResult = await Update('users', { id: 1 }, { name: 'Jane' }); console.log('Update:', updateResult); // Delete const deleteResult = await Delete('users', { id: 2 }); console.log('Delete:', deleteResult); } example().catch(console.error);
Debug
Known issues
gotchaRequires Prisma setup before use: npx prisma init, configure schema, npx prisma db pull, npx prisma generate.
fix
Follow the setup steps in order.
affects: >=1.0
gotchaAll operations are async; must use await or .then(). Failure to do so returns a Promise.
fix
Use await or chain with .then() and .catch().
affects: >=1.0
gotchaSelect returns an empty array on error, not null or exception.
fix
Check array length or handle errors via other means.
affects: >=1.0
gotchaSelectSingle returns null on error or not found, not an exception.
fix
Check for null result.
affects: >=1.0
gotchaThe package is CommonJS only; no ESM support.
fix
Use require() instead of import.
affects: >=1.0
Errors
Common errors & fixes
Cannot find module '@prisma/client'
Prisma client not generated or missing.
fix
Run 'npx prisma generate' after setting up schema and .env.
Error: query is not defined
Variable name mismatch in async function.
fix
Ensure variable 'query' is defined before use in Select() call.
TypeError: Select is not a function
Incorrect import (not destructured) or typo.
fix
Use const { Select } = require('easy-mysql-js');
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
@prisma/clientrequiredPrisma Client is used for database queries; must be installed and generated.
Agent activity
2 hits · last 30 days
node
2
Resources
easy-mysql-js — npm install easy-mysql-js · libregistry