Skip to content

aminnairi/microdatabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@aminnairi/microdatabase

Installation

npm install aminnairi/microdatabase

Usage

import { InMemoryPersistence, createDatabase } from "../src";
import { randomUUID } from "crypto";

type Database = {
  users: {
    id: string,
    email: string,
    username: string
  }
}

const { persist, all, add } = await createDatabase<Database>({
  persistence: new InMemoryPersistence<Database>({
    users: []
  })
});

add({
  table: "users",
  data: {
    id: randomUUID(),
    email: "[email protected]",
    username: "user123"
  }
});

const users = all({
  table: "users"
});

console.log(users);

await persist();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks