ddl-manager
Version:
store postgres procedures and triggers in files
41 lines • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Join = void 0;
const TableReference_1 = require("../database/schema/TableReference");
const assert_1 = require("assert");
class Join {
constructor(type, table, on) {
this.type = type;
this.table = table;
this.on = on;
}
replaceTable(replaceTable, toTable) {
return new Join(this.type, this.table.clone(), this.on.replaceTable(replaceTable, toTable));
}
equal(join) {
return (this.type === join.type &&
this.table.toString() === join.table.toString() &&
this.on.equal(join.on));
}
clone() {
return new Join(this.type, this.table.clone(), this.on.clone());
}
template(spaces) {
return [
spaces + `${this.type} ${this.table} on`,
spaces.plusOneLevel() + this.on.toString()
];
}
toString() {
return `${this.type} ${this.table} on\n${this.on}`;
}
getTableId() {
return this.getTable().table;
}
getTable() {
assert_1.strict.ok(this.table instanceof TableReference_1.TableReference, "expected join table");
return this.table;
}
}
exports.Join = Join;
//# sourceMappingURL=Join.js.map