Skip to content

Commit

Permalink
docs: add comment in index.d.ts (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
supperchong authored and dead-horse committed Jul 19, 2019
1 parent c0e509e commit 683298d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
22 changes: 19 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import * as sequelize from 'sequelize';

interface EggSequelizeOptions extends sequelize.Options {
/**
* load all models to `app[delegate]` and `ctx[delegate]`, default to `model`
*/
delegate?: string;

/**
* load models from `app/model/*.js`
*/
baseDir?: string;
exclude?: string;

/**
* ignore `app/${baseDir}/index.js` when load models, support glob and array
*/
exclude?: string | Array<string>;

/**
* A full database URI
* @example
* `connectionUri:"mysql://localhost:3306/database"`
*/
connectionUri?: string;
}

Expand All @@ -12,7 +29,7 @@ interface DataSources {
}

declare module 'egg' {
interface IModel extends sequelize.Sequelize, PlainObject { }
interface IModel extends sequelize.Sequelize, PlainObject {}

// extend app
interface Application {
Expand All @@ -29,5 +46,4 @@ declare module 'egg' {
interface EggAppConfig {
sequelize: EggSequelizeOptions | DataSources;
}

}
6 changes: 3 additions & 3 deletions lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ module.exports = app => {
});

/**
* load databse to app[config.delegate
* load database to app[config.delegate]
* @param {Object} config config for load
* - delegate: load model to app[delegate]
* - baeDir: where model located
* - other sequelize configures(databasem username, password, etc...)
* - baseDir: where model located
* - other sequelize configures(database username, password, etc...)
* @return {Object} sequelize instance
*/
function loadDatabase(config = {}) {
Expand Down

0 comments on commit 683298d

Please sign in to comment.