boltdb

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 9 Imported by: 0

README

boltdb

BoltDB

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPathNotFound = errors.New("path not found")
	ErrKeyNotFound  = errors.New("key not found")
	ErrKeyExists    = errors.New("key already exists")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DBPath         string        `json:"db_path"`
	RequestTimeout time.Duration `json:"request_timeout_in_seconds"`
}

type Session

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

func (*Session) BucketExists

func (s *Session) BucketExists(path []string) bool

BucketExists checks if a bucket path exists.

func (*Session) CreateBucket

func (s *Session) CreateBucket(path []string) error

Create bucket path.

func (*Session) DeleteBucket

func (s *Session) DeleteBucket(path []string) error

Delete bucket at the tail of the given bucket path. The call does not return an error when the bucket does not exist.

func (*Session) DeleteKey

func (s *Session) DeleteKey(path []string, key string) error

Delete key, deletes key at given path when present. The call does not return an error when key does not exist.

func (*Session) KeyExists

func (s *Session) KeyExists(path []string, key string) bool

Key exists checks if a key exists at given bucket path.

func (*Session) List

func (s *Session) List(path []string, pageToken string) ([]string, [][]byte, string, error)

List returns paged collection of key and value arrays

func (*Session) ListBuckets

func (s *Session) ListBuckets(path []string, pageToken string) ([]string, string, error)

List buckets, returns a paged collection of buckets.

func (*Session) ListKeys

func (s *Session) ListKeys(path []string, pageToken string) ([]string, string, error)

List keys returns paged collection of keys

func (*Session) NextSeq

func (s *Session) NextSeq(path []string) (uint64, error)

Generate next ID for bucket

func (*Session) PrefixExists

func (s *Session) PrefixExists(path []string, prefix string) (bool, error)

PrefixExists scans keys for prefix match

func (*Session) Read

func (s *Session) Read(path []string, key string) ([]byte, error)

Read value from key in bucket path.

func (*Session) ReadScan

func (s *Session) ReadScan(path []string, prefix string) ([]string, [][]byte, error)

ReadScan returns list of key-value pairs which match the scan prefix filter.

func (*Session) Write

func (s *Session) Write(path []string, key string, value []byte) error

Write value for key in bucket path.

type Store

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

func NewStore

func NewStore(cfg *Config, logger *zerolog.Logger) *Store

func (*Store) Close

func (s *Store) Close()

Close store

func (*Store) Open

func (s *Store) Open() error

Open store.

func (*Store) ReadSession

func (s *Store) ReadSession() (*Session, func(), error)

Start new read session.

func (*Store) WriteSession

func (s *Store) WriteSession() (*Session, func(), error)

Start new write session

Jump to

Keyboard shortcuts

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