kvstore

package
v0.60.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package kvstore provides a generic key-value store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface[V any] interface {
	Put(key string, value V) error
	Get(key string) (V, bool, error)
	Delete(key string) error
	Upsert(key string, upsert func(v V, created bool) (V, error)) (V, error)
}

func Require

func Require[V any]() Interface[V]

Require ensures that a configued and provisioned KV store is available.

type KV

type KV[V any] struct {
	// contains filtered or unexported fields
}

func (*KV[V]) Delete

func (k *KV[V]) Delete(key string) error

func (*KV[V]) Get

func (k *KV[V]) Get(key string) (V, bool, error)

func (*KV[V]) Put

func (k *KV[V]) Put(key string, value V) error

func (*KV[V]) Upsert

func (k *KV[V]) Upsert(key string, upsert func(v V, created bool) (V, error)) (V, error)

Upsert atomically inserts or updates an entry.

Jump to

Keyboard shortcuts

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