mbolt

package
v0.4.74 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetDefault = func() *Bolt {
	if Default != nil {
		return Default
	}
	panic("bolt not initialize")
}

Functions

func Delete

func Delete(bucketName string, key string) error

func Get

func Get(bucketName string, key string) (string, error)

func GetBytes

func GetBytes(bucketName string, key string) ([]byte, error)

func GetJson

func GetJson(bucketName string, key string, dest any) (any, error)

func InitDefaultBolt

func InitDefaultBolt(filepath string, bucketName ...string) error

func Set

func Set(bucketName string, key string, value string) error

func SetBytes

func SetBytes(bucketName string, key string, value []byte) error

func SetJson

func SetJson(bucketName string, key string, dest any) error

Types

type Bolt

type Bolt struct {
	Bolt *bolt.DB
}
var Default *Bolt

func InitBolt

func InitBolt(filepath string, bucketName ...string) (*Bolt, error)

func (*Bolt) R

func (ce *Bolt) R() (*BoltTran, error)

func (*Bolt) RW

func (ce *Bolt) RW() (*BoltTran, error)

type BoltTran

type BoltTran struct {
	Bolt     *bolt.DB
	Tx       *bolt.Tx
	ReadOnly bool
}

func (*BoltTran) Bucket

func (ce *BoltTran) Bucket(bucketName string) *BoltTranBucket

func (*BoltTran) Commit

func (ce *BoltTran) Commit() error

func (*BoltTran) Rollback

func (ce *BoltTran) Rollback() error

type BoltTranBucket

type BoltTranBucket struct {
	Bolt   *bolt.DB
	Tx     *bolt.Tx
	Bucket *bolt.Bucket
}

func (*BoltTranBucket) Delete

func (ce *BoltTranBucket) Delete(key string) error

func (*BoltTranBucket) Get

func (ce *BoltTranBucket) Get(key string) string

func (*BoltTranBucket) GetBytes

func (ce *BoltTranBucket) GetBytes(key string) []byte

func (*BoltTranBucket) GetJson

func (ce *BoltTranBucket) GetJson(key string, dest any) (any, error)

func (*BoltTranBucket) Set

func (ce *BoltTranBucket) Set(key string, value string) error

func (*BoltTranBucket) SetBytes

func (ce *BoltTranBucket) SetBytes(key string, value []byte) error

func (*BoltTranBucket) SetJson

func (ce *BoltTranBucket) SetJson(key string, dest any) error

Jump to

Keyboard shortcuts

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