sedk-mysql
Version:
Simple SQL builder and validator for MySQL
44 lines • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectWhereOrStep = exports.SelectWhereAndStep = exports.SelectWhereStep = void 0;
const OrderByStep_1 = require("./OrderByStep");
const ConditionStep_1 = require("../ConditionStep");
const BaseStep_1 = require("../BaseStep");
const GroupByStep_1 = require("./GroupByStep");
class SelectConditionStep extends ConditionStep_1.ConditionStep {
and(cond1, op1, cond2, op2, cond3) {
const whereParts = [];
BaseStep_1.BaseStep.addConditionParts(whereParts, cond1, op1, cond2, op2, cond3);
return new SelectWhereAndStep(this, whereParts);
}
or(cond1, op1, cond2, op2, cond3) {
const whereParts = [];
BaseStep_1.BaseStep.addConditionParts(whereParts, cond1, op1, cond2, op2, cond3);
return new SelectWhereOrStep(this, whereParts);
}
groupBy(...groupByItems) {
return new GroupByStep_1.GroupByStep(this, groupByItems);
}
orderBy(...orderByItems) {
return new OrderByStep_1.OrderByStep(this, orderByItems);
}
}
class SelectWhereStep extends SelectConditionStep {
constructor(prevStep, whereParts) {
super('WHERE', prevStep, whereParts);
}
}
exports.SelectWhereStep = SelectWhereStep;
class SelectWhereAndStep extends SelectConditionStep {
constructor(prevStep, whereParts) {
super('AND', prevStep, whereParts);
}
}
exports.SelectWhereAndStep = SelectWhereAndStep;
class SelectWhereOrStep extends SelectConditionStep {
constructor(prevStep, whereParts) {
super('OR', prevStep, whereParts);
}
}
exports.SelectWhereOrStep = SelectWhereOrStep;
//# sourceMappingURL=SelectConditionStep.js.map