npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zbmy-orm

v1.0.26

Published

ORM

Readme

中北明夷ORM


安装
npm install zbmy-orm
初始化db,这里区分读写库。

添加oracle支持,配置文件添加dialect = "oracle"

var writeConfig = {
    dialect: "oracle",
    database: 'dbName',
    username: "xxx",
    password: "xxx",
    option: {
        dialect: "oracle"
    },
    modelPath: path.join(__dirname, 'models') //这里标识model数据模板存储位置,绝对路径。
};
var orm = require('zbmy-orm');
orm.init('mysql','read', writeConfig);//P1为自定义名称,P2为读写类型(read,write,all),P3为数据库参数配置,基本参照sequelize的标准,需要注意modelPath参数;
model定义
"use strict"
var Sequelize = require('sequelize');
 
module.exports = function(sequelize){
    var Company = sequelize.define('company',{
        _id: {
            type: Sequelize.UUID,
            primaryKey: true,
            defaultValue: Sequelize.UUIDV1
        },
        openid: {
            type: Sequelize.STRING
        }
    },{
        freezeTableName: true,
        timestamps: false,
        paranoid: true,
        underscored: true
    });
    return Company;
}
业务逻辑
//findAll方法
orm('gamer').findAll({where:{_id:"xxx"}}, function(err, result){
    //err 错误信息
    //result 数据信息
});
//事务
orm('gamer').transaction({isolationLevel: "xxxx", deferrable: "xxx", autocommit: false}, function(t){
    orm('gamer').findAll({where: {_id: "xxx"}}, {transaction: t}, function(err, result){
        if(err){t.rollback();}
        t.commit();
    });
});
//sql query
orm('gamer').invokeSQL({sql: "xxx", options: {}}, function(err, result){
    /*
    result = {
        data: data,
        metadata: metadata
    }
    */
});
API 支持
  • read方法:
    find
    findOrCount count
    max
    min
    sum
  • write方法:
    findOrCreate
    create
    update
    destroy increment
    decrement
    bulkCreate
    transaction
    invokeSQL
  • read in write for transaction and sql
    w_findAll
    w_findOrCount w_count
    w_max
    w_min
    w_sum