@knestjs/core
Version:
Knestjs search to be a Nestjs ORM in which you write the models once and only once. This is done creating migrations automatically from the models that you create.
21 lines • 999 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColumnNotNull = exports.ColumnNullable = exports.Column = void 0;
const constants_1 = require("../constants");
const Column = (config) => (target, property) => {
const columns = Reflect.getMetadata(constants_1.KNEST_COLUMNS_INFO, target.constructor) ?? [];
if (columns.findIndex((p) => p.property === property) >= 0) {
throw new Error(`A property cannot be decorated two times, check ${target.name}.${property}`);
}
columns.push({
...config,
property
});
Reflect.defineMetadata(constants_1.KNEST_COLUMNS_INFO, columns, target.constructor);
};
exports.Column = Column;
const ColumnNullable = (config) => (0, exports.Column)({ ...config, nullable: true });
exports.ColumnNullable = ColumnNullable;
const ColumnNotNull = (config) => (0, exports.Column)({ ...config, nullable: false });
exports.ColumnNotNull = ColumnNotNull;
//# sourceMappingURL=column.decorator.js.map