kvs

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToNumber

func AddToNumber[T Numbers](store KeyValueStore, key interface{}, increment T) (updated T, err error)

func AppendToFlatList

func AppendToFlatList[T interface{}](store KeyValueStore, key string, value T) (err error)

func AppendToSlice

func AppendToSlice[T Variables](store KeyValueStore, key interface{}, values ...T) (err error)

func AppendToStringSlice added in v0.2.11

func AppendToStringSlice(store KeyValueStore, key interface{}, values ...string) (err error)

func CountDistinctFlatListValues added in v0.2.11

func CountDistinctFlatListValues[T comparable](store KeyValueStore, key string) (count uint64)

func CountFlatList added in v0.2.11

func CountFlatList(store KeyValueStore, key string) (count uint64)

func CountFlatListValues added in v0.2.11

func CountFlatListValues[T comparable](store KeyValueStore, key string) (counts map[T]uint64)

func DecodeKeyValue added in v0.2.11

func DecodeKeyValue(valueKey string) (value interface{}, err error)

func EncodeKeyValue added in v0.2.11

func EncodeKeyValue(value interface{}) (valueKey string, err error)

func FlatListEmpty added in v0.2.11

func FlatListEmpty(store KeyValueStore, key string) (empty bool)

func GetFlatList

func GetFlatList[T interface{}](store KeyValueStore, key string) (values []T)

func GetSlice

func GetSlice[T Variables](store KeyValueStore, key interface{}) (values []T, err error)

func GetStringSlice added in v0.2.11

func GetStringSlice(store KeyValueStore, key interface{}) (values []string, err error)

func GetValue

func GetValue[T interface{}](store KeyValueStore, key interface{}) (value T)

func MakeFlatListKey

func MakeFlatListKey(key string, suffixes ...string) (name string)

func RemoveFromSlice

func RemoveFromSlice[T Variables](store KeyValueStore, key interface{}, values ...T) (err error)

func StringSliceEmpty added in v0.2.11

func StringSliceEmpty(store KeyValueStore, key interface{}) (empty bool)

func YieldFlatList

func YieldFlatList[T interface{}](store KeyValueStore, key string) (yield chan T)

Types

type Contents

type Contents interface {
	byte | string
}

type KeyValueCache

type KeyValueCache interface {
	// Bucket returns the named bucket or adds a new bucket and returns that
	Bucket(name string) (kvs KeyValueStore, err error)
	// MustBucket uses Bucket and log.FatalDF on error
	MustBucket(name string) (kvs KeyValueStore)
	// AddBucket adds and returns a new bucket, errors if already exists
	AddBucket(name string) (kvs KeyValueStore, err error)
	// GetBucket returns a new bucket, errors if not found
	GetBucket(name string) (kvs KeyValueStore, err error)
	// GetBucketSource returns the underlying cache object, or nil if not found
	GetBucketSource(name string) (src interface{})
}

type KeyValueCaches

type KeyValueCaches interface {
	Get(name string) (kvs KeyValueCache, err error)
}

type KeyValueStore

type KeyValueStore interface {
	Get(key interface{}) (value interface{}, err error)
	Set(key interface{}, value interface{}) (err error)
}

type KeyValueStoreAny

type KeyValueStoreAny interface {
	Get(key interface{}) (value interface{}, ok bool)
	Set(key interface{}, value interface{})
}

func NewKVSA

func NewKVSA(kvs KeyValueStore) (kvsa KeyValueStoreAny)

type Numbers

type Numbers interface {
	uint | uint8 | uint16 | uint32 | uint64 |
		int | int8 | int16 | int32 | int64 |
		float32 | float64
}

type Variables

type Variables interface {
	Numbers | Contents
}

Jump to

Keyboard shortcuts

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