✨Database powered by localStorage
npm i @reliutg/lsdb
no npm install needed!
<script type="module">
import Lsdb from 'https://cdn.skypack.dev/@reliutg/lsdb';
</script>
const lsdb = new Lsdb('dbname')
lsdb.collection(["categories", "articles"]);
lsdb.insert("categories", { title: "Drinks" });
lsdb.insert("categories", { title: "Dinner" });
Get all collections
lsdb.all();
// {categories: Array(2), articles: Array(0)}
Get a list of documents matching the query
lsdb.find("categories", {
where: {
title: { $in: ["er"] },
},
});
/*
* [{…}]
* 0:
* title: "Dinner"
* _id: // generated id
*/
Get a single document matching the query
lsdb.findOne("categories", {
where: {
_id: { $eq: id },
},
}); // {_id: // generated id, title: "Dinner"}
Remove a single document matching the query
lsdb.delete("categories", {
where: {
_id: { $eq: id },
},
});
Thanks goes to these wonderful people (emoji key):
Aneesh Relan |
Zymantas Maumevicius 🚇 💻 |
Nitkalya Wiriyanuparb |
Connor Ruggles 🚇 💻 |
MAKSS 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!