KV-Store is a simple key-value store command-line application built in Go. It allows users to store, retrieve, and manage key-value pairs with ease.
- Put: Store a key-value pair in the store.
- Get: Retrieve a key-value pair from the store based on the key.
- Delete: Remove a key-value pair from the store based on the key.
- Job: Can run this in the background to delete expired keys.
- Version: Display the current version of the KV-Store application.
Before you begin, ensure you have met the following requirements:
- Go 1.15 or later
- PostgreSQL database
To install KV-Store, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/kv-store.git
-
Change directory to the project root:
cd kv-store
-
Build the application:
go build -o kv-store .
Before running KV-Store, you need to configure the database connection. This is done by setting the DATABASE_URL
environment variable in a .env
file in the project root directory.
-
Create a
.env
file in the root directory. -
Add the following line to the
.env
file:DATABASE_URL=postgres://username:password@localhost:5432/kvstore?sslmode=disable
Replace
username
andpassword
with your PostgreSQL username and password, respectively. -
Save the
.env
file.
To use KV-Store, follow these steps:
-
Put a key-value pair in the store:
./kv-store PUT key value
-
Retrieve a key-value pair from the store:
./kv-store GET key
-
Run the job to delete expired keys:
./kv-store job
Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.