sql-ddl-to-json-schema
Version:
Parse and convert SQL DDL statements to a JSON Schema.
39 lines (38 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColumnReferenceOn = void 0;
/**
* Column reference's 'on' triggers of column actions.
*/
class ColumnReferenceOn {
trigger;
action;
/**
* Creates column reference "on" trigger from object.
* Object must contain properties 'trigger' and 'action'.
*
* @param json JSON format parsed from SQL.
*/
static fromObject(json) {
const onInstance = new ColumnReferenceOn();
onInstance.action = json.action.toLowerCase();
onInstance.trigger = json.trigger.toLowerCase();
return onInstance;
}
/**
* JSON casting of this object calls this method.
*/
toJSON() {
return {
trigger: this.trigger,
action: this.action,
};
}
/**
* Create a deep clone of this model.
*/
clone() {
return ColumnReferenceOn.fromObject(this);
}
}
exports.ColumnReferenceOn = ColumnReferenceOn;