Registry / database / mysql-mapper

mysql-mapper

JSON →
library1.2.1jsnpmunverified

MySQL adaptor for sql-mapper, providing template-based MySQL database access. Current stable version is 1.2.1. Release cadence is infrequent; the package appears to be in maintenance mode. It offers a simple MySQL integration for the sql-mapper library, but lacks detailed documentation and active development.

npm install mysql-mapper
INSTALL
IMPORT
SIG · MYSQL-MAPPER
M
mysql-mapper
databasejavascriptv1.2.1
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 Mapper from 'mysql-mapper'
const Mapper = require('mysql-mapper')
ESM import is recommended; CommonJS require also works
createMapper
import { createMapper } from 'mysql-mapper'
Named export for creating a mapper instance with MySQL connection options

Shows how to create a MySQL connection and use mysql-mapper to run a parameterized query.

import Mapper from 'mysql-mapper'; import mysql from 'mysql'; const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: 'password', database: 'test' }); const mapper = new Mapper(connection); const query = 'SELECT * FROM users WHERE id = ?'; mapper.query(query, [1], (err, rows) => { if (err) throw err; console.log(rows); });
Debug
Known issues
deprecatedPackage is in maintenance mode; no active development expected.
fix
Consider migrating to a more modern MySQL library like mysql2 with promise support.
affects: >=1.0.0
gotchaRequires both sql-mapper and mysql packages as dependencies; ensure they are installed.
fix
npm install sql-mapper mysql
affects: >=1.0.0
gotchaCallbacks only; no promise support out of the box.
fix
Wrap calls in Promise or use util.promisify.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'sql-mapper'
Missing peer dependency sql-mapper
fix
npm install sql-mapper
Mapper is not a constructor
Incorrect import or missing dependency
fix
Ensure correct import: import Mapper from 'mysql-mapper'
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
sql-mapperrequiredcore dependency; mysql-mapper is an adaptor for sql-mapper
mysqlrequiredMySQL driver for Node.js
Agent activity
4 hits · last 30 days
node
4
Resources
mysql-mapper — npm install mysql-mapper · libregistry