kvstore

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: Apache-2.0, BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TypedStore

type TypedStore[K, V any, KPtr constraints.MarshalablePtr[K], VPtr constraints.MarshalablePtr[V]] struct {
	// contains filtered or unexported fields
}

TypedStore is a generically typed wrapper around a KVStore that abstracts serialization away.

func NewTypedStore

func NewTypedStore[K, V any, KPtr constraints.MarshalablePtr[K], VPtr constraints.MarshalablePtr[V]](kv kvstore.KVStore) *TypedStore[K, V, KPtr, VPtr]

NewTypedStore is the constructor for TypedStore.

func (*TypedStore[K, V, KPtr, VPtr]) Delete

func (t *TypedStore[K, V, KPtr, VPtr]) Delete(key K) (err error)

Delete deletes the given key from the store.

func (*TypedStore[K, V, KPtr, VPtr]) Get

func (t *TypedStore[K, V, KPtr, VPtr]) Get(key K) (value V, err error)

Get gets the given key or an error if an error occurred.

func (*TypedStore[K, V, KPtr, VPtr]) Iterate

func (t *TypedStore[K, V, KPtr, VPtr]) Iterate(prefix kvstore.KeyPrefix, callback func(key K, value V) (advance bool), direction ...kvstore.IterDirection) (err error)

func (*TypedStore[K, V, KPtr, VPtr]) Set

func (t *TypedStore[K, V, KPtr, VPtr]) Set(key K, value V) (err error)

Set sets the given key and value.

Jump to

Keyboard shortcuts

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