https://github.com/alash3al/goukv
a key-value store with multiple backends including leveldb, badgerdb, postgresql
https://github.com/alash3al/goukv
badgerdb go golang key-value leveldb
Last synced: 9 months ago
JSON representation
a key-value store with multiple backends including leveldb, badgerdb, postgresql
- Host: GitHub
- URL: https://github.com/alash3al/goukv
- Owner: alash3al
- License: mit
- Created: 2020-02-23T20:52:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-25T21:30:10.000Z (about 5 years ago)
- Last Synced: 2025-08-15T08:12:53.672Z (11 months ago)
- Topics: badgerdb, go, golang, key-value, leveldb
- Language: Go
- Homepage:
- Size: 70.3 KB
- Stars: 53
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Overview
=========
[](https://godoc.org/github.com/alash3al/goukv)
> `goukv` is an abstraction layer for golang based key-value stores, it is easy to add any backend provider.
Available Providers
===================
- `badgerdb`: [BadgerDB](/providers/badgerdb)
- `leveldb`: [levelDB](/providers/leveldb)
- `postgres`: [Postgresql](/providers/postgres)
Backend Stores Rules
=====================
> just keep it simple stupid!
- `Nil` value means *DELETE*.
- Respect the `Entry` struct.
- Respect the `ScanOpts` struct.
- On key not found, return `goukv.ErrKeyNotFound`, this replaces `has()`.
Example
=======
```go
package main
import (
"time"
"fmt"
"github.com/alash3al/goukv"
_ "github.com/alash3al/goukv/providers/leveldb"
)
func main() {
db, err := goukv.Open("leveldb", "./")
if err != nil {
panic(err.Error())
}
defer db.Close()
db.Put(&goukv.Entry{
Key: []byte("k1"),
Value: []byte("v1"),
TTL: time.Second * 10,
})
fmt.Println(db.Get([]byte("k1")))
}
```