store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("store: key not found")
	ErrWriterIsNil = errors.New("store: writer is nil")
	ErrReaderIsNil = errors.New("store: reader is nil")
)

Functions

This section is empty.

Types

type BoltStore

type BoltStore struct {
	Marshaler
	// contains filtered or unexported fields
}

func (*BoltStore) Close

func (bs *BoltStore) Close() error

func (*BoltStore) Delete

func (bs *BoltStore) Delete(key string) error

func (*BoltStore) Dump

func (bs *BoltStore) Dump(w io.Writer) (err error)

func (*BoltStore) ForEach

func (bs *BoltStore) ForEach(f func(string, []byte) error) error

func (*BoltStore) ForEachPrefix

func (bs *BoltStore) ForEachPrefix(prefix string, f func(string, []byte) error) error

func (*BoltStore) Get

func (bs *BoltStore) Get(key string, v any) (err error)

func (*BoltStore) Restore

func (bs *BoltStore) Restore(r io.Reader) (err error)

func (*BoltStore) Set

func (bs *BoltStore) Set(key string, v any) error

type Dumper

type Dumper interface {
	Dump(io.Writer) error
}

type Marshaler

type Marshaler interface {
	Marshal(v any) ([]byte, error)
	Unmarshal(data []byte, v any) error
}

func NewGOB

func NewGOB() Marshaler

type Restorer

type Restorer interface {
	Restore(io.Reader) error
}

type Store

type Store interface {
	Marshaler
	Dumper
	Restorer
	Get(string, any) error
	Set(string, any) error
	ForEach(func(string, []byte) error) error
	ForEachPrefix(string, func(string, []byte) error) error
	Delete(string) error
	Close() error
}

func NewBoltStore

func NewBoltStore(file string, m Marshaler) (Store, error)

Jump to

Keyboard shortcuts

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