https://github.com/yashvardhan-kukreja/go-persistence
A friendly CLI providing you a bucket-based persistent key-value store, backed by Go :)
https://github.com/yashvardhan-kukreja/go-persistence
Last synced: 3 months ago
JSON representation
A friendly CLI providing you a bucket-based persistent key-value store, backed by Go :)
- Host: GitHub
- URL: https://github.com/yashvardhan-kukreja/go-persistence
- Owner: yashvardhan-kukreja
- Created: 2020-03-23T22:25:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T07:00:42.000Z (about 5 years ago)
- Last Synced: 2024-12-27T10:28:21.235Z (5 months ago)
- Language: Go
- Homepage:
- Size: 1.23 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-persistence
## Introduction:
A friendly CLI to provide you a bucket-based persistent key-value store
It stores key-value pairs in dedicated buckets.
So, you can have two key-value pairs with same key name but in different buckets.
For example, there can be a bucket named "Alex" where there is a key-value pair -> (**"name"**, "Alex")
And there can be a bucket named "Bob" where there is a key-value pair -> (**"name"**, "Bob")------
## Pre-requisites:
Please have "go" installed in your computer. That's it!------
## How to set it up:
- Download the github repo with the following command:
```git clone https://www.github.com/yashvardhan-kukreja/go-persistence```
- Then, run the following command:
```bash commander.sh```- And, that's it !
-----
## How to run it:
The command expects one of the following operations:
- **create-bucket** -> Operation for creating a bucket
- **delete-bucket** -> Operation for removing/deleting a bucket with all its contents
- **add-key** -> Operation for adding a key-value pair to a bucket
- **remove-key** -> Operation for removing a key from a bucket
- **get-value** -> Operation for fetching a key-value from a bucket by the provided keyname
The command expects the following fields on the basis of the respective operation:
- **bucket-name** -> The name of the bucket you are performing operation on
- **key** -> Name of the key (in the bucket) you are performing operation on
- **value** -> Value of a key for which you want add a key-value pair**Some Examples command:**
Creating a bucket
```
► go-persistence --create-bucket --bucket-name b
Created a bucket with the name: b
```Adding a key-value pair from a bucket
```
► go-persistence --add-key --bucket-name b --key name --value yash
For the bucket: b
Added key: name AND value: yash
```Removing a key-value pair from a bucket
```
► go-persistence --remove-key --bucket-name b --key name --value yash1
From the bucket: b
Removed the key: name
```Trying to remove a key-value pair for which the key does not exist
```
► go-persistence --remove-key --bucket-name b --key name --value yash1
2020/03/24 03:54:30 Key not found in the database
```Deleting a bucket
```
► go-persistence --delete-bucket --bucket-name b
Deleted the bucket with the name: b
```-----