Page Contents

Home > @loopback/rest-crud > defineCrudRepositoryClass

defineCrudRepositoryClass() function

Create (define) a repository class for the given model.

Example usage:

const ProductRepository = defineCrudRepositoryClass(Product);

Signature:

export declare function defineCrudRepositoryClass<T extends Entity, IdType, Relations extends object = {}>(entityClass: typeof Entity & {
    prototype: T;
}): RepositoryClass<T, IdType, Relations>;

Parameters

Parameter Type Description
entityClass typeof Entity & {
prototype: T;
}
 

Returns:

RepositoryClass<T, IdType, Relations>