kv

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key[K KeyType](key K) []byte

func Marshal

func Marshal(data any) ([]byte, error)

func ToKey

func ToKey[K KeyType](data []byte) K

func Unmarshal

func Unmarshal[V any](data []byte, value V) error

Types

type KV

type KV[K KeyType, V any] struct {
	*pebble.DB
}

func New

func New[K KeyType, V any](pdb *pebble.DB) *KV[K, V]

func NewPath

func NewPath[K KeyType, V any](path string) *KV[K, V]

func (*KV[K, V]) GetItem

func (p *KV[K, V]) GetItem(key K) (V, bool)

func (*KV[K, V]) SetItem

func (p *KV[K, V]) SetItem(key K, value V) error

type KeyType

type KeyType interface {
	constraints.Integer | constraints.Float | bool | string | []byte
}

Jump to

Keyboard shortcuts

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