orm

package
v0.0.0-...-27b3b18 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBktKeyNotFound means key not found.
	ErrBktKeyNotFound = errors.New("orm: key not found")

	// ErrBktGet means get error.
	ErrBktGet = errors.New("orm: get error")

	// ErrBktPut means put error.
	ErrBktPut = errors.New("orm: put error")

	// ErrBktIter means iteration error.
	ErrBktIter = errors.New("orm: iteration error")
)

BUCKET

View Source
var (
	// ErrDbNotLoaded means db not loaded.
	ErrDbNotLoaded = errors.New("db: not loaded")
)

DB

View Source
var (
	// ErrMarshal means marshal error.
	ErrMarshal = errors.New("orm: marshal error")
)

JSON

View Source
var (
	// ErrTxBktNotFound means bucket not found.
	ErrTxBktNotFound = errors.New("orm: bucket not found")
)

TX

Functions

func Mock

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

Mock mocks an orm.

func Put

func Put(db *bbolt.DB, bucket string, key string, obj any) error

Put puts a given key's value from given value.

Types

type Pair

type Pair struct {
	Key string
	Val []byte
}

Pair represents a kv record.

func Get

func Get(db *bbolt.DB, bucket string, key string) (*Pair, error)

Get gets a given key's value from given bucket.

func GetAll

func GetAll(db *bbolt.DB, bucket string) ([]Pair, error)

GetAll returns all of a given bucket's keys and objects.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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