sedk-mysql
Version:
Simple SQL builder and validator for MySQL
53 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RootStep = void 0;
const SelectStep_1 = require("./select-path/SelectStep");
const DeleteStep_1 = require("./delete-path/DeleteStep");
const InsertStep_1 = require("./insert-path/InsertStep");
const singletoneConstants_1 = require("../singletoneConstants");
const BaseStep_1 = require("./BaseStep");
const UpdateStep_1 = require("./update-path/UpdateStep");
class RootStep extends BaseStep_1.BaseStep {
constructor(data) {
super(null);
this.data = data;
}
getStepStatement() {
return '';
}
getStepArtifacts() {
return { tables: new Set(), columns: new Set() };
}
select(...items) {
return new SelectStep_1.SelectStep(this, items);
}
selectDistinct(...items) {
return new SelectStep_1.SelectStep(this, [singletoneConstants_1.DISTINCT, ...items]);
}
selectAll(...items) {
return new SelectStep_1.SelectStep(this, [singletoneConstants_1.ALL, ...items]);
}
selectAsteriskFrom(...tables) {
return new SelectStep_1.SelectStep(this, [singletoneConstants_1.ASTERISK]).from(...tables);
}
delete() {
return new DeleteStep_1.DeleteStep(this);
}
deleteFrom(fromItem) {
return new DeleteStep_1.DeleteStep(this).from(fromItem);
}
insert() {
return new InsertStep_1.InsertStep(this);
}
insertInto(table, ...columns) {
if (columns.length === 0) {
return new InsertStep_1.InsertStep(this).into(table);
}
return new InsertStep_1.InsertStep(this).into(table, ...columns);
}
update(table) {
return new UpdateStep_1.UpdateStep(this, table);
}
}
exports.RootStep = RootStep;
//# sourceMappingURL=RootStep.js.map