Registry / database / crystal-node-mysql

crystal-node-mysql

JSON →
library1.0.11jsnpmunverified

A MySQL connection library specifically designed for the crystal-node framework (version 1.0.11). This package provides a thin wrapper around mysql2 with connection pooling and basic CRUD operations tailored to crystal-node's ORM-style usage. It is tightly coupled to crystal-node and not intended for general use outside that ecosystem. Development appears slow with no recent updates.

npm install crystal-node-mysql
INSTALL
IMPORT
SIG · CRYSTAL-NODE-MYSQL
C
crystal-node-mysql
databasejavascriptv1.0.11
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.

default
✓ import mysql from 'crystal-node-mysql'
✗ const mysql = require('crystal-node-mysql')
Package exports a default object with query, getConnection, etc. Requires ESM or dynamic import.
query
✓ import { query } from 'crystal-node-mysql'
Named export for single query function.
getConnection
✓ import { getConnection } from 'crystal-node-mysql'
Named export to acquire a connection from pool.

Initializes the library with a mysql2 pool and runs a simple query.

import mysql from 'crystal-node-mysql'; import { createPool } from 'mysql2/promise'; async function main() { const pool = createPool({ host: process.env.DB_HOST ?? 'localhost', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASSWORD ?? '', database: process.env.DB_NAME ?? 'test', waitForConnections: true, connectionLimit: 10, queueLimit: 0 }); mysql.init(pool); const rows = await mysql.query('SELECT 1 + 1 AS result'); console.log(rows); } main();
Debug
Known issues
gotchaPackage is tightly coupled to crystal-node framework; standalone use may require extra setup.
fix
Use generic mysql2 if not using crystal-node.
affects: >=0.0.0
deprecatedNo active development; last update was years ago. Consider migrating to mysql2 directly.
fix
Replace with mysql2 and adjust code.
affects: >=0.0.0
breakingIn version 1.0.0, the API changed from callback-based to promise-based.
fix
Update code to use async/await or .then() instead of callbacks.
affects: <1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'crystal-node-mysql'
Package not installed or typo in name.
fix
Run `npm install crystal-node-mysql` and ensure correct import path.
TypeError: mysql.init is not a function
Pool not initialized before querying.
fix
Call `mysql.init(pool)` with a valid mysql2 pool first.
Error: getaddrinfo ENOTFOUND
Database hostname unresolved.
fix
Check DB_HOST environment variable or connection config.
Upgrade
Version history
1.0.11latest on npm
Audit
Dependencies
mysql2requiredUnderlying MySQL driver used for all database operations.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
crystal-node-mysql — npm install crystal-node-mysql · libregistry