database

package
v0.0.0-...-4a1318b Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBucket

func CreateBucket(db *DB, bucket []byte) error

Types

type Bucket

type Bucket[T any] struct {
	// contains filtered or unexported fields
}

func NewBucket

func NewBucket[T any](tx *bolt.Tx, bucket []byte, m marshal.Spec[T]) *Bucket[T]

func (*Bucket[T]) Get

func (b *Bucket[T]) Get(key []byte) (T, error)

func (*Bucket[T]) Put

func (b *Bucket[T]) Put(key []byte, value T) error

type DB

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

func Open

func Open(path string, create bool) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Update

func (db *DB) Update(fn func(tx *bolt.Tx) error) error

func (*DB) View

func (db *DB) View(fn func(tx *bolt.Tx) error) error

type SingleDB

type SingleDB[T any] struct {
	*DB
	// contains filtered or unexported fields
}

func OpenSingle

func OpenSingle[T any](path string, bucket []byte, m marshal.Spec[T], create bool) (*SingleDB[T], error)

func Single

func Single[T any](db *DB, bucket []byte, m marshal.Spec[T]) (*SingleDB[T], error)

func (*SingleDB[T]) Update

func (db *SingleDB[T]) Update(fn func(b *Bucket[T]) error) error

func (*SingleDB[T]) View

func (db *SingleDB[T]) View(fn func(b *Bucket[T]) error) error

Jump to

Keyboard shortcuts

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