Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/thirdmadman/in-memory-db
- Owner: thirdmadman
- License: gpl-3.0
- Created: 2023-09-25T19:19:30.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-27T14:30:27.000Z (over 1 year ago)
- Last Synced: 2024-08-11T00:28:39.222Z (5 months ago)
- Language: TypeScript
- Size: 66.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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');
```