1.0.3 • Published 2 years ago

@thirdmadman/in-memory-db v1.0.3

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

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');
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago