UNPKG

@ossareh/typeorm

Version:

Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.

67 lines (65 loc) 2.28 kB
var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spread = (this && this.__spread) || function () { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; }; /** * Database's table check constraint stored in this class. */ var TableCheck = /** @class */ (function () { // ------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------- function TableCheck(options) { /** * Column that contains this constraint. */ this.columnNames = []; this.name = options.name; this.columnNames = options.columnNames; this.expression = options.expression; } // ------------------------------------------------------------------------- // Public Methods // ------------------------------------------------------------------------- /** * Creates a new copy of this constraint with exactly same properties. */ TableCheck.prototype.clone = function () { return new TableCheck({ name: this.name, columnNames: this.columnNames ? __spread(this.columnNames) : [], expression: this.expression, }); }; // ------------------------------------------------------------------------- // Static Methods // ------------------------------------------------------------------------- /** * Creates checks from the check metadata object. */ TableCheck.create = function (checkMetadata) { return new TableCheck({ name: checkMetadata.name, expression: checkMetadata.expression }); }; return TableCheck; }()); export { TableCheck }; //# sourceMappingURL=TableCheck.js.map