zdelib

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Branch = ""
View Source
var BuildDate = ""
View Source
var Commit = ""
View Source
var Version = "v0.0.0-dev"

Functions

func Open

func Open(path string) (*bbolt.DB, error)

Open attempts to open the provided path as a bbolt.DB. Returns a bbolt.Db or an error

func TypeToString

func TypeToString(fieldType boltz.FieldType) string

TypeToString will convert boltz types to string values. If an unknown type is encountered, "unknown" is returned.

Types

type Entry

type Entry struct {
	Name        string
	Type        boltz.FieldType
	TypeString  string
	Value       []byte
	ValueString *string
}

Entry is a struct that represents a value field from the bbolt database with the key being set to the Name property. Type information and string representations of the value are also provided.

type State

type State struct {
	DB      *bbolt.DB
	Path    []string
	History []string
	// contains filtered or unexported fields
}

func NewState

func NewState(path string) (*State, error)

NewState creates a State which will attempt to open path as a bbolt database. If the path or db are invalid nil and an error are returned. Otherwise, a newly initialized State is returned at the root of the database.

func (*State) AtRoot

func (state *State) AtRoot() bool

AtRoot returns true if the current state path is at the root level.

func (*State) Back

func (state *State) Back() error

Back moves the state back one level if possible

func (*State) BucketStats

func (state *State) BucketStats() bbolt.BucketStats

BucketStats returns the bbolt.BucketStats for the bucket the state's path currently points to

func (*State) CurrentBucket

func (state *State) CurrentBucket(tx *bbolt.Tx) *bbolt.Bucket

CurrentBucket will return a *bbolt.Bucket matching the current state.path.

func (*State) CurrentBucketKeyCount

func (state *State) CurrentBucketKeyCount() int64

CurrentBucketKeyCount returns the number of keys in the bucket the state's path currently points to.

func (*State) CurrentBucketKeyCountInTx

func (state *State) CurrentBucketKeyCountInTx(tx *bbolt.Tx) int64

CurrentBucketKeyCountInTx does the same thing as CurrentBucketKeyCount but withing an existing transaction

func (*State) DbStats

func (state *State) DbStats() bbolt.Stats

DbStats returns the bbolt.DB database states

func (*State) Done

func (state *State) Done()

Done is meant to be called when the state is no longer needed.

func (*State) Enter

func (state *State) Enter(name string) error

Enter moves the state into the desired bucket name.

func (*State) GetValue

func (state *State) GetValue(key string) string

GetValue returns the string value for a specific key in the current state's path location

func (*State) ListEntries

func (state *State) ListEntries() []Entry

ListEntries returns an array of all Entries for the current bucket

Jump to

Keyboard shortcuts

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