kvstore

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Maker

type Maker[K, V any] func() Store[K, V]

Maker is a factory function for creating a Store.

func MappedMaker

func MappedMaker[K comparable, V any]() Maker[K, V]

MappedMaker returns a Maker that calls NewMapped. The key type K must be comparable.

func SortedMaker

func SortedMaker[K any, V any](compare cmp.Comparer[K]) Maker[K, V]

SortedMaker returns a Maker that calls NewSorted with the given cmp.Comparer.

type Store

type Store[K, V any] interface {
	Size() int
	Get(key K) opt.Optional[V]
	Put(key K, value V)
	ForEach(func(key K, value V) bool) bool
	ForEachKey(func(key K) bool) bool
}

Store represents a container of key-value pairs. Used internally for key-grouping and key-joining operations.

func NewMapped

func NewMapped[K comparable, V any]() Store[K, V]

NewMapped creates a new Store backed by a map. The key type K must be comparable.

func NewSorted

func NewSorted[K any, V any](compare cmp.Comparer[K]) Store[K, V]

NewSorted creates a new Store of sorted keys, ordered by the given cmp.Comparer.

Jump to

Keyboard shortcuts

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