Key-value database stored in memory with option of persistence

Go Store

Key-value memory database with option to persist

image

Ever needed a database in a hurry? Go store could be right for you.


Easy and intuitive command line tool allows you to spin up a database avaliable from web or locally in a few seconds. Server can be run over a custom TCP protocol or over HTTP. Database can be be kept in memory only or persisted to a json file upon exit. You can also spin up a server from an existing file with or without modifying it. This is a hobby project and not meant for production use, but could be useful for testing/development phase.

The CLI tool is powered by cobra


Installation

go install github.com/maracko/go-store

Usage

go-store [command] [argument] --flags

go-store help can be used to get help on commands

Examples


HTTP


go-store server HTTP -p 8888 -l /home/mario/database.json

This command will open and read the json file provided under -l flag and start a HTTP server on -p
You can then send HTTP requests to the server
Logs will be outputed to stdout

2021/05/02 18:54:02 HTTP server started
2021/05/02 18:54:22 GET /go-store?key=aa localhost:8888

Server flags

  • --location -l => location of database file to read from (if blank or not provided a empty database in memory only will be initialised)
  • --port -p => port on which to start the server
  • --memory -m => if present database won't be saved upon exit (even if read from a file first)

HTTP Requests


http://{host}:{port}/go-store?key=key

  • GET => returns key/keys
  • POST => creates a new key
  • PATCH => update existing key
  • DELETE => deletes a key

For retrieving operations a query param key must be set. To retrieve multiple values set multiple keys split with a comma

Example:

GET http://localhost:8888/go-store?key=myKey,myOtherKey,anotherKey

Data

When you want to create/update keys you must send data inside request body in JSON format.

TCP


go-store server TCP -p 8888 -l /home/mario/database.json

2021/05/02 18:57:33 TCP server started
2021/05/02 18:58:09 Accepted connection from [::1]:34126

TCP server supports the same flags as HTTP. To interact with it use the go-store client

go-store client -s localhost -p 9999

Welcome to go-store server!
2021/05/02 18:58:01 Connected to localhost:9999
$:set foo bar
Created new key foo
$:get foo
bar
$:

TCP currently only supports strings for both key and value, a.k.a will do no encoding on them (so no complex types)

TCP Client commands


  • get [key] => returns a single key
  • set [key] [value] => set a new key
  • upd [key] [value] => update existing key
  • del [key] => deletes key

TODO

  • Make TCP client/server support complex types and commands
  • Support HTTPS for HTTP server
  • Add authorization support
  • TODO in comment
  • Other things I will think of
Owner
Mario Petričko
Just coding, chilling
Mario Petričko
Similar Resources

An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

go-cache go-cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine. Its major

Jan 3, 2023

KV - a toy in-memory key value store built primarily in an effort to write more go and check out grpc

KV KV is a toy in-memory key value store built primarily in an effort to write more go and check out grpc. This is still a work in progress. // downlo

Dec 30, 2021

kvStore is a simple key/value in-memory store

kvStore is a simple key/value in-memory store. It is designed for the API. kvStore keeps records at /tmp/kvStore/dbName.db. You can specify server port, dbName and, file save interval in your RunServer(Addr, dbName) call.

Feb 24, 2022

A key-value db api with multiple storage engines and key generation

A key-value db api with multiple storage engines and key generation

Jet is a deadly-simple key-value api. The main goals of this project are : Making a simple KV tool for our other projects. Learn tests writing and git

Apr 5, 2022

An embedded key/value database for Go.

Bolt Bolt is a pure Go key/value store inspired by Howard Chu's LMDB project. The goal of the project is to provide a simple, fast, and reliable datab

Dec 30, 2022

LevelDB key/value database in Go.

This is an implementation of the LevelDB key/value database in the Go programming language. Installation go get github.com/syndtr/goleveldb/leveldb R

Jan 9, 2023

RocksDB/LevelDB inspired key-value database in Go

Pebble Nightly benchmarks Pebble is a LevelDB/RocksDB inspired key-value store focused on performance and internal usage by CockroachDB. Pebble inheri

Dec 29, 2022

A disk-backed key-value store.

What is diskv? Diskv (disk-vee) is a simple, persistent key-value store written in the Go language. It starts with an incredibly simple API for storin

Jan 1, 2023

Distributed reliable key-value store for the most critical data of a distributed system

etcd Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order

Dec 28, 2022
Comments
  • Feature merge

    Feature merge

    This merge adds the following features:

    • Adds viper support . Create .gostore-config file in the language you like (json,yaml,toml...) or user env. variables with GOSTORE prefix, for example GOSTORE_LOCATION
    • Improvements to the write service (optimization, graceful shutdown). TODO -> add optional interval for writes to occur (to decrease resource usage)
    • Improve HTTP/S support (graceful shutdown)
    • http, tcp now also supported as arguments to server command
Golang-key-value-store - Key Value Store API Service with Go DDD Architecture

This document specifies the tools used in the Key-Value store and reorganizes how to use them. In this created service, In-Memory Key-Value Service was created and how to use the API is specified in the HTML file in the folder named "doc"

Jul 31, 2022
ZedisDB - a key-value memory database written in Go

ZedisDB - a key-value memory database written in Go

Sep 4, 2022
Simple Distributed key-value database (in-memory/disk) written with Golang.

Kallbaz DB Simple Distributed key-value store (in-memory/disk) written with Golang. Installation go get github.com/msam1r/kallbaz-db Usage API // Get

Jan 18, 2022
FlashDB is an embeddable, in-memory key/value database in Go
FlashDB is an embeddable, in-memory key/value database in Go

FlashDB is an embeddable, in-memory key/value database in Go (with Redis like commands and super easy to read)

Dec 28, 2022
Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.

Olric Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service. With

Jan 4, 2023
GhostDB is a distributed, in-memory, general purpose key-value data store that delivers microsecond performance at any scale.
GhostDB is a distributed, in-memory, general purpose key-value data store that delivers microsecond performance at any scale.

GhostDB is designed to speed up dynamic database or API driven websites by storing data in RAM in order to reduce the number of times an external data source such as a database or API must be read. GhostDB provides a very large hash table that is distributed across multiple machines and stores large numbers of key-value pairs within the hash table.

Jan 6, 2023
yakv is a simple, in-memory, concurrency-safe key-value store for hobbyists.
yakv is a simple, in-memory, concurrency-safe key-value store for hobbyists.

yakv (yak-v. (originally intended to be "yet-another-key-value store")) is a simple, in-memory, concurrency-safe key-value store for hobbyists. yakv provides persistence by appending transactions to a transaction log and restoring data from the transaction log on startup.

Feb 24, 2022
A rest-api that works with golang as an in-memory key value store

In Store A rest-api that works with golang as an in-memory key value store Usage Fist of all, clone the repo with the command below. You must have gol

Oct 24, 2021
Simple in memory key-value store.

Simple in memory key-value store. Development This project is written in Go. Make sure you have Go installed (download). Version 1.17 or higher is req

Nov 6, 2021
A simple in-memory key-value store application
A simple in-memory key-value store application

vtec vtec, is a simple in-memory key-value store application. vtec provides persistence by appending transactions to a json file and restoring data fr

Jun 22, 2022