Registry / database / egg-zing-orm

egg-zing-orm

JSON →
library0.3.5jsnpmunverified

An Egg.js plugin integrating ZingOrm, a simple ORM for Node.js. Version 0.3.5 targets Node >=8.0.0. As a plugin, it provides declarative model configuration and lifecycle management within the Egg framework. Compared to standalone ORMs like Sequelize or TypeORM, it offers tighter integration with Egg's app/agent pattern, but lacks ecosystem maturity and documentation.

npm install egg-zing-orm
INSTALL
IMPORT
SIG · EGG-ZING-ORM
E
egg-zing-orm
databasejavascriptv0.3.5
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 zingOrm from 'egg-zing-orm'
✗ const zingOrm = require('egg-zing-orm')
Use ESM import for Egg plugins; requires egg framework.
app.zingOrm
✓ // config/plugin.js module.exports = { zingOrm: { enable: true, package: 'egg-zing-orm' } }; // Then use app.zingOrm in service
✗ import { zingOrm } from 'egg-zing-orm'
Egg plugin exposes via app.zingOrm; cannot be imported directly.
Model
✓ // app/model/user.js module.exports = app => { const { INTEGER, STRING } = app.zingOrm; return app.zingOrm.define('user', { name: STRING, age: INTEGER }); };
✗ import { Model } from 'egg-zing-orm'
Models are defined using app.zingOrm.define, not imported.

Shows basic Egg plugin setup, model definition, and service usage with egg-zing-orm.

// config/plugin.js exports.zingOrm = { enable: true, package: 'egg-zing-orm' }; // config/config.default.js exports.zingOrm = { client: { host: process.env.DB_HOST || 'localhost', port: 3306, user: process.env.DB_USER || 'root', password: process.env.DB_PASS || '', database: 'test' } }; // app/model/user.js module.exports = app => { const { STRING, INTEGER } = app.zingOrm; return app.zingOrm.define('user', { name: STRING(50), age: INTEGER }); }; // app/service/user.js const Service = require('egg').Service; class UserService extends Service { async list() { return await this.app.zingOrm.model.user.findAll(); } } module.exports = UserService;
Debug
Known issues
gotchaPlugin must be enabled in config/plugin.js before use
fix
Add `zingOrm: { enable: true, package: 'egg-zing-orm' }` to config/plugin.js
affects: >=0.0.0
gotchaModel files must follow Egg.js convention: placed in app/model/ and export a function receiving app
fix
Use `module.exports = app => { ... }` and place in app/model/
affects: >=0.0.0
gotchaRequires Egg.js >= 2.x and Node >= 8.0.0
fix
Upgrade Egg.js to version 2+ and Node to 8+
affects: >=0.0.0
breakingBreaking changes may occur between minor versions (pre-1.0 semver)
fix
Pin exact version in package.json: "egg-zing-orm": "0.3.5"
affects: <1.0.0
Errors
Common errors & fixes
Cannot find module 'egg-zing-orm'
Plugin not installed or enabled
fix
Install: `npm install egg-zing-orm` and enable in config/plugin.js
app.zingOrm is undefined
Plugin not enabled in config/plugin.js or not started correctly
fix
Ensure config/plugin.js has `zingOrm: { enable: true, package: 'egg-zing-orm' }` and restart app
ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Incorrect database credentials in config
fix
Update config/config.default.js with correct DB_HOST, DB_USER, DB_PASS
Upgrade
Version history
0.3.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Resources
egg-zing-orm — npm install egg-zing-orm · libregistry