ts-db-helper
Version:
Simple ORM based on TypeScript
73 lines • 2.1 kB
JavaScript
/**
* @public
* @class ColumnClauseValue
*
* @description
* Clause that hold a column comparission with the model that can deliver an alias.
*
* @author Olivier Margarit
*
* @since 0.2
*/
var ColumnClauseValue = /** @class */ (function () {
/**
* @public
* @constructor
*
* @param {string} name the column name
* @param {string|IQueryHelper} aliasing optaional param that is the alias or provide it
*/
function ColumnClauseValue(name, aliasing) {
this.name = name;
this.aliasing = aliasing;
}
Object.defineProperty(ColumnClauseValue.prototype, "alias", {
/**
* @public
* @property {string} alias the column alias
*/
get: function () {
if (this.aliasing instanceof String) {
return this.aliasing;
}
return undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ColumnClauseValue.prototype, "querySrc", {
/**
* @public
* @property {IQueryHelper} querySrc the query object that hold the column and deliver the alias
*/
get: function () {
if (!(this.aliasing instanceof String)) {
return this.aliasing;
}
return undefined;
},
enumerable: true,
configurable: true
});
/**
* @method fqn full qulaified name
*
* @return the full name with the namespace alias
*/
ColumnClauseValue.prototype.fqn = function () {
var fqn;
if (this.aliasing instanceof String) {
fqn = this.aliasing + '.' + this.name;
}
else if (this.aliasing && this.aliasing.alias) {
fqn = this.aliasing.alias + '.' + this.name;
}
else {
fqn = this.name;
}
return fqn;
};
return ColumnClauseValue;
}());
export { ColumnClauseValue };
//# sourceMappingURL=column-clause-value.model.js.map