UNPKG

@tsdi/typeorm-adapter

Version:

@tsdi/typeorm-adapter is typeorm adapter orm for boot application, mvc frameworks on server.

41 lines (39 loc) 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeOrmHelper = void 0; var tslib_1 = require("tslib"); var ioc_1 = require("@tsdi/ioc"); var TypeormConnectionStatupService_1 = require("./TypeormConnectionStatupService"); var TypeOrmHelper = /** @class */ (function () { function TypeOrmHelper() { } TypeOrmHelper.prototype.getConnection = function (connectName) { if (!this.service) { this.service = this.injector.get(TypeormConnectionStatupService_1.TypeormConnectionStatupService); } return this.service.getConnection(connectName); }; TypeOrmHelper.prototype.getRepository = function (type, connectName) { return this.getConnection(connectName).getRepository(type); }; TypeOrmHelper.prototype.getCustomRepository = function (type, connectName) { return this.getConnection(connectName).getCustomRepository(type); }; TypeOrmHelper.prototype.getMongoRepository = function (type, connectName) { return this.getConnection(connectName).getMongoRepository(type); }; TypeOrmHelperAnn = function () { return { "name": "TypeOrmHelper", "params": { "getConnection": ["connectName"], "getRepository": ["type", "connectName"], "getCustomRepository": ["type", "connectName"], "getMongoRepository": ["type", "connectName"] } }; }; tslib_1.__decorate([ ioc_1.Inject(ioc_1.INJECTOR), tslib_1.__metadata("design:type", Object) ], TypeOrmHelper.prototype, "injector", void 0); TypeOrmHelper = tslib_1.__decorate([ ioc_1.Singleton(), tslib_1.__metadata("design:paramtypes", []) ], TypeOrmHelper); return TypeOrmHelper; }()); exports.TypeOrmHelper = TypeOrmHelper; //# sourceMappingURL=sourcemaps/TypeOrmHelper.js.map