kv

package
v0.0.0-...-8d604f6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound  = errors.New("not found")
	ErrCacheMiss = errors.New("cache miss")
	// ErrInvalidDstVal is returned with the dstVal of the Get() func cannot be set. It's probably because the
	// dstVal is not a pointer.
	ErrInvalidDstVal = errors.New("cannot set dst value")
	// ErrInvalidDataFormat is returned when the data retrieved from a storage engine is not in the expected format
	ErrInvalidDataFormat = errors.New("Invalid data format")
)

Errors

Functions

func Key

func Key(key interface{}) string

Key turns Stringer funcs, byte slices, pointers to strings, etc., into string keys

Types

type Clearer

type Clearer interface {
	Clear() error
}

Clearer defines an interface which store can clear all it's key/value pairs at once.

type Datastore

type Datastore interface {
	Store
	KeyList
	Transfer(Store) error
}

Datastore defines an key/value interface which supports exporting all it's keys and also transferring all it's data to another KeyStore.

type KeyList

type KeyList interface {
	Keys() []string
}

KeyList defines an interface for announcing all keys currently set

type KeyProvider

type KeyProvider interface {
	Key() string
}

KeyProvider is an interface which can describe it's own key. It's used for getting/setting key/value pairs without a directly supplied key string. Instead, the supplied interface can announce it's own key, and that's used in getting/setting.

type Store

type Store interface {
	Set(key string, value interface{}) error
	Get(key string, dstVal interface{}) error
	Del(key string) error
}

Store defines a permanent key/value store

Jump to

Keyboard shortcuts

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