Registry / database / sito-node-mysql

sito-node-mysql

JSON →
library1.10.8jsnpmunverified

A lightweight Node.js MySQL wrapper built on mysql2, providing simple CRUD operations (insert, update, select, deleteDocuments) with a custom WHERE syntax. Version 1.10.8 is current; release cadence is sporadic. Key differentiators include auto-generated UUID primary keys and a structured where object/array format. Minimal overhead but limited community support and documentation.

npm install sito-node-mysql
INSTALL
IMPORT
SIG · SITO-NODE-MYSQL
S
sito-node-mysql
databasejavascriptv1.10.8
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.

connection
const { connection } = require('sito-node-mysql')
const connection = require('sito-node-mysql')
Default export not available; must destructure.
insert
const { insert } = require('sito-node-mysql')
Correct destructured import for insert function.
select
const { select } = require('sito-node-mysql')
Correct destructured import for select function.

Shows connection initialization, insert, and select operations with mysql2 backend.

const { connection, insert, select } = require('sito-node-mysql'); connection.init({ host: process.env.MYSQL_HOST ?? 'localhost', user: process.env.MYSQL_USER ?? 'root', password: process.env.MYSQL_PASSWORD ?? '', database: process.env.MYSQL_DB ?? 'test' }); async function run() { const result = insert('users', ['user', 'name'], { user: 'testuser', name: 'Test' }); console.log('Inserted:', result); const rows = select('users', ['name'], { attribute: 'user', operator: '=', value: 'testuser' }); console.log('Selected:', rows); } run().catch(console.error);
Debug
Known issues
gotchaInserting with 'id' attribute overrides auto-generated UUID. If you pass 'id' in the attributes array, the auto-generated UUID is replaced by the provided value.
fix
Do not include 'id' in attributes unless you intend to set it manually.
affects: >=1.0
gotchaWHERE syntax uses a specific object format with 'attribute', 'operator', 'value', and optional 'value1' and 'parenthesis'. Incorrect structure may cause SQL errors.
fix
Follow the documented object shape; for multiple conditions use an array with 'logic' field.
affects: >=1.0
gotchaThe library relies on mysql2 for connections; connection configuration must be provided via connection.init() before any CRUD operation.
fix
Ensure connection.init() is called with valid MySQL credentials before calling other functions.
affects: >=1.0
Errors
Common errors & fixes
TypeError: connection.init is not a function
Missing destructured import or incorrect import style.
fix
Use: const { connection } = require('sito-node-mysql'); connection.init({...});
Error: Cannot find module 'mysql2'
Missing required dependency mysql2.
fix
Run: npm install mysql2
Error: insert is not a function
Incorrect import (e.g., require('sito-node-mysql') returns an object, you must destructure).
fix
Use: const { insert } = require('sito-node-mysql');
Upgrade
Version history
1.10.8latest on npm
Audit
Dependencies
mysql2requiredUnderlying MySQL driver for query execution
uuidrequiredGenerate UUID for auto-increment primary keys
Agent activity
6 hits · last 30 days
node
4
Meta
2
Resources
sito-node-mysql — npm install sito-node-mysql · libregistry