egg-qingger-typeorm
v2.0.8
Published
egg plugin for typeorm
Downloads
40
Readme
egg-qingger-typeorm
Install
$ npm i egg-qingger-typeorm --save
Usage
// {app_root}/config/plugin.js
exports.qinggerTypeorm = {
enable: true,
package: 'egg-qingger-typeorm',
};
Configuration
// {app_root}/config/config.default.js
// see detail : http://typeorm.io/#/connection-options
exports.qinggerTypeorm = {
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "test",
"password": "test",
"database": "test",
"synchronize": true,
"logging": false,
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
]
};
see config/config.default.js for more detail.
Example
// @see detail : http://typeorm.io/
// save object
const photo = new Photo();
photo.name = 'P1';
photo.fileName = 'p1.png';
photo.isPublished = true;
photo.views = 0;
let ret = await this.app.qinggerTypeorm.manager.save(photo);
Questions & Suggestions
Please open an issue here.
Update
注意,不使用dist目录下编译的文件
$ tsc
$ git add . / git commit
$ npm config set registry https://registry.npmjs.org/
$ npm login
$ npm whoami
$ npm version patch / minor / major
$ npm publish
$ npm logout
$ git push