@thirdmadman/in-memory-db
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

in-memory-db

Simple implementation of In-memory DB.

Installation

Using npm:

npm i @thirdmadman/in-memory-db

Description

Typescript, zero dependencies, compact.

Technically, it's Map<string, Array<AbstractEntity>>, 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

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

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

const db = new GenericInMemoryDB<typeof dbSchema>(dbSchema);

const userRepository = new GenericRepository<typeof dbSchema, UserEntity>(db, 'user');

Readme

Keywords

none

Package Sidebar

Install

npm i @thirdmadman/in-memory-db

Weekly Downloads

1

Version

1.0.3

License

GPL-3.0-or-later

Unpacked Size

68.1 kB

Total Files

12

Last publish

Collaborators

  • thirdmadman