-
Notifications
You must be signed in to change notification settings - Fork 0
/
primary-entity-manager.ts
36 lines (33 loc) · 1.05 KB
/
primary-entity-manager.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
import { Entity } from '../../model/entity';
import { Model } from '../../model/model';
import { PersistencySearchOptions } from './options/persistency-search-options';
export interface PrimaryEntityManagerBase<TEntity extends Entity> {
/**
* Gets a model by its id.
* @param id: Model's id.
* @param options Cache options.
* @returns Model found.
*/
get(id: number | string, options?: PersistencySearchOptions): Promise<TEntity>;
/**
* Gets a collection of models by its ids.
* @param ids Model ids.
* @param options Cache options.
* @returns Models found.
*/
mGet(ids: number[] | string[], options?: PersistencySearchOptions): Promise<TEntity[]>;
}
/**
* Represents a manager able to obtain entities by ids.
*/
export interface PrimaryEntityManager<TEntity extends Entity> extends PrimaryEntityManagerBase<TEntity> {
/**
* Model of the manager.
*/
readonly model: Model<TEntity>;
/**
* Gets the lua key generator from id.
* @returns Lua key generator
*/
getLuaKeyGeneratorFromId(): (alias: string) => string;
}