@witty-services/repository-core
TypeScript icon, indicating that this package has built-in type declarations

1.1.0-rc.1 • Public • Published

Repository Core

Build Status Coverage Status npm version NPM GitHub repo size GitHub last commit GitHub issues GitHub top language

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> { 
}

Readme

Keywords

none

Package Sidebar

Install

npm i @witty-services/repository-core

Weekly Downloads

1

Version

1.1.0-rc.1

License

MIT

Unpacked Size

50.8 kB

Total Files

56

Last publish

Collaborators

  • lexwitty
  • thomasnisole
  • rmartineau
  • corentin.langlais
  • oguerin