1.0.5 • Published 6 years ago

egg-fortypeorm v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

egg-fortypeorm

NPM version build status Test coverage David deps

npm download

Install

$ npm i egg-fortypeorm --save

Usage

// {app_root}/config/plugin.js
exports.typeorm = {
  enable: true,
  package: 'egg-fortypeorm',
};

Configuration

// {app_root}/config/config.default.js example:
exports.typeorm = {
    type: "mysql",
    host: "127.0.0.1",
    port: 3306,
    username: "root",
    password: "xxx",
    database: "test",
    synchronize: true,
    entities:[Photo]
};

see config/config.default.js for more detail.

Example

export default class HomeController extends Controller {
  public async index() {
    const { ctx } = this;
    
    const photo = new Photo();
    photo.name = 'P1';
    photo.fileName = 'p1.png';
    photo.isPublished = true;
    photo.views = 0;
     ctx.body = await ctx.connection.manager.save(photo);
  }
}

Questions & Suggestions

Please open an issue here.

License

MIT

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago