import { EntityManager } from '../EntityManager'; import { EntityData, EntityName, AnyEntity, Primary, Populate, Loaded, New, FilterQuery } from '../typings'; import { QueryOrderMap } from '../enums'; import { FindOneOptions, FindOneOrFailOptions, FindOptions } from '../drivers/IDatabaseDriver'; import { IdentifiedReference } from './Reference'; export declare class EntityRepository> { protected readonly em: EntityManager; protected readonly entityName: EntityName; constructor(em: EntityManager, entityName: EntityName); persist(entity: AnyEntity | AnyEntity[]): EntityManager; persistAndFlush(entity: AnyEntity | AnyEntity[]): Promise; /** * @deprecated use `persist()` */ persistLater(entity: AnyEntity | AnyEntity[]): void; findOne

= any>(where: FilterQuery, populate?: P, orderBy?: QueryOrderMap): Promise | null>; findOne

= any>(where: FilterQuery, populate?: FindOneOptions, orderBy?: QueryOrderMap): Promise | null>; findOneOrFail

= any>(where: FilterQuery, populate?: P, orderBy?: QueryOrderMap): Promise>; findOneOrFail

= any>(where: FilterQuery, populate?: FindOneOrFailOptions, orderBy?: QueryOrderMap): Promise>; find

= any>(where: FilterQuery, options?: FindOptions): Promise[]>; find

= any>(where: FilterQuery, populate?: P, orderBy?: QueryOrderMap, limit?: number, offset?: number): Promise[]>; findAndCount

= any>(where: FilterQuery, options?: FindOptions): Promise<[Loaded[], number]>; findAndCount

= any>(where: FilterQuery, populate?: P, orderBy?: QueryOrderMap, limit?: number, offset?: number): Promise<[Loaded[], number]>; findAll

= any>(options?: FindOptions): Promise[]>; findAll

= any>(populate?: P, orderBy?: QueryOrderMap, limit?: number, offset?: number): Promise[]>; remove(entity: AnyEntity): EntityManager; removeAndFlush(entity: AnyEntity): Promise; /** * @deprecated use `remove()` */ removeLater(entity: AnyEntity): void; flush(): Promise; nativeInsert(data: EntityData): Promise>; nativeUpdate(where: FilterQuery, data: EntityData): Promise; nativeDelete(where: FilterQuery | any): Promise; map(result: EntityData): T; /** * Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded */ getReference(id: Primary, wrapped: true): IdentifiedReference; getReference(id: Primary): T; getReference(id: Primary, wrapped: false): T; canPopulate(property: string): boolean; populate

>(entities: T, populate: P, where?: FilterQuery, orderBy?: QueryOrderMap, refresh?: boolean, validate?: boolean): Promise>; populate

>(entities: T[], populate: P, where?: FilterQuery, orderBy?: QueryOrderMap, refresh?: boolean, validate?: boolean): Promise[]>; populate

>(entities: T | T[], populate: P, where?: FilterQuery, orderBy?: QueryOrderMap, refresh?: boolean, validate?: boolean): Promise | Loaded[]>; /** * Creates new instance of given entity and populates it with given data */ create

= string[]>(data: EntityData): New; /** * Shortcut for `wrap(entity).assign(data, { em })` */ assign(entity: T, data: EntityData): T; count(where?: FilterQuery): Promise; }