keyvalue

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewKv

func NewKv(name string) *kvstore

NewKv - Create a new Key/Value store resource

Types

type KeyStream

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

TODO: maybe move keystream to separate file

func (*KeyStream) Recv

func (k *KeyStream) Recv() (string, error)

type KvStore

type KvStore interface {
	// Allow requests the given permissions to the key/value store.
	Allow(permission KvStorePermission, permissions ...KvStorePermission) KvStoreClientIface
}

type KvStoreClient

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

func NewKvStoreClient

func NewKvStoreClient(name string) (*KvStoreClient, error)

func (*KvStoreClient) Delete

func (s *KvStoreClient) Delete(ctx context.Context, key string) error

func (*KvStoreClient) Get

func (s *KvStoreClient) Get(ctx context.Context, key string) (map[string]interface{}, error)

func (*KvStoreClient) Keys

func (s *KvStoreClient) Keys(ctx context.Context, opts ...ScanKeysOption) (*KeyStream, error)

func (*KvStoreClient) Name

func (s *KvStoreClient) Name() string

func (*KvStoreClient) Set

func (s *KvStoreClient) Set(ctx context.Context, key string, value map[string]interface{}) error

type KvStoreClientIface

type KvStoreClientIface interface {
	// Name - The name of the store
	Name() string
	// Get a value from the store
	Get(ctx context.Context, key string) (map[string]interface{}, error)
	// Set a value in the store
	Set(ctx context.Context, key string, value map[string]interface{}) error
	// Delete a value from the store
	Delete(ctx context.Context, key string) error
	// Return an async iterable of keys in the store
	Keys(ctx context.Context, options ...ScanKeysOption) (*KeyStream, error)
}

type KvStorePermission

type KvStorePermission string
const (
	KvStoreSet    KvStorePermission = "set"
	KvStoreGet    KvStorePermission = "get"
	KvStoreDelete KvStorePermission = "delete"
)

type ScanKeysOption

type ScanKeysOption = func(*ScanKeysRequest)

func WithPrefix

func WithPrefix(prefix string) ScanKeysOption

Apply a prefix to the scan keys request

type ScanKeysRequest

type ScanKeysRequest = v1.KvStoreScanKeysRequest

Jump to

Keyboard shortcuts

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