Page Contents
Home > @loopback/repository > CrudRepositoryImpl
CrudRepositoryImpl class
Repository implementation
Signature:
export declare class CrudRepositoryImpl<T extends Entity, ID> implements EntityCrudRepository<T, ID>
Implements: EntityCrudRepository<T, ID>
Example
User can import CrudRepositoryImpl
and call its functions like: CrudRepositoryImpl.find(somefilters, someoptions)
Or extend class CrudRepositoryImpl
and override its functions:
export class TestRepository extends CrudRepositoryImpl<Test> {
constructor(dataSource: DataSource, model: Test) {
super(dataSource, Customer);
}
// Override `deleteAll` to disable the operation
deleteAll(where?: Where, options?: Options) {
return Promise.reject(new Error('deleteAll is disabled'));
}
}
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(dataSource, entityClass) | Constructs a new instance of the CrudRepositoryImpl class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
dataSource | DataSource | ||
entityClass | typeof Entity & { prototype: T; } | ||
inclusionResolvers | Map<string, InclusionResolver<T, Entity>> |