Registry / database / tiny-mysql-orm

tiny-mysql-orm

JSON →
library1.0.13jsnpmunverified

A lightweight MySQL ORM for Node.js that simplifies database and table creation, as well as insert queries. Currently at version 1.0.13, it supports automatic database/table creation and an insert method with explicit value type handling. Designed for simple use cases with minimal configuration. Lacks advanced query capabilities (select, update, delete), connection pooling, or migration support. Released with an unknown cadence; no recent updates.

database
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.

Named export via CommonJS; default import does not exist.

const { MysqlHandler } = require('tiny-mysql-orm');

ESM named import is supported; default import will fail.

import { MysqlHandler } from 'tiny-mysql-orm';

Do not use .default property.

const { MysqlHandler } = require('tiny-mysql-orm');

Shows how to instantiate MysqlHandler with database and table creation, then perform an insert query using explicit value types.

const { MysqlHandler } = require('tiny-mysql-orm'); const host_info = { host: 'localhost', user: 'db_user', password: 'my_password', database: 'test_db' }; const tables = [ { name: 'users', columns: [ { name: 'name', type: 'VARCHAR(128)' }, { name: 'email', type: 'VARCHAR(255)' } ], unique: ['email'] } ]; const handler = new MysqlHandler(host_info, true, tables, false); const query = { table: 'users', columns: ['name', 'email'], values: [ [ { type: 'varchar', value: 'John Doe' }, { type: 'varchar', value: 'john@example.com' } ] ] }; handler.insert(query) .then(result => console.log('Inserted:', result)) .catch(err => console.error('Error:', err));
Debug
Known footguns
gotchaThe insert method requires values to be an array of arrays, each inner array containing objects with 'type' and 'value' properties. Type must be a string like 'varchar', 'int', etc.
gotchaWhen 'create_db' or table creation is enabled, the module automatically adds an 'id' column of type 'INT NOT NULL AUTO_INCREMENT' to every table. This may conflict with user-defined columns.
gotchaThe module uses synchronous connection creation; it does not support multiple database connections or connection pooling. Each instance uses a single connection.
gotchaNo error handling for missing database or table before insert; if table does not exist, the insert will fail with a MySQL error.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
7 hits · last 30 days
gptbot
3
ahrefsbot
1
Resources