kvs

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 2 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 GetFlatList

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

func GetSlice

func GetSlice[T Variables](store KeyValueStore, key interface{}) (values []T, 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 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)
}

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