Categorygithub.com/alash3al/goukv
modulepackage
1.6.1
Repository: https://github.com/alash3al/goukv.git
Documentation: pkg.go.dev

# README

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("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")))
}

# Packages

No description provided by the author

# Functions

Get returns a driver from the registery.
NewDSN initializes a new dsn by parsing the specified dsn.
Open initialize the specified provider and returns its instance.
Register register a new driver.

# Variables

error related variables.
error related variables.
error related variables.
error related variables.

# Structs

DSN data source name.
Entry
Entry represents a key - value pair.
ScanOpts scanner options.

# Interfaces

Provider an interface describes a storage backend.

# Type aliases

Scanner a function that performs the scanning/filterig.