UNPKG

3.1 kBTypeScriptView Raw
1import { EntityMetadata } from "./EntityMetadata";
2import { IndexMetadataArgs } from "../metadata-args/IndexMetadataArgs";
3import { NamingStrategyInterface } from "../naming-strategy/NamingStrategyInterface";
4import { ColumnMetadata } from "./ColumnMetadata";
5import { EmbeddedMetadata } from "./EmbeddedMetadata";
6/**
7 * Index metadata contains all information about table's index.
8 */
9export declare class IndexMetadata {
10 /**
11 * Entity metadata of the class to which this index is applied.
12 */
13 entityMetadata: EntityMetadata;
14 /**
15 * Embedded metadata if this index was applied on embedded.
16 */
17 embeddedMetadata?: EmbeddedMetadata;
18 /**
19 * Indicates if this index must be unique.
20 */
21 isUnique: boolean;
22 /**
23 * The SPATIAL modifier indexes the entire column and does not allow indexed columns to contain NULL values.
24 * Works only in MySQL.
25 */
26 isSpatial: boolean;
27 /**
28 * The FULLTEXT modifier indexes the entire column and does not allow prefixing.
29 * Works only in MySQL.
30 */
31 isFulltext: boolean;
32 /**
33 * Indicates if this index must synchronize with database index.
34 */
35 synchronize: boolean;
36 /**
37 * If true, the index only references documents with the specified field.
38 * These indexes use less space but behave differently in some situations (particularly sorts).
39 * This option is only supported for mongodb database.
40 */
41 isSparse?: boolean;
42 /**
43 * Builds the index in the background so that building an index an does not block other database activities.
44 * This option is only supported for mongodb database.
45 */
46 isBackground?: boolean;
47 /**
48 * Specifies a time to live, in seconds.
49 * This option is only supported for mongodb database.
50 */
51 expireAfterSeconds?: number;
52 /**
53 * Target class to which metadata is applied.
54 */
55 target?: Function | string;
56 /**
57 * Indexed columns.
58 */
59 columns: ColumnMetadata[];
60 /**
61 * User specified index name.
62 */
63 givenName?: string;
64 /**
65 * User specified column names.
66 */
67 givenColumnNames?: ((object?: any) => (any[] | {
68 [key: string]: number;
69 })) | string[];
70 /**
71 * Final index name.
72 * If index name was given by a user then it stores normalized (by naming strategy) givenName.
73 * If index name was not given then its generated.
74 */
75 name: string;
76 /**
77 * Index filter condition.
78 */
79 where?: string;
80 /**
81 * Map of column names with order set.
82 * Used only by MongoDB driver.
83 */
84 columnNamesWithOrderingMap: {
85 [key: string]: number;
86 };
87 constructor(options: {
88 entityMetadata: EntityMetadata;
89 embeddedMetadata?: EmbeddedMetadata;
90 columns?: ColumnMetadata[];
91 args?: IndexMetadataArgs;
92 });
93 /**
94 * Builds some depend index properties.
95 * Must be called after all entity metadata's properties map, columns and relations are built.
96 */
97 build(namingStrategy: NamingStrategyInterface): this;
98}
99
\No newline at end of file