
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
gg-thinkorm
Advanced tools
A flexible, lightweight and powerful Object-Relational Mapper for Node.js.
ThinkORM是一个可扩展轻量级的功能丰富的对象-关系映射的数据模型封装框架,使用Node.js实现。
如同SQL语言发明一样,ThinkORM试图用一种抽象的统一操作语言,尽量保持各种数据库书写语法一致,用户专注于数据操作逻辑而非具体的数据存储类型,达到快速开发和移植的目的。
let info = await model.where({id: {'<>': 1, '>=': 0}, name: 'bb', or: [{name: 'aa'}, {name: 'cc'}]}).find();
项目地址: Git Repo
基于Knex.js实现,支持 Mysql/MariaDB, PostgresSql, SQLite3, Oracle, MSSQL. (即将支持MongoDB)
抽象的面向对象式SQL操作语言,保持各种数据库书写语法一致,方便开发和项目迁移
支持schema定义数据结构,支持严格的类型检查;支持数据结构迁移到数据库,通过migrate方法调用
支持hasone,hasmany,manytomany关联查询
支持left,right,inner join查询,支持count,sum,group查询
支持连接池配置.支持数据链接检测以及自动重联,数据库服务的宕机修复后无需重启应用
支持事务操作,包括同模型、跨模型、并行事务(Mysql/MariaDB, PostgresSql)
支持数据自动验证以及自定义规则验证,且规则可扩展
支持前置、后置逻辑处理
npm install thinkorm --save
//class User.js
const {BaseModel, helper} = require('thinkorm');
const User = class extends BaseModel {
// 构造方法
init(){
// 模型名称,映射实体表 user
this.modelName = 'user';
// 数据表字段信息
this.fields = {
id: {
type: 'integer',
pk: true
},
name: {
type: 'string',
size: 30,
index: true,
defaults: ''
}
};
}
}
//CURD
const userModel = new User(config);
// add
let result = await userModel.add({"name": "张三"});
// delete
result = await userModel.where({id: 1}).delete();
// update
result = await userModel.where({id: 2}).update({"name": "李四"});
// select
result = await userModel.where({id: 3}).find(); //limit 1
result = await userModel.where({"name": {"<>": ""}}).select(); //query name is not null
MIT
FAQs
对thinkorm做了点小修改
We found that gg-thinkorm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.