store

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func NewLevelDB

func NewLevelDB(dir string) (*leveldbStore, error)

Types

type PrefixStore

type PrefixStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPrefixStore

func NewPrefixStore(store Store, prefix []byte) *PrefixStore

func (*PrefixStore) Close

func (s *PrefixStore) Close() error

func (*PrefixStore) Delete

func (s *PrefixStore) Delete(key []byte) error

func (*PrefixStore) DeleteAll

func (s *PrefixStore) DeleteAll() error

func (*PrefixStore) Get

func (s *PrefixStore) Get(key []byte) ([]byte, error)

func (*PrefixStore) Has

func (s *PrefixStore) Has(key []byte) (bool, error)

func (*PrefixStore) ListAll

func (s *PrefixStore) ListAll() ([][]byte, error)

func (*PrefixStore) ListAllKey added in v0.0.2

func (s *PrefixStore) ListAllKey() ([][]byte, error)

func (*PrefixStore) Put

func (s *PrefixStore) Put(key []byte, value []byte) error

type Store

type Store interface {
	io.Closer

	Get(key []byte) ([]byte, error)
	List(prefix []byte) (results [][]byte, err error)
	ListKey(prefix []byte) (results [][]byte, err error)

	Put(key, value []byte) error
	Delete(key []byte) error
	DeleteAll(prefix []byte) error

	Has(key []byte) (bool, error)

	Dir() string
}

Jump to

Keyboard shortcuts

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