Node.js 的 ORM 框架,Sequelize 2.0.0RC2 发布
jopen 10年前
Sequelize.js 提供对 MySQL,MariaDB,SQLite 和 PostgreSQL 数据库的简单访问,通过映射数据库条目到对象,或者对象到数据库条目。简而言之,就是 ORM(Object-Relational-Mapper)。Sequelize.js 完全是使用 JavaScript 编写,适用于 Node.js 的环境。
Sequelize.js 2.0.0-RC2 发布,此版本现已提供下载,更新内容如下:
简单使用
创建 Sequelize 实例:
var sequelize = new Sequelize('database', 'username'[, 'password'])
指定 host/port:
var sequelize = new Sequelize('database', 'username', 'password', { host: "my.server.tld", port: 12345 })
没有密码的情况:
var sequelize = new Sequelize('database', 'username') // or var sequelize = new Sequelize('database', 'username', null)
使用连接字符串:
var sequelize = new Sequelize('mysql://user:pass@example.com:9821/dbname', { // Look to the next section for possible options })
Added to posibility of using a sequelize object as key in
sequelize.where
. Also added the option of specifying a comparator
来自:http://www.oschina.net/p/sequelize