@tsdi/typeorm-adapter
Version:
@tsdi/typeorm-adapter is typeorm adapter orm for boot application, mvc frameworks on server.
37 lines (35 loc) • 1.4 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { Singleton, Inject, INJECTOR } from '@tsdi/ioc';
import { TypeormConnectionStatupService } from './TypeormConnectionStatupService';
let TypeOrmHelper = class TypeOrmHelper {
constructor() {
}
getConnection(connectName) {
if (!this.service) {
this.service = this.injector.get(TypeormConnectionStatupService);
}
return this.service.getConnection(connectName);
}
getRepository(type, connectName) {
return this.getConnection(connectName).getRepository(type);
}
getCustomRepository(type, connectName) {
return this.getConnection(connectName).getCustomRepository(type);
}
getMongoRepository(type, connectName) {
return this.getConnection(connectName).getMongoRepository(type);
}
static ρAnn() {
return { "name": "TypeOrmHelper", "params": { "getConnection": ["connectName"], "getRepository": ["type", "connectName"], "getCustomRepository": ["type", "connectName"], "getMongoRepository": ["type", "connectName"] } };
}
};
__decorate([
Inject(INJECTOR),
__metadata("design:type", Object)
], TypeOrmHelper.prototype, "injector", void 0);
TypeOrmHelper = __decorate([
Singleton(),
__metadata("design:paramtypes", [])
], TypeOrmHelper);
export { TypeOrmHelper };
//# sourceMappingURL=sourcemaps/TypeOrmHelper.js.map