Skip to main content
Module

x/typeorm/src/repository/AbstractRepository.ts>AbstractRepository

Forked from https://github.com/typeorm/typeorm
Latest
class AbstractRepository
import { AbstractRepository } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/repository/AbstractRepository.ts";

Provides abstract class for custom repositories that do not inherit from original orm Repository. Contains all most-necessary methods to simplify code in the custom repository. All methods are protected thus not exposed and it allows to create encapsulated custom repository.

Type Parameters

Entity extends ObjectLiteral

Properties

protected
manager: EntityManager

Gets entity manager that allows to perform repository operations with any entity.

protected
readonly
repository: Repository<Entity>

Gets the original ORM repository for the entity that is managed by this repository. If current repository does not manage any entity, then exception will be thrown.

protected
readonly
treeRepository: TreeRepository<Entity>

Gets the original ORM tree repository for the entity that is managed by this repository. If current repository does not manage any entity, then exception will be thrown.

Methods

private
getCustomRepositoryTarget(customRepository: any):
| Function
| string
| EntitySchema<any>
| undefined

Gets custom repository's managed entity. If given custom repository does not manage any entity then undefined will be returned.

protected
createQueryBuilder(alias: string): SelectQueryBuilder<Entity>

Creates a new query builder for the repository's entity that can be used to build a sql query. If current repository does not manage any entity, then exception will be thrown.

protected
createQueryBuilderFor<T>(entity: ObjectType<T>, alias: string): SelectQueryBuilder<T>

Creates a new query builder for the given entity that can be used to build a sql query.

protected
getRepositoryFor<T>(entity: ObjectType<T>): Repository<T>

Gets the original ORM repository for the given entity class.

protected
getTreeRepositoryFor<T>(entity: ObjectType<T>): TreeRepository<T>

Gets the original ORM tree repository for the given entity class.