https://github.com/kuldeepkeshwar/simple-github-db
A simpe key value store using Github.
https://github.com/kuldeepkeshwar/simple-github-db
database github-database key-value
Last synced: 4 months ago
JSON representation
A simpe key value store using Github.
- Host: GitHub
- URL: https://github.com/kuldeepkeshwar/simple-github-db
- Owner: kuldeepkeshwar
- License: mit
- Created: 2019-07-16T12:41:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-05T12:11:14.000Z (over 4 years ago)
- Last Synced: 2024-04-23T23:55:34.539Z (about 1 year ago)
- Topics: database, github-database, key-value
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# A simpe key value store using Github.
[](#contributors)## Install
`npm install simple-github-db`
## Usage#### Create database
```
(async function(){
try {
await GithubDb.createDatabase(,)
await test();
} catch (error) {
console.error(error);
}
})()```
#### CRUD Operation
```diff
async function test(){
const db= GithubDb({db:,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](https://allcontributors.org/docs/en/emoji-key)):
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!