bolt

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FreelistArrayType = bbolt.FreelistArrayType
	FreelistMapType   = bbolt.FreelistMapType

	DefaultAllocSize     = bbolt.DefaultAllocSize
	DefaultFillPercent   = bbolt.DefaultFillPercent
	DefaultMaxBatchDelay = bbolt.DefaultMaxBatchDelay
	DefaultMaxBatchSize  = bbolt.DefaultMaxBatchSize
)

Variables

View Source
var (
	Open           = bbolt.Open
	DefaultOptions = bbolt.DefaultOptions
	WithKVStringer = bbolt.WithKVStringer
	HexKVStringer  = bbolt.HexKVStringer
)
View Source
var (
	ErrBucketExists       = bbolt.ErrBucketExists
	ErrBucketNameRequired = bbolt.ErrBucketNameRequired
	ErrBucketNotFound     = bbolt.ErrBucketNotFound
	ErrChecksum           = bbolt.ErrChecksum
	ErrDatabaseNotOpen    = bbolt.ErrDatabaseNotOpen
	ErrDatabaseOpen       = bbolt.ErrDatabaseOpen
	ErrDatabaseReadOnly   = bbolt.ErrDatabaseReadOnly
	ErrFreePagesNotLoaded = bbolt.ErrFreePagesNotLoaded
	ErrIncompatibleValue  = bbolt.ErrIncompatibleValue
	ErrInvalid            = bbolt.ErrInvalid
	ErrInvalidMapping     = bbolt.ErrInvalidMapping
	ErrKeyRequired        = bbolt.ErrKeyRequired
	ErrKeyTooLarge        = bbolt.ErrKeyTooLarge
	ErrTimeout            = bbolt.ErrTimeout
	ErrTxClosed           = bbolt.ErrTxClosed
	ErrTxNotWritable      = bbolt.ErrTxNotWritable
	ErrValueTooLarge      = bbolt.ErrValueTooLarge
	ErrVersionMismatch    = bbolt.ErrVersionMismatch
)

Functions

func TxAppend

func TxAppend[T S](tx BoltTx, bucketName, key, val T) error

func TxDel

func TxDel[B S, K S](tx BoltTx, bucketName B, keys ...K) error

func TxSet

func TxSet[B S, K S, V S](tx BoltTx, bucketName B, key K, value V) error

Types

type BoltBucket

type BoltBucket interface {
	BoltTx
	Put(key, value []byte) error
	Get(key []byte) []byte
	Delete(key []byte) error
	Cursor() *Cursor
	NextSequence() (uint64, error)
	ForEach(fn func(k, v []byte) error) error
}

type BoltDB

type BoltDB = bbolt.DB

type BoltTx

type BoltTx interface {
	Bucket(name []byte) *Bucket
	CreateBucketIfNotExists(name []byte) (*Bucket, error)
	DeleteBucket(key []byte) error
}

type Bucket

type Bucket = bbolt.Bucket

func BucketCreate

func BucketCreate[T S](tx BoltTx, bucketNames ...T) (bucket *Bucket, err error)

func BucketOpen

func BucketOpen[T S](tx BoltTx, bucketNames ...T) (bucket *Bucket, err error)

type BucketStats

type BucketStats = bbolt.BucketStats

type CheckOption

type CheckOption = bbolt.CheckOption

type Cursor

type Cursor = bbolt.Cursor

type DB

type DB struct {
	BoltDB
}

func (*DB) Get

func (db *DB) Get(bucketName, key string) (val string, err error)

func (*DB) Update

func (db *DB) Update(processes ...Process) (err error)

func (*DB) View

func (db *DB) View(processes ...Process) (err error)

type FreelistType

type FreelistType = bbolt.FreelistType

type Options

type Options = bbolt.Options

type PageInfo

type PageInfo = bbolt.PageInfo

type Process

type Process = func(tx *Tx) error

func Append

func Append[T S](bucketName, key, val T) Process

func Del

func Del[B S, K S](bucketName B, keys ...K) Process

func ForEach

func ForEach[T S](bucketName T, fn func(k, v []byte) error) Process

func ForEachWithPrefix

func ForEachWithPrefix[T S, P S](bucketName T, prefix P, fn func(k, v []byte) error) Process

func Set

func Set[B S, K S, V S](bucketName B, key K, value V) Process

type S

type S interface{ ~string | ~[]byte }

type Stats

type Stats = bbolt.Stats

type Tx

type Tx = bbolt.Tx

type TxStats

type TxStats = bbolt.TxStats

Jump to

Keyboard shortcuts

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