跳至主要內容
版本:v6 - 穩定版

Sequelize v6

npm version Build Status npm downloads sponsor Last commit Merged PRs GitHub stars Slack Status node License semantic-release

Sequelize 是一個基於 Promise 的 Node.js ORM 工具,適用於 PostgresMySQLMariaDBSQLiteMicrosoft SQL ServerOracle DatabaseAmazon RedshiftSnowflake 的資料雲。它具有穩固的交易支援、關聯、預先載入和延遲載入、讀取複製等功能。

Sequelize 遵循 語義化版本控制,並支援 Node v10 及以上版本。

您目前正在查看 Sequelize 的教學和指南。您可能也會對 API 參考感興趣。

快速範例

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 的資訊,請閱讀左側選單中的教學。從開始使用開始。

支持此專案

您喜歡 Sequelize 並希望回饋其背後的工程團隊嗎?

我們最近建立了一個 基於 OpenCollective 的資金池,根據其貢獻在所有核心維護者之間共享。我們衷心歡迎所有支持。❤️