goukv - an abstraction layer for golang based key-value stores

栏目: IT技术 · 发布时间: 6年前

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, 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.

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

以上所述就是小编给大家介绍的《goukv - an abstraction layer for golang based key-value stores》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

PHP、MySQL和Apache编程导学

PHP、MySQL和Apache编程导学

梅隆尼 / 李军 / 2009-1 / 59.00元

《PHP、MySQL和Apache编程导学(原书第4版)》介绍Web应用开发的强大组合工具:MySQL、Apache和PHP,共分为六个部分。第一部分引领读者深入了解、安装和配置MySQL、Apache和PHP。第二部分讲解PHP语言基础,包括数组和对象这样的结构化元素。第三部分介绍中级应用程序开发的主题,包括使用表单和文件、限制访问以及完成包含某个专门概念的小项目。第四部分介绍使用数据库的一般性......一起来看看 《PHP、MySQL和Apache编程导学》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具