UNPKG

913 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var __1 = require("../");
4/**
5 * Marks a column to generate a value on entity insertion.
6 * There are three types of generation strategy - increment, uuid and rowid (cockroachdb only).
7 * Increment uses a number which increases by one on each insertion.
8 * Uuid generates a special UUID token.
9 * Rowid supports only in CockroachDB and uses `unique_rowid()` function
10 *
11 * Note, some databases do not support non-primary generation columns.
12 */
13function Generated(strategy) {
14 if (strategy === void 0) { strategy = "increment"; }
15 return function (object, propertyName) {
16 __1.getMetadataArgsStorage().generations.push({
17 target: object.constructor,
18 propertyName: propertyName,
19 strategy: strategy
20 });
21 };
22}
23exports.Generated = Generated;
24
25//# sourceMappingURL=Generated.js.map