Registry / database / zbmy-orm

zbmy-orm

JSON →
library1.0.26jsnpmunverified

Zbmy ORM is a Node.js ORM wrapper around Sequelize that supports read/write database separation, Oracle and MySQL dialects, and transaction management. Version 1.0.26 is the latest stable release. It provides a simplified API for common CRUD operations, SQL queries, and model definitions. Released under ISC license. Differentiators include built-in read/write splitting, Oracle support via dialect configuration, and a straightforward initialization pattern. Maintained by Zhongbei Mingyi.

npm install zbmy-orm
INSTALL
IMPORT
SIG · ZBMY-ORM
Z
zbmy-orm
databasejavascriptv1.0.26
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.

orm
const orm = require('zbmy-orm');
import orm from 'zbmy-orm';
Package uses CommonJS exports; ESM import not supported.
Sequelize (for model definitions)
const Sequelize = require('sequelize');
const Sequelize = require('zbmy-orm').Sequelize;
Sequelize is a peer dependency; must be required separately for model definitions.
init
orm.init('mysql','read', config);
orm.init({ dialect: 'mysql', type: 'read', ...config });
init expects separate arguments: connection name, type, and config object.

Initializes ORM with read-write config, defines a model using Sequelize, and performs a findAll query.

const path = require('path'); const orm = require('zbmy-orm'); const config = { dialect: 'mysql', database: 'dbName', username: 'xxx', password: 'xxx', option: { dialect: 'mysql' }, modelPath: path.join(__dirname, 'models') }; orm.init('mydb', 'all', config); // Define a model (in models/company.js) const Sequelize = require('sequelize'); module.exports = function(sequelize) { return sequelize.define('company', { _id: { type: Sequelize.UUID, primaryKey: true, defaultValue: Sequelize.UUIDV1 }, name: { type: Sequelize.STRING } }, { freezeTableName: true, timestamps: false }); }; // Use the ORM orm('company').findAll({ where: { _id: 'some-id' } }, function(err, result) { if (err) console.error(err); else console.log(result); });
Debug
Known issues
gotchaModel path must be absolute; relative paths may fail.
fix
Use path.join(__dirname, 'models') or absolute path.
affects: all
gotchainit function expects three arguments: name, type, config. Passing a single object will not work.
fix
Call orm.init('mydb', 'all', config) not orm.init(config).
affects: all
gotchaORM returns query results via callback; does not support Promises natively.
fix
Use callbacks or wrap with util.promisify.
affects: all
gotchaSequelize is a peer dependency not included; must be installed separately.
fix
Run npm install sequelize alongside zbmy-orm.
affects: all
Errors
Common errors & fixes
Cannot find module 'sequelize'
Sequelize peer dependency not installed.
fix
npm install sequelize
Error: Cannot read property 'findAll' of undefined
Model not registered; modelPath incorrect or model file not found.
fix
Ensure modelPath points to directory with valid model files that export a function.
TypeError: orm.init is not a function
Incorrect export import; zbmy-orm exports a function, not an object.
fix
Use const orm = require('zbmy-orm'); (not named import)
Dialect 'oracle' is not supported
Oracle dialect requires additional setup or dependency issue.
fix
Ensure oracle driver (e.g., oracledb) is installed and config option includes dialect: 'oracle'.
Upgrade
Version history
1.0.26latest on npm
Audit
Dependencies
sequelizerequiredORM is a wrapper around Sequelize; models and queries use Sequelize internally
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
1
Resources
zbmy-orm — npm install zbmy-orm · libregistry