boltdb

package
v0.0.0-...-8d604f6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Codec is the codec used to marshal/unmarshal interfaces into the byte slices required by the BoltDB client.
	// The default codec is Gob
	Codec codec.Codec
)

Functions

This section is empty.

Types

type DB

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

DB is a struct which implements the "kv.Store" interface powered by BoltDB under the hood

func New

func New(path string, bucket string, mode os.FileMode, options *bolt.Options) (*DB, error)

New creates a new DB struct to interace with the underlying BoltDB database. Be sure to close it when you're done or it could hang If the bucket does not exist, it will be created.

func (*DB) Bucket

func (d *DB) Bucket() string

Bucket returns the name of the BoltDB bucket in use

func (*DB) Close

func (d *DB) Close() error

Close closes the underlying BoltDB database file

func (*DB) DB

func (d *DB) DB() *bolt.DB

DB returns the underling BoltDB struct

func (*DB) Del

func (d *DB) Del(key string) error

Del implements the "kv.Store".Del() interface

func (*DB) Get

func (d *DB) Get(key string, dstVal interface{}) error

Get implements the "kv.Store".Get() interface

func (*DB) Set

func (d *DB) Set(key string, value interface{}) error

Set implements the "kv.Store".Set() interface

Jump to

Keyboard shortcuts

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