eggjs/egg-sequelize — a data project — sits at 611 GitHub stars in the Data space. Sequelize for Egg.js
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
NOTE: This plugin just for integrate Sequelize into Egg.js, more documentation please visit http://sequelizejs.com.
Install
$ npm i --save egg-sequelize
$ npm install --save mysql2 # For both mysql and mariadb dialects
# Or use other database backend.
$ npm install --save pg pg-hstore # PostgreSQL
$ npm install --save tedious # MSSQL
Edit your own configurations in conif/config.{env}.js
exports.sequelize = {
dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
database: 'test',
host: 'localhost',
port: 3306,
username: 'root',
password: '',
// delegate: 'myModel', // load all models to `app[delegate]` and `ctx[delegate]`, default to `model`
// baseDir: 'my_model', // load all files in `app/${baseDir}` as models, default to `model`
// exclude: 'index.js', // ignore `app/${baseDir}/index.js` when load models, support glob and array
// more sequelize options
};
You can also use the connection uri to configure the connection:
exports.sequelize = {
dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
connectionUri: 'mysql://root:@127.0.0.1:3306/test',
// delegate: 'myModel', // load all models to `app[delegate]` and `ctx[delegate]`, default to `model`
// baseDir: 'my_model', // load all files in `app/${baseDir}` as models, default to `model`
// exclude: 'index.js', // ignore `app/${baseDir}/index.js` when load models, support glob and array
// more sequelize options
};
egg-sequelize has a default sequelize options below
If you define the same model for different datasource, the same model file will be excute twice for different database, so we can use the secound argument to get the sequelize instance:
// app/model/user.js
// if this file will load multiple times for different datasource
// we can use the secound argument to get the sequelize instance
module.exports = (app, model) => {
const { STRING, INTEGER, DATE } = app.Sequelize;
const User = model.define('user', {
login: STRING,
name: STRING(30),
password: STRING(32),
age: INTEGER,
last_sign_in_at: DATE,
created_at: DATE,
updated_at: DATE,
});
return User;
};
Customize Sequelize
By default, egg-sequelize will use sequelize@5, you can cusomize sequelize version by pass sequelize instance with config.sequelize.Sequelize like this:
The most recent commit recorded on eggjs/egg-sequelize was 2.7 years ago, based on the GitHub push timestamp. The repository has 134 forks — one of the better signals of community interest.
How does eggjs/egg-sequelize compare to other Data projects?
eggjs/egg-sequelize is tracked by TopGit in the Data category, with 611 GitHub stars and written in JavaScript. Browse the Data topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does eggjs/egg-sequelize have?
eggjs/egg-sequelize has 611 GitHub stars — refresh the page for the live number, or check github.com/eggjs/egg-sequelize. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is eggjs/egg-sequelize?
eggjs/egg-sequelize (eggjs/egg-sequelize) is a JavaScript project on GitHub. From the project's own README: Sequelize for Egg.js
What language is eggjs/egg-sequelize written in?
eggjs/egg-sequelize is written primarily in JavaScript. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is eggjs/egg-sequelize associated with?
GitHub's repository topics for eggjs/egg-sequelize: "egg", "egg-plugin", "orm", "sequelize". TopGit's editorial category is Data.
Why is eggjs/egg-sequelize categorized under Data?
TopGit places eggjs/egg-sequelize in the Data category based on its GitHub topics and description (tagged: "egg", "egg-plugin", "orm"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Still deciding about egg-sequelize?
One click hands the question to an AI along with this page — see what it says about egg-sequelize.