kv

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package kv provides access to Spin key-value stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store represents a connection to a key-value store.

func Open

func Open(label string) (*Store, error)

Open opens the store with the specified label.

func OpenDefault

func OpenDefault() (*Store, error)

OpenDefault opens the default store.

This is equivalent to Open("default").

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete removes the given key/value from the store.

func (*Store) Exists

func (s *Store) Exists(key string) (bool, error)

Exists checks if a given key exists in the store.

func (*Store) Get

func (s *Store) Get(key string) ([]byte, error)

Get returns the value of the provided key from the store.

func (*Store) GetKeys

func (s *Store) GetKeys() iter.Seq2[string, error]

GetKeys returns an iterator over the keys in the store. Keys are yielded as they arrive from the host, allowing the consumer to process them concurrently with the underlying stream read.

The iterator yields each key with a nil error. If the host reports an error after the stream completes, a final pair of ("", err) is yielded. Stopping the iteration early releases the underlying stream.

func (*Store) Set

func (s *Store) Set(key string, value []byte) error

Set sets the key/value pair in the store.

Jump to

Keyboard shortcuts

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