Categorygithub.com/ucwong/golang-kv
modulepackage
1.0.23
Repository: https://github.com/ucwong/golang-kv.git
Documentation: pkg.go.dev

# README

Golang-kv

Bundle embedded databases with fixed api https://pkg.go.dev/github.com/ucwong/golang-kv

Interfaces

type Bucket interface {
	Get(k []byte) []byte
	Set(k, v []byte) error
	Del(k []byte) error
	Prefix(k []byte) [][]byte
	Suffix(k []byte) [][]byte
	Scan() [][]byte
	Range(start, limit []byte) [][]byte
	SetTTL(k, v []byte, expire time.Duration) error
	Close() error

	// BatchSet write & flush
	BatchSet(kvs map[string][]byte) error
	
	Name() string
}

used by

import "github.com/ucwong/golang-kv"

...

badger := kv.Badger("")
defer badger.Close()
badger.Set([]byte("x"), []byte("y")))
v := badger.Get([]byte("x"))
vs := badger.Prefix([]byte("x"))

...

bolt := kv.Bolt("")
defer bolt.Close()

bolt.setTTL([]byte("k"), []byte("v"), time.Second)

...

ldb := kv.LevelDB("")
defer ldb.Close()

...

peb := kv.Pebble("")
defer peb.Close()

...

nut := kv.NutsDB("")
defer nut.Close()
...

Test

make test

Repobeats

Alt

How to choose database engine

image

image

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author