@nfly/orm
v1.2.0
Published
typeorm 封装, 面向切面编程, 依赖注入的形式开发node服务
Downloads
32
Readme
Install
pnpm add @nfly/orm
Usage
More information typeorm
# service
mport { BaseService } from '@nfly/core';
import { Model } from '@nfly/orm';
import { Repository } from 'typeorm';
import { Photo } from '../../Model/home';
class HomeService extends BaseService {
// connectname default ''
@Model<Photo>(Photo, 'connectname')
home!: Repository<Photo>;
async getName() {
const data = await this.home.find();
return data;
}
}
# service
import { Service } from '@nfly/router';
import HomeService from '../../service/Home';
class Home extends BaseController {
@Service(HomeService)
homeServer!: HomeService;
}