@witty-services/repository-core
v1.1.0-rc.1
Published
Type repository core library
Downloads
5
Keywords
Readme
Repository Core
This Typescript library allow you to define multiple repositories base on multiple decorated models.
Use this abstract library to make your own driver and use your differents repositories to retrieve data from your data source.
How to install
To install the library run :
npm i @witty-services/repository-core
How to run Unit Tests
To run unit tests and generate coverage, run :
npm run test
How to make a driver
This extract of code is an example of how to implements a driver repository.
import {AbstractRepository, Denormalizer, Normalizer} from '@witty-services/repository-core';
export abstract class MyDriverRepository<T, K = string, P = null> extends AbstractRepository<T, K, P> {
public constructor(denormalizer: Denormalizer<T>, normalizer: Normalizer<T>) {
super(denormalizer, normalizer);
// ...
}
// implements all functions
}
Use your driver
This extract of code is an example of how to use your driver.
import {Repository} from '@witty-services/repository-core';
import {MyDriverRepository} from '...';
import {MyModel} from './my-model.model.ts';
export interface MyModelRepositoryParams {
// ...
}
@Repostiory({
})
export class MyModelRepository extends MyDriverRepository<MyModel, string, MyModelRepositoryParams> {
}