/
FindOneOptions.ts
52 lines (42 loc) · 1.49 KB
/
FindOneOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {JoinOptions} from "./JoinOptions";
import {ObjectLiteral} from "../common/ObjectLiteral";
import {FindConditions} from "./FindConditions";
/**
* Defines a special criteria to find specific entity.
*/
export interface FindOneOptions<Entity = any> {
/**
* Specifies what columns should be retrieved.
*/
select?: (keyof Entity)[];
/**
* Simple condition that should be applied to match entities.
*/
where?: FindConditions<Entity>|ObjectLiteral|string;
/**
* Indicates what relations of entity should be loaded (simplified left join form).
*/
relations?: string[];
/**
* Specifies what relations should be loaded.
*/
join?: JoinOptions;
/**
* Order, in which entities should be ordered.
*/
order?: { [P in keyof Entity]?: "ASC"|"DESC"|1|-1 };
/**
* Enables or disables query result caching.
*/
cache?: boolean | number | { id: any, milliseconds: number };
/**
* If sets to true then loads all relation ids of the entity and maps them into relation values (not relation objects).
* If array of strings is given then loads only relation ids of the given properties.
*/
loadRelationIds?: boolean|{ relations?: string[], disableMixedMap?: boolean }; // todo: extract options into separate interface, reuse
/**
* Indicates if eager relations should be loaded or not.
* By default they are loaded when find methods are used.
*/
loadEagerRelations?: boolean;
}