testing

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package testing provides mock implementations for testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockKVS

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

MockKVS is a simple in-memory key-value store for testing

func NewMockKVS

func NewMockKVS() *MockKVS

NewMockKVS creates a new mock KVS client

func (*MockKVS) Clear

func (m *MockKVS) Clear()

Clear removes all keys (helper for testing)

func (*MockKVS) Delete

func (m *MockKVS) Delete(key string)

Delete removes a key (helper for testing)

func (*MockKVS) GetAny

func (m *MockKVS) GetAny(ctx context.Context, key string, val any) error

GetAny retrieves a value and unmarshals it

func (*MockKVS) GetOrDefaultString

func (m *MockKVS) GetOrDefaultString(ctx context.Context, key, def string) string

GetOrDefaultString retrieves a string value or returns default

func (*MockKVS) GetString

func (m *MockKVS) GetString(ctx context.Context, key string) (string, error)

GetString retrieves a string value

func (*MockKVS) Keys

func (m *MockKVS) Keys() []string

Keys returns all keys (helper for testing)

func (*MockKVS) SetAny

func (m *MockKVS) SetAny(ctx context.Context, key string, val any) error

SetAny stores any value as JSON

func (*MockKVS) SetString

func (m *MockKVS) SetString(ctx context.Context, key, val string) error

SetString stores a string value

func (*MockKVS) Size

func (m *MockKVS) Size() int

Size returns the number of keys (helper for testing)

Jump to

Keyboard shortcuts

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