Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thirdmadman/in-memory-db

Simple implementation of In-memory DB
https://github.com/thirdmadman/in-memory-db

Last synced: about 2 months ago
JSON representation

Simple implementation of In-memory DB

Awesome Lists containing this project

README

        

# in-memory-db

Simple implementation of In-memory DB.

## Installation

Using npm:

``` bash
npm i @thirdmadman/in-memory-db
```

## Description

Typescript, zero dependencies, compact.

Technically, it's ```Map>```, but with simple access methods.

All magic happens with usage of TypeScript - this implementation will guard you from using wrong types.

Additionally, you can provide your own function for generating global ids.

## How to use

``` typescript

interface UserEntity extends AbstractEntity {
id: string;
name: string;
password: string;
}

const dbSchema = {
user: Array(),
};

const db = new GenericInMemoryDB(dbSchema);

const userRepository = new GenericRepository(db, 'user');
```