blight

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

Blight

Blight is the boilerplate around bbolt that I found myself copying out of one project into another, then stopped to put it here.

db := blight.New(bdb)
db.Set("bucket", "key", "value")
v, err := db.Get("bucket", "key")

v == "value"

It isn't much, but it makes my life easier.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(db *bolt.DB, bucket, value []byte) error

func Delete

func Delete(db *bolt.DB, bucket, key []byte) error

func DeleteS

func DeleteS(db *bolt.DB, bucket, key string) error

func Get

func Get(db *bolt.DB, bucket, key []byte) ([]byte, error)

func GetS

func GetS(db *bolt.DB, bucket, key string) (string, error)

func ResetBucket

func ResetBucket(db *bolt.DB, bucket []byte) error

func Set

func Set(db *bolt.DB, bucket, key, value []byte) error

func SetS

func SetS(db *bolt.DB, bucket, key, value string) error

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func New

func New(db *bolt.DB) *DB

func (DB) AllFunc

func (d DB) AllFunc(bucket string, fn func(k, v []byte)) error

func (DB) AppendJSON

func (d DB) AppendJSON(bucket string, value interface{}) error

func (DB) Close

func (d DB) Close()

func (DB) CreateBucket

func (d DB) CreateBucket(bucket string) error

func (DB) DeleteBucket

func (d DB) DeleteBucket(bucket string) error

func (DB) Get

func (d DB) Get(bucket, key string) (string, error)

func (DB) GetJSON

func (d DB) GetJSON(bucket, key string, value interface{}) error

func (DB) Remove

func (d DB) Remove(bucket, key string) error

func (DB) ResetBucket

func (d DB) ResetBucket(bucket string) error

func (DB) Set

func (d DB) Set(bucket, key, value string) error

func (DB) SetJSON

func (d DB) SetJSON(bucket, key string, value interface{}) error

func (DB) SetJSONBatch

func (d DB) SetJSONBatch(bucket, key string, value interface{}) error

Jump to

Keyboard shortcuts

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