mp-holistic
Version:
si prefigge l'umile compito di aiutare nella creazione di : - un server API REST mediante express - un semplice ORM per Postgres Questo tramite decoratori o classi particolari.
22 lines • 832 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Constraint = void 0;
class Constraint {
constructor(item) {
this.unique = item.unique;
this.check = item.check;
this.notNull = item.notNull;
}
CostruisciConstraint(nomeClasse) {
let ritorno = '';
if (this.unique)
ritorno = ritorno + ' CONSTRAINT ' + '"' + 'cn_' + nomeClasse + '_' + this.unique.nome + '"' + ' UNIQUE';
if (this.notNull)
ritorno = ritorno + ' NOT NULL';
if (this.check)
ritorno = ritorno + ' CONSTRAINT ' + '"' + 'cn_ck_' + nomeClasse + '_' + this.check.nome + '"' + ' CHECK(' + this.check.check + ')';
return ritorno;
}
}
exports.Constraint = Constraint;
//# sourceMappingURL=constraint.js.map