kvs

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 2 Imported by: 0

README

KVS

A simple key-value store

CI Go Reference Go Report Card

Installation

$ git clone https://github.com/skyoo2003/kvs.git
$ cd kvs
$ go install ./cmd/kvs

CLI

The kvs binary exposes a small Cobra-based CLI.

$ kvs --help
$ kvs -v
$ kvs version
$ kvs --config config.yaml version

Use --config when you want to load a specific Viper-compatible config file.

Documentation

Import github.com/skyoo2003/kvs when you want a small in-memory store inside a Go program.

package main

import (
	"fmt"

	"github.com/skyoo2003/kvs"
)

func main() {
	store := kvs.NewStore()
	_ = store.Put("language", "go")

	value, _ := store.Get("language")
	fmt.Println(value)
}

Contributing

See CONTRIBUTING.md for the project contribution process.

License

The MIT License

Copyright (c) 2020-2021 Sung-Kyu Yoo

Documentation

Overview

Package kvs implements an in-memory key-value store.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is returned when the requested key does not exist.
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an in-memory key-value store.

func NewStore

func NewStore() *Store

NewStore creates a new Store instance.

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete removes a key from the store.

func (*Store) Get

func (s *Store) Get(key string) (interface{}, error)

Get gets a value by key.

func (*Store) Put

func (s *Store) Put(key string, value interface{}) error

Put stores a value under key.

Directories

Path Synopsis
api
cmd
kvs command
Package main implements to execute the program.
Package main implements to execute the program.
internal
server
Package server provides the HTTP and gRPC server implementations for kvs.
Package server provides the HTTP and gRPC server implementations for kvs.
pkg
bitset
Package bitset implements the Bit-Set Data strcutrue
Package bitset implements the Bit-Set Data strcutrue
cuckoofilter
Package cuckoofilter implements the Cuckoo-filter
Package cuckoofilter implements the Cuckoo-filter
lsm
Package lsm implements a small in-memory LSM tree.
Package lsm implements a small in-memory LSM tree.
rbt
Package rbt implements the Red-Black tree
Package rbt implements the Red-Black tree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL