dbutil

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CardBucket  = []byte("kure_card")
	EntryBucket = []byte("kure_entry")
	FileBucket  = []byte("kure_file")
	TOTPBucket  = []byte("kure_totp")
)

Database bucket

Functions

func Get added in v0.6.0

func Get(db *bolt.DB, name string, record Record) error

Get retrieves a record from the database, decrypts it and loads it into record.

func GetBucketName added in v0.7.0

func GetBucketName(r Record) []byte

GetBucketName returns the bucket name depending on the type of the record passed.

func List added in v0.6.0

func List[R Record](db *bolt.DB, record R) ([]R, error)

List returns a list of decrypted records from the database.

func ListNames

func ListNames(db *bolt.DB, bucketName []byte) ([]string, error)

ListNames returns a list with all the records names.

func Put added in v0.6.0

func Put(b *bolt.Bucket, record Record) error

Put encrypts and saves a record into the database.

func Remove

func Remove(db *bolt.DB, bucketName []byte, names ...string) error

Remove removes records from the database.

func SetContext

func SetContext(t testing.TB, path string, bucketName []byte) *bolt.DB

SetContext creates a bucket and its context to test the database operations.

Types

type Record added in v0.6.0

type Record interface {
	GetName() string
	proto.Message
}

Record is an interface that all Kure objects implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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