database-builder
Version:
Library to assist in creating and maintaining SQL commands.
54 lines (53 loc) • 2.51 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryBuilder = void 0;
var join_type_1 = require("../enums/join-type");
var join_query_builder_1 = require("./join-query-builder");
var query_builder_base_1 = require("./query-builder-base");
var utils_1 = require("../../core/utils");
var QueryBuilder = /** @class */ (function (_super) {
__extends(QueryBuilder, _super);
function QueryBuilder() {
return _super !== null && _super.apply(this, arguments) || this;
}
QueryBuilder.prototype._getInstance = function () {
return this;
};
Object.defineProperty(QueryBuilder.prototype, "newable", {
get: function () {
return this._newable;
},
enumerable: false,
configurable: true
});
QueryBuilder.prototype.join = function (queryTJoin, onWhereCallback, joinCallback, mapperTable, type, alias, ignoreQueryFilters) {
if (type === void 0) { type = join_type_1.JoinType.LEFT; }
if (alias === void 0) { alias = void 0; }
if (utils_1.Utils.isQueryBuilder(queryTJoin)) {
this.innerUsedAliasTest.push(queryTJoin);
}
var instanceJoin = new join_query_builder_1.JoinQueryBuilder(queryTJoin, onWhereCallback, mapperTable, type, this.createAlias(alias, this.createTablename(utils_1.Utils.isQueryBuilder(queryTJoin)
? void 0
: queryTJoin, mapperTable)), this._getMapper, ignoreQueryFilters);
joinCallback(instanceJoin);
this.addJoin(instanceJoin);
return this._getInstance();
};
return QueryBuilder;
}(query_builder_base_1.QueryBuilderBase));
exports.QueryBuilder = QueryBuilder;