db

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetHandleInViper

func SetHandleInViper(v *viper.Viper, db *DB)

SetHandleInViper sets a handle in Viper

Types

type Counter

type Counter string

Counter type

const (
	CounterWALPos Counter = "WalPos"
)

These are counter names in the DB

type DB

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

DB is an interface to a bolt db

func GetHandleFromViper

func GetHandleFromViper(v *viper.Viper) (*DB, error)

GetHandleFromViper retrieves a handle from Viper

func New

func New(file string) (c *DB, err error)

New returns an instance of DB

func (*DB) BucketInit

func (c *DB) BucketInit(bucketName string) error

BucketInit creates the bucket with provided name if it does not exist

func (*DB) Close

func (c *DB) Close() error

Close waits for all TX to finish and closes DB

func (*DB) CounterGet

func (c *DB) CounterGet(bucketName string, counterName Counter) (value uint64, err error)

CounterGet gets a value of the specified counter in the provided bucket

func (*DB) CounterSet

func (c *DB) CounterSet(bucketName string, counterName Counter, value uint64) (err error)

CounterSet sets a value of the specified counter in the provided bucket

Jump to

Keyboard shortcuts

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