node-mysql-wrapper
Version:
This is a node js module, written in TypeScript (module is compiled to JavaScript), which manages mysql (node-mysql) connection and models in a way that you expected!
39 lines (38 loc) • 1.59 kB
JavaScript
exports.COMPARISON_SYMBOLS = ["= ", "<> ", "> ", "< ", ">= ", "<= "];
var WhereBuilder = (function () {
function WhereBuilder(parentCriteriaBuilder, key) {
this.parentCriteriaBuilder = parentCriteriaBuilder;
this.key = key;
}
WhereBuilder.prototype.eq = function (val) {
this.parentCriteriaBuilder.rawCriteria[this.key] = "= " + val;
return this.parentCriteriaBuilder;
};
WhereBuilder.prototype.ne = function (val) {
this.parentCriteriaBuilder.rawCriteria[this.key] = "<> " + val;
return this.parentCriteriaBuilder;
};
WhereBuilder.prototype.gt = function (val) {
this.parentCriteriaBuilder.rawCriteria[this.key] = "> " + val;
return this.parentCriteriaBuilder;
};
WhereBuilder.prototype.lt = function (val) {
this.parentCriteriaBuilder.rawCriteria[this.key] = "< " + val;
return this.parentCriteriaBuilder;
};
WhereBuilder.prototype.ge = function (val) {
this.parentCriteriaBuilder.rawCriteria[this.key] = ">= " + val;
return this.parentCriteriaBuilder;
};
WhereBuilder.prototype.le = function (val) {
this.parentCriteriaBuilder.rawCriteria[this.key] = "<= " + val;
return this.parentCriteriaBuilder;
};
WhereBuilder.prototype.in = function (values) {
this.parentCriteriaBuilder.rawCriteria[this.key] = "IN( " + values.join(", ") + ") ";
return this.parentCriteriaBuilder;
};
return WhereBuilder;
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = WhereBuilder;