kv

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DriverTypeKey = "type"

Variables

View Source
var ErrInvalidDriver = fmt.Errorf("not a valid Driver, try [%s]", strings.Join(_DriverNames, ", "))
View Source
var ErrNotFound = errors.New("key not found")

Functions

func DriverNames added in v0.13.1

func DriverNames() []string

DriverNames returns a list of possible string values of Driver.

func With added in v0.13.1

func With(ctx context.Context, kv Storage) context.Context

Types

type Driver added in v0.13.1

type Driver string

Driver ENUM(legacy, bolt, file)

const (
	// DriverLegacy is a Driver of type legacy.
	DriverLegacy Driver = "legacy"
	// DriverBolt is a Driver of type bolt.
	DriverBolt Driver = "bolt"
	// DriverFile is a Driver of type file.
	DriverFile Driver = "file"
)

func DriverValues added in v0.13.1

func DriverValues() []Driver

DriverValues returns a list of the values for Driver

func ParseDriver added in v0.13.1

func ParseDriver(name string) (Driver, error)

ParseDriver attempts to convert a string to a Driver.

func (*Driver) Get added in v0.13.1

func (x *Driver) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (Driver) IsValid added in v0.13.1

func (x Driver) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (*Driver) Set added in v0.13.1

func (x *Driver) Set(val string) error

Set implements the Golang flag.Value interface func.

func (Driver) String added in v0.13.1

func (x Driver) String() string

String implements the Stringer interface.

func (*Driver) Type added in v0.13.1

func (x *Driver) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type KV

type KV interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Delete(key string) error
}

type Meta added in v0.13.1

type Meta map[string]map[string][]byte // namespace, key, value

type Storage added in v0.13.1

type Storage interface {
	Name() string
	MigrateTo() (Meta, error)
	MigrateFrom(Meta) error
	Namespaces() ([]string, error)
	Open(ns string) (KV, error)
	io.Closer
}

func From added in v0.13.1

func From(ctx context.Context) Storage

func New

func New(driver Driver, opts map[string]any) (Storage, error)

func NewWithMap added in v0.14.0

func NewWithMap(o map[string]string) (Storage, error)

Jump to

Keyboard shortcuts

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