Skip to content
an abstraction layer for golang based key-value stores, it is easy to add any backend provider.
Go
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
providers returned the err if it isn't nill (TTL(k)) Mar 13, 2020
LICENSE added LICENSE Feb 23, 2020
README.md
entry.go initial commit, finalized the core Feb 23, 2020
errors.go fixed badgerdb ttl, moved from passing entry by value to passing by ref Feb 29, 2020
go.mod ending #2 added TTL(key) method Mar 9, 2020
go.sum ending #2 added TTL(key) method Mar 9, 2020
provider.go ending #2 added TTL(key) method Mar 9, 2020
scan.go initial commit, finalized the core Feb 23, 2020

README.md

Overview

goukv is an abstraction layer for golang based key-value stores, it is easy to add any backend provider.

Available Providers

Why

I just built this to be used in my side projects such as redix(v2), but you can use it with no worries, it is production ready, and I'm open for any idea & contribution.

Backend Stores Rules

just keep it simple stupid!

  • Use the map[string]interface{} as your options.
  • Nil value means DELETE.
  • Respect the Entry struct.
  • Respect the ScanOpts struct.
  • On key not found, return goukv.ErrKeyNotFound, this replaces has().

Example

package main

import (
    "time"
    "fmt"
    "github.com/alash3al/goukv" 
    _ "github.com/alash3al/goukv/providers/goleveldb"
)

func main() {
    db, err := goukv.Open("goleveldb", map[string]interface{}{
        "path": "./db",
    })

    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")))
}
You can’t perform that action at this time.