Skip to main content

Class: BaseRepository<EntityType, EntityInputType>

backend.BaseRepository

Type parameters#

NameType
EntityTypeEntityType
EntityInputTypeEntityType

Hierarchy#

Table of contents#

Constructors#

Properties#

Methods#

Constructors#

constructor#

• new BaseRepository<EntityType, EntityInputType>(EntityClass)

Type parameters#

NameType
EntityTypeEntityType
EntityInputTypeEntityType

Parameters#

NameType
EntityClass(...args: any[]) => EntityType & { id?: number }

Overrides#

Repository<EntityType\>.constructor

Defined in#

system/core/backend/src/repositories/base.repository.ts:26

Properties#

dbType#

• dbType: "mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"

Defined in#

system/core/backend/src/repositories/base.repository.ts:24

Methods#

applyBaseFilter#

â–¸ applyBaseFilter<EntityType>(qb, filter?): SelectQueryBuilder<EntityType>

Type parameters#

NameType
EntityTypeTBasePageEntity

Parameters#

NameType
qbSelectQueryBuilder<EntityType>
filter?BaseFilterInput

Returns#

SelectQueryBuilder<EntityType>

Defined in#

system/core/backend/src/repositories/base.repository.ts:155


applyDeleteMany#

â–¸ applyDeleteMany(qb, input): Promise<void>

Parameters#

NameType
qbSelectQueryBuilder<EntityType> | DeleteQueryBuilder<EntityType>
inputTDeleteManyInput

Returns#

Promise<void>

Defined in#

system/core/backend/src/repositories/base.repository.ts:108


applyGetEntityViews#

â–¸ applyGetEntityViews(qb, entityType): SelectQueryBuilder<TBasePageEntity>

Parameters#

NameType
qbSelectQueryBuilder<TBasePageEntity>
entityTypeEDBEntity

Returns#

SelectQueryBuilder<TBasePageEntity>

Defined in#

system/core/backend/src/repositories/base.repository.ts:133


createEntity#

â–¸ createEntity(input, id?): Promise<EntityType>

Parameters#

NameType
inputEntityInputType
id?null | number

Returns#

Promise<EntityType>

Defined in#

system/core/backend/src/repositories/base.repository.ts:70


deleteEntity#

â–¸ deleteEntity(id): Promise<boolean>

Parameters#

NameType
idnumber

Returns#

Promise<boolean>

Defined in#

system/core/backend/src/repositories/base.repository.ts:97


deleteMany#

â–¸ deleteMany(input): Promise<boolean>

Parameters#

NameType
inputTDeleteManyInput

Returns#

Promise<boolean>

Defined in#

system/core/backend/src/repositories/base.repository.ts:125


getAll#

â–¸ getAll(): Promise<EntityType[]>

Returns#

Promise<EntityType[]>

Defined in#

system/core/backend/src/repositories/base.repository.ts:44


getById#

â–¸ getById(id, relations?): Promise<EntityType>

Parameters#

NameType
idnumber
relations?string[]

Returns#

Promise<EntityType>

Defined in#

system/core/backend/src/repositories/base.repository.ts:49


getBySlug#

â–¸ getBySlug(slug, relations?): Promise<EntityType>

Parameters#

NameType
slugstring
relations?string[]

Returns#

Promise<EntityType>

Defined in#

system/core/backend/src/repositories/base.repository.ts:60


getEntityViews#

â–¸ getEntityViews(entityId, entityType): Promise<any>

Parameters#

NameType
entityIdnumber
entityTypeEDBEntity

Returns#

Promise<any>

Defined in#

system/core/backend/src/repositories/base.repository.ts:144


getFilteredEntities#

â–¸ getFilteredEntities(pagedParams?, filterParams?): Promise<TPagedList<EntityType>>

Parameters#

NameType
pagedParams?PagedParamsInput<EntityType>
filterParams?BaseFilterInput

Returns#

Promise<TPagedList<EntityType>>

Defined in#

system/core/backend/src/repositories/base.repository.ts:164


getPaged#

â–¸ getPaged(params?): Promise<TPagedList<EntityType>>

Parameters#

NameType
params?TPagedParams<EntityType>

Returns#

Promise<TPagedList<EntityType>>

Defined in#

system/core/backend/src/repositories/base.repository.ts:38


getSqlBoolStr#

â–¸ getSqlBoolStr(b): "true" | "false" | "1" | "0"

Parameters#

NameType
bboolean

Returns#

"true" | "false" | "1" | "0"

Defined in#

system/core/backend/src/repositories/base.repository.ts:34


getSqlLike#

â–¸ getSqlLike(): "ILIKE" | "LIKE"

Returns#

"ILIKE" | "LIKE"

Defined in#

system/core/backend/src/repositories/base.repository.ts:35


quote#

â–¸ quote(str): string

Parameters#

NameType
strstring

Returns#

string

Defined in#

system/core/backend/src/repositories/base.repository.ts:36


updateEntity#

â–¸ updateEntity(id, input): Promise<EntityType>

Parameters#

NameType
idnumber
inputEntityInputType

Returns#

Promise<EntityType>

Defined in#

system/core/backend/src/repositories/base.repository.ts:82