kv

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: AGPL-3.0 Imports: 15 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, ", "))

Functions

func DriverNames

func DriverNames() []string

DriverNames returns a list of possible string values of Driver.

func With

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

Types

type Driver

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

func DriverValues() []Driver

DriverValues returns a list of the values for Driver

func ParseDriver

func ParseDriver(name string) (Driver, error)

ParseDriver attempts to convert a string to a Driver.

func (*Driver) Get

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

Get implements the Golang flag.Getter interface func.

func (Driver) IsValid

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

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

Set implements the Golang flag.Value interface func.

func (Driver) String

func (x Driver) String() string

String implements the Stringer interface.

func (*Driver) Type

func (x *Driver) Type() string

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

type Meta

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

type Storage

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

func From

func From(ctx context.Context) Storage

func New

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

func NewWithMap

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