Skip to content
/ gkv Public

Embeddable, persistent, simple key/value(KV) database adapter for Go.

License

Notifications You must be signed in to change notification settings

WindomZ/gkv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gkv

gkv is an embeddable, persistent, simple key/value(KV) database adapter for Go.

Build Status GoDoc

This package depends on third-party databases.

Features

  • Out of the box, easy to use.
  • Basic, common, pure Go.
  • Support multiple databases.

Databases

Installing

go get -u github.com/WindomZ/gkv/...

Usage

import (
	"github.com/WindomZ/gkv"
	_ "github.com/WindomZ/gkv/bolt"
)
...

// init db
db := Open("../data/bolt.db")
db.Register([]byte("tablename"))
...

// put the value for a key
db.Put([]byte("key1"), []byte("value1"))
db.Put([]byte("key2"), []byte("value2"))
...

// get the value for a key
demo.Get([]byte("key1"))
demo.Get([]byte("key2"))

If you want to switch between different databases, just change import _ "github.com/WindomZ/gkv/bolt".

For example:

  • bolt - import _ "github.com/WindomZ/gkv/bolt"
  • badger - import _ "github.com/WindomZ/gkv/badger"
  • leveldb - import _ "github.com/WindomZ/gkv/leveldb"
  • buntdb - import _ "github.com/WindomZ/gkv/buntdb"
  • sqlite3 - import _ "github.com/WindomZ/gkv/sqlite3"

Easy to switch, choose the most suitable database.

Contributing

Welcome to pull requests, report bugs, suggest ideas and discuss on issues page.

If you like it then you can put a ⭐ on it.

About

Embeddable, persistent, simple key/value(KV) database adapter for Go.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages