Skip to main content
Version: v6 - stable

Sequelize v6

Sequelize 是基于 promise 的 Node.js 对象关系映射工具,适用于 PostgresMySQLMariaDBSQLite微软 SQL 服务器甲骨文数据库Amazon RedshiftSnowflake 的数据云。它具有可靠的事务支持、关系、预先和延迟加载、读取复制等功能。

¥Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle Database, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.

Sequelize 遵循 语义版本控制,支持 Node v10 及以上版本。

¥Sequelize follows Semantic Versioning and supports Node v10 and above.

你当前正在查看 Sequelize 的教程和指南。你可能还对 API 参考 感兴趣。

¥You are currently looking at the Tutorials and Guides for Sequelize. You might also be interested in the API Reference.

快速示例

¥Quick example

const { Sequelize, Model, DataTypes } = require('sequelize');
const sequelize = new Sequelize('sqlite::memory:');

class User extends Model {}
User.init(
{
username: DataTypes.STRING,
birthday: DataTypes.DATE,
},
{ sequelize, modelName: 'user' },
);

(async () => {
await sequelize.sync();
const jane = await User.create({
username: 'janedoe',
birthday: new Date(1980, 6, 20),
});
console.log(jane.toJSON());
})();

要了解有关如何使用 Sequelize 的更多信息,请阅读左侧菜单中的教程。从 入门 开始。

¥To learn more about how to use Sequelize, read the tutorials available in the left menu. Begin with Getting Started.

支持项目

¥Supporting the project

你喜欢 Sequelize 并想回馈其背后的工程团队吗?

¥Do you like Sequelize and would like to give back to the engineering team behind it?

我们最近创建了一个 基于 OpenCollective 的资金池,根据所有核心维护者的贡献在他们之间共享。竭诚欢迎所有支持。❤️

¥We have recently created an OpenCollective based money pool which is shared amongst all core maintainers based on their contributions. All support is wholeheartedly welcome. ❤️