Skip to main content
Deno 2 is finally here 🎉️
Learn more

kv_storage

An optimized key-value storage based on sqlite.

How to use

import { LocalStorage, storage } from "https://deno.land/x/kv_storage/mod.ts";
//INSERT
await storage.set("some_key", { param1: "value1" });
//this is different from (key is not object path!):
await storage.set("some_key.param1", "value1");
//GET
const res = await storage.get("some_key");
//DELETE
const res = await storage.delete("some_key2");
//GET LIST (You can define namespaces, for example: "user1.name", "user1.id").
await storage.set("user1.name", "joe");
await storage.set("user1.id", "214837483");
const user = await storage.getList("user1."); //return user1.name and user1.id
//DELETE LIST
await storage.deleteList("shop1.");

The variable storage is an instance of LocalStorage with: path=”./db.sqlite”, tableName = “LOCAL_STORAGE”.

About

Author: Henrique Emanoel Viana, a Brazilian computer scientist, enthusiast of web technologies, cel: +55 (41) 99999-4664. URL: https://sites.google.com/site/henriqueemanoelviana

Improvements and suggestions are welcome!