Skip to content
/ localDb Public

An abstraction layer repository interface for performing CRUD operations using the browser's LocalStorage API as a database.

License

Notifications You must be signed in to change notification settings

Akin01/localDb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LocalDB

LocalDB is a lightweight database abstraction layer that provides a repository interface for performing CRUD (Create, Read, Update, Delete) operations using the browser's LocalStorage API as a database.

Features

  • Simple repository interface
  • Persistent storage using LocalStorage
  • CRUD operations support
  • Easy integration with web applications

Installation

deno add jsr:@akin01/localdb

Usage

import { Database } from "@akin01/localdb";

// create a user schema
type User = {
	name: string;
	age: number;
	hobby: string;
	position: string;
};

// Initialize a repository
const userRepository = new Database<User, string>("users");

// Create a user
userRepository.inserOne({
	name: "John Doe",
	age: 30,
	hobby: "reading",
	position: "developer",
});

// Get a user
const user = userRepository.findOne({ name: "John Doe" });

// Update a user
userRepository.updateOne(
	{ name: "John Doe" },
	{ position: "Software Engineer" },
);

// Delete a user
userRepository.delete({ name: "John Doe" });

License

MIT License

Contributing

Feel free to submit issues and pull requests.

About

An abstraction layer repository interface for performing CRUD operations using the browser's LocalStorage API as a database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published