kvutil

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithKey

func WithKey[T any](base storage.KeyValueStoreT[T], key string) storage.ValueStoreT[T]

func WithPrefix

func WithPrefix[T any](base storage.KeyValueStoreT[T], prefix string) storage.KeyValueStoreT[T]

Types

type KeyValueStoreLocker

type KeyValueStoreLocker[T any] interface {
	storage.KeyValueStoreT[T]
	sync.Locker
}

func NewKeyValueStoreLocker

func NewKeyValueStoreLocker[T any](s storage.KeyValueStoreT[T]) KeyValueStoreLocker[T]

type ValueStoreAdapter

type ValueStoreAdapter[T any] struct {
	PutFunc     func(ctx context.Context, value T, opts ...storage.PutOpt) error
	GetFunc     func(ctx context.Context, opts ...storage.GetOpt) (T, error)
	WatchFunc   func(ctx context.Context, opts ...storage.WatchOpt) (<-chan storage.WatchEvent[storage.KeyRevision[T]], error)
	DeleteFunc  func(ctx context.Context, opts ...storage.DeleteOpt) error
	HistoryFunc func(ctx context.Context, opts ...storage.HistoryOpt) ([]storage.KeyRevision[T], error)
}

func (ValueStoreAdapter[T]) Delete

func (s ValueStoreAdapter[T]) Delete(ctx context.Context, opts ...storage.DeleteOpt) error

func (ValueStoreAdapter[T]) Get

func (s ValueStoreAdapter[T]) Get(ctx context.Context, opts ...storage.GetOpt) (T, error)

func (ValueStoreAdapter[T]) History

func (s ValueStoreAdapter[T]) History(ctx context.Context, opts ...storage.HistoryOpt) ([]storage.KeyRevision[T], error)

func (ValueStoreAdapter[T]) Put

func (s ValueStoreAdapter[T]) Put(ctx context.Context, value T, opts ...storage.PutOpt) error

func (ValueStoreAdapter[T]) Watch

type ValueStoreLocker

type ValueStoreLocker[T any] interface {
	storage.ValueStoreT[T]
	sync.Locker
}

func NewValueStoreLocker

func NewValueStoreLocker[T any](s storage.ValueStoreT[T], mutex ...sync.Locker) ValueStoreLocker[T]

Jump to

Keyboard shortcuts

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