dao

package
v0.0.0-...-b392570 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStorageObjectNotFound = errors.New("object not found")
)

Functions

func CreateBucket

func CreateBucket(db *bolt.DB, bucketName string) error

CreateBucket is a generic function used to create a bucket inside a bolt database.

func DeleteObject

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

DeleteObject is a generic function used to delete an object inside a bolt database.

func GetNextIdentifier

func GetNextIdentifier(db *bolt.DB, bucketName string) int

GetNextIdentifier is a generic function that returns the specified bucket identifier incremented by 1.

func GetObject

func GetObject(db *bolt.DB, bucketName string, key []byte, object interface{}) error

GetObject is a generic function used to retrieve an unmarshalled object from a bolt database.

func Itob

func Itob(v int) []byte

Itob returns an 8-byte big endian representation of v. This function is typically used for encoding integer IDs to byte slices so that they can be used as BoltDB keys.

func MarshalObject

func MarshalObject(object interface{}) ([]byte, error)

MarshalObject encodes an object to binary format

func UnmarshalObject

func UnmarshalObject(data []byte, object interface{}) error

UnmarshalObject decodes an object from binary data

func UpdateObject

func UpdateObject(db *bolt.DB, bucketName string, key []byte, object interface{}) error

UpdateObject is a generic function used to update an object inside a bolt database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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