db

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyTemplate describes the format of the keys inside of a bucket
	KeyTemplate = "%s-%s"
)

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
	ErrNilValue = errors.New("value is nil")
)

Package vars

Functions

This section is empty.

Types

type DB

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

DB describes local BoltDB database

func New

func New(path string, timeout time.Duration) (*DB, error)

New creates new instance of DB

func (*DB) Close

func (db *DB) Close(delete bool) error

Close closes the DB

func (*DB) Delete

func (db *DB) Delete(key string) error

Delete removes the value from DB by provided bucket and key

func (*DB) Get

func (db *DB) Get(key string) ([]byte, error)

Get acquires value from DB by provided key

func (*DB) GetMultipleBySuffix

func (db *DB) GetMultipleBySuffix(suffix string) ([]string, [][]byte, error)

GetMultipleBySuffix returns keys and non-empty values, for which the key contains the suffix It returns all keys and values from the bucket if the suffix is empty

func (*DB) Keys

func (db *DB) Keys() ([]string, error)

Keys returns a list of available keys in the global bucket, sorted alphabetically

func (*DB) Purge

func (db *DB) Purge() error

Purge removes the bucket from DB

func (*DB) Put

func (db *DB) Put(key string, val []byte) error

Put sets/updates the value in DB by provided bucket and key

type Record

type Record struct {
	models.ArchRecord

	Disabled  bool  `json:"disabled,omitempty"`
	Timestamp int64 `json:"ts"`
}

Record is used to store models.ArchRecord in DB

Jump to

Keyboard shortcuts

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