simple-github-db

1.1.0 • Public • Published

A simpe key value store using Github.

All Contributors

Install

npm install simple-github-db

Usage

Create database

(async function(){
    try {
        await GithubDb.createDatabase(<DATABASE_NAME>,<TOKEN>)
        await test();
    } catch (error) {
        console.error(error);
    }
})()

CRUD Operation

async function test(){
    const db= GithubDb({db:<DATABASE_NAME>,token:<TOKEN>}); 
 
+   const {identifier}=await db.add({document:"user"},{name:"John"});
    console.log("added user", identifier);
    
+   const user=await db.fetchOne({document:"user",identifier});
    console.log("fetched user", user);
 
+   const updated=await db.update({document:"user",identifier},{name:"John Cena"});
    console.log("updated user", updated);
    
+   const users=await db.fetchAll({document:"user"});
    console.log("fetched users", users);
    for (const {identifier} of users) {
+       const result=await db.delete({document:"user",identifier});
        console.log("delete users", result);
    }
}  
 
(async function(){
    try {
        await test();
    } catch (error) {
        console.error(error);
    }
})()

Warning

Meant to be used for side-projects, it doesn't scale or fulfil a fully-fledged database needs.

like it?

⭐️ this repo

Contributors ✨

Thanks goes to these wonderful people (emoji key):

anotherjsguy
anotherjsguy

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Readme

Keywords

none

Package Sidebar

Install

npm i simple-github-db

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

8.22 kB

Total Files

9

Last publish

Collaborators

  • kuldeepkeshwar