store

package
v0.0.0-...-1045ef1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(bytes []byte, struct0 interface{}) error

func Serialize

func Serialize(value interface{}) ([]byte, error)

Types

type BoltConfig

type BoltConfig struct {
	Path    string
	Buckets []string
}

type BoltDB

type BoltDB struct {
	*bolt.DB
}

func Connect

func Connect(path string) *BoltDB

Connect connect to boltdb

func (*BoltDB) CreateCollection

func (b *BoltDB) CreateCollection(collection string) error

func (*BoltDB) DeleteCollection

func (b *BoltDB) DeleteCollection(collection string) error

func (*BoltDB) Disconnect

func (b *BoltDB) Disconnect()

Disconnect close boltdb client

func (*BoltDB) Get

func (b *BoltDB) Get(collection, key string) (data []byte, err error)

Get get a key/value pair from a bucket

func (*BoltDB) GetAll

func (b *BoltDB) GetAll(collection string) (data [][]byte, err error)

GetAll get all key/value pairs in a collection

func (*BoltDB) GetInRange

func (b *BoltDB) GetInRange(collection, minDate, maxDate string) (data [][]byte, err error)

GetInRange get key/value pairs within a time range minDate: RFC3339 sortable time string ie. 1990-01-01T00:00:00Z maxDate example: RFC3339 sortable time string ie. 2000-01-01T00:00:00Z

func (*BoltDB) Put

func (b *BoltDB) Put(collection string, key string, value []byte) error

Put upsert a key/value pair

func (*BoltDB) Remove

func (b *BoltDB) Remove(collection string, key string) error

type Store

type Store interface {
	Disconnect()
	Get(collection, key string) ([]byte, error)
	GetAll(collection string) ([][]byte, error)
	GetInRange(collection, minTime, maxTime string) ([][]byte, error)
	Put(collection string, key string, value []byte) error
	Remove(collection string, key string) error
	DeleteCollection(collection string) error
	CreateCollection(collection string) error
}

func Client

func Client() Store

Client boltdb client instance

Jump to

Keyboard shortcuts

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