UNPKG

1.68 kBTypeScriptView Raw
1import { RelationIdMetadataArgs } from "../metadata-args/RelationIdMetadataArgs";
2import { EntityMetadata } from "./EntityMetadata";
3import { RelationMetadata } from "./RelationMetadata";
4import { SelectQueryBuilder } from "../query-builder/SelectQueryBuilder";
5import { ObjectLiteral } from "../common/ObjectLiteral";
6/**
7 * Contains all information about entity's relation count.
8 */
9export declare class RelationIdMetadata {
10 /**
11 * Entity metadata where this column metadata is.
12 */
13 entityMetadata: EntityMetadata;
14 /**
15 * Relation from which ids will be extracted.
16 */
17 relation: RelationMetadata;
18 /**
19 * Relation name which need to count.
20 */
21 relationNameOrFactory: string | ((object: any) => any);
22 /**
23 * Target class to which metadata is applied.
24 */
25 target: Function | string;
26 /**
27 * Target's property name to which this metadata is applied.
28 */
29 propertyName: string;
30 /**
31 * Alias of the joined (destination) table.
32 */
33 alias?: string;
34 /**
35 * Extra condition applied to "ON" section of join.
36 */
37 queryBuilderFactory?: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>;
38 constructor(options: {
39 entityMetadata: EntityMetadata;
40 args: RelationIdMetadataArgs;
41 });
42 /**
43 * Sets relation id value from the given entity.
44 *
45 * todo: make it to work in embeds as well.
46 */
47 setValue(entity: ObjectLiteral): void;
48 /**
49 * Builds some depend relation id properties.
50 * This builder method should be used only after entity metadata, its properties map and all relations are build.
51 */
52 build(): void;
53}