UNPKG

1.94 kBTypeScriptView Raw
1import { EmbeddedMetadata } from "./EmbeddedMetadata";
2import { EntityMetadata } from "./EntityMetadata";
3import { NamingStrategyInterface } from "../naming-strategy/NamingStrategyInterface";
4import { ColumnMetadata } from "./ColumnMetadata";
5import { UniqueMetadataArgs } from "../metadata-args/UniqueMetadataArgs";
6/**
7 * Unique metadata contains all information about table's unique constraints.
8 */
9export declare class UniqueMetadata {
10 /**
11 * Entity metadata of the class to which this unique constraint is applied.
12 */
13 entityMetadata: EntityMetadata;
14 /**
15 * Embedded metadata if this unique was applied on embedded.
16 */
17 embeddedMetadata?: EmbeddedMetadata;
18 /**
19 * Target class to which metadata is applied.
20 */
21 target?: Function | string;
22 /**
23 * Unique columns.
24 */
25 columns: ColumnMetadata[];
26 /**
27 * User specified unique constraint name.
28 */
29 givenName?: string;
30 /**
31 * User specified column names.
32 */
33 givenColumnNames?: ((object?: any) => (any[] | {
34 [key: string]: number;
35 })) | string[];
36 /**
37 * Final unique constraint name.
38 * If unique constraint name was given by a user then it stores normalized (by naming strategy) givenName.
39 * If unique constraint name was not given then its generated.
40 */
41 name: string;
42 /**
43 * Map of column names with order set.
44 * Used only by MongoDB driver.
45 */
46 columnNamesWithOrderingMap: {
47 [key: string]: number;
48 };
49 constructor(options: {
50 entityMetadata: EntityMetadata;
51 embeddedMetadata?: EmbeddedMetadata;
52 columns?: ColumnMetadata[];
53 args?: UniqueMetadataArgs;
54 });
55 /**
56 * Builds some depend unique constraint properties.
57 * Must be called after all entity metadata's properties map, columns and relations are built.
58 */
59 build(namingStrategy: NamingStrategyInterface): this;
60}
61
\No newline at end of file