kvlite3

package module
v0.0.0-...-cf2b7f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2014 License: MIT Imports: 7 Imported by: 0

README

kvlite3

simple key-value store backed by sqlite3 for the Go language

Build Status

"Features":

  • basic put/get/getall operations
  • encodes values as json

Usage:

client, _ := kvlite3.NewClient("./todos.db")
bucket, _ := client.NewBucket("todos")

todo := Todo{kvlite3.NewKey(), "Take out trash"}
bucket.Put(todo.Key, todo) // Insert

[*] See examples/simple.go for for more details

TODO:

  • Implement putMany
  • Implement getMany
  • Implement limit/offset in getAll

Documentation

Index

Constants

View Source
const VERSION = "0.1"

Variables

This section is empty.

Functions

func NewKey

func NewKey() string

Create a unique 16 bytes key

Types

type Bucket

type Bucket struct {
	Name   string
	Client *Client
}

func (*Bucket) Del

func (b *Bucket) Del(key string) error

Delete an item

func (*Bucket) Get

func (b *Bucket) Get(key string, result interface{}) error

Gets an item from the bucket

func (*Bucket) GetAll

func (b *Bucket) GetAll(result interface{}) error

Get all items in

func (*Bucket) Put

func (b *Bucket) Put(key string, value interface{}) error

Insert or replace an item of a given key

type Client

type Client struct {
	Db *sql.DB
}

func NewClient

func NewClient(path string) (*Client, error)

Create a new client

func (*Client) NewBucket

func (c *Client) NewBucket(name string) (*Bucket, error)

Create a new bucket

type Result

type Result struct {
	Key   string
	Value string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL