Registry / database / h-orm

h-orm

JSON →
library0.0.11jsnpmunverified

h-orm is a lightweight MySQL ORM for Node.js, version 0.0.11. It provides a simple promise-based API for common CRUD operations, connection pooling, and a model-based approach. Key differentiators include minimal configuration, support for like queries, and automatic status field handling for soft deletes. The package has a low release cadence and is suitable for small to medium projects.

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.

h-orm is CJS-only; use require().

const horm = require('h-orm');

model() is a method on the default export, not a named export.

const horm = require('h-orm'); const Model = horm.model('table', schema);

connect() is a method on the default export, called directly.

const horm = require('h-orm'); horm.connect(config);

Shows connection setup, model definition, and CRUD operations: find, create, update, delete.

const horm = require('h-orm'); horm.connect({ host: process.env.DB_HOST || '127.0.0.1', port: process.env.DB_PORT || '3306', database: process.env.DB_NAME || 'test', user: process.env.DB_USER || 'root', password: process.env.DB_PASS || '', debug: true }); const UserModel = horm.model('users', { name: String, age: Number }); (async () => { const all = await UserModel(); console.log('All users:', all); const created = await UserModel().create({ name: 'Alice', age: 30 }); console.log('Created:', created); const found = await UserModel().find(1); console.log('Found by id 1:', found); const updated = await UserModel().update({ age: 31 }, { name: 'Alice' }); console.log('Updated:', updated); const deleted = await UserModel().delete({ age: 31 }); console.log('Deleted count:', deleted); })();
Debug
Known footguns
gotchaModel fields are defined with JavaScript constructors (String, Number) but type enforcement is loose; non-matching types may be stored without validation.
gotchaThe `model()` function returns an instance, but actual querying is done by calling the instance as a function (e.g., `Model()`) or chaining methods like `Model().find(1)`. Omitting the empty call `()` will return the function itself, not execute the query.
gotchaThe `delete()` method with an object argument performs a hard delete by default, not a soft delete. Soft delete (setting a status field) requires configuring `exInfo.status`.
deprecatedThe package has not been updated since version 0.0.11 (released 2020). It relies on an older version of the mysql driver and may have compatibility issues with newer Node.js versions.
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
10 hits · last 30 days
gptbot
3
ahrefsbot
3
mj12bot
1
Resources
packageh-orm