mocks

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mocks provides test doubles for external interfaces used by the service package.

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongRevision = errors.New("wrong last revision")

ErrWrongRevision is returned by KeyValue.Update when the supplied revision does not match.

Functions

This section is empty.

Types

type KeyValue

type KeyValue struct {
	PutErr    error            // if non-nil, Put returns this error
	GetErrFor map[string]error // if a key is present, Get returns that error instead of looking up the entry
	// contains filtered or unexported fields
}

KeyValue is a thread-safe in-memory mock that satisfies natsgo.KeyValue. Get, Put, Update, and PutString are functional. All other methods return an "not implemented" error — they exist only to satisfy the interface.

func NewKeyValue

func NewKeyValue() *KeyValue

NewKeyValue returns an empty KeyValue mock.

func (*KeyValue) Bucket

func (m *KeyValue) Bucket() string

func (*KeyValue) Create

func (m *KeyValue) Create(_ string, _ []byte) (uint64, error)

func (*KeyValue) Delete

func (m *KeyValue) Delete(_ string, _ ...natsgo.DeleteOpt) error

func (*KeyValue) Get

func (m *KeyValue) Get(key string) (natsgo.KeyValueEntry, error)

func (*KeyValue) GetRevision

func (m *KeyValue) GetRevision(_ string, _ uint64) (natsgo.KeyValueEntry, error)

func (*KeyValue) History

func (m *KeyValue) History(_ string, _ ...natsgo.WatchOpt) ([]natsgo.KeyValueEntry, error)

func (*KeyValue) Keys

func (m *KeyValue) Keys(_ ...natsgo.WatchOpt) ([]string, error)

func (*KeyValue) ListKeys

func (m *KeyValue) ListKeys(_ ...natsgo.WatchOpt) (natsgo.KeyLister, error)

func (*KeyValue) Purge

func (m *KeyValue) Purge(_ string, _ ...natsgo.DeleteOpt) error

func (*KeyValue) PurgeDeletes

func (m *KeyValue) PurgeDeletes(_ ...natsgo.PurgeOpt) error

func (*KeyValue) Put

func (m *KeyValue) Put(key string, value []byte) (uint64, error)

func (*KeyValue) PutString

func (m *KeyValue) PutString(key string, value string) (uint64, error)

func (*KeyValue) Status

func (m *KeyValue) Status() (natsgo.KeyValueStatus, error)

func (*KeyValue) Update

func (m *KeyValue) Update(key string, value []byte, last uint64) (uint64, error)

func (*KeyValue) Watch

func (m *KeyValue) Watch(_ string, _ ...natsgo.WatchOpt) (natsgo.KeyWatcher, error)

func (*KeyValue) WatchAll

func (m *KeyValue) WatchAll(_ ...natsgo.WatchOpt) (natsgo.KeyWatcher, error)

func (*KeyValue) WatchFiltered

func (m *KeyValue) WatchFiltered(_ []string, _ ...natsgo.WatchOpt) (natsgo.KeyWatcher, error)

Jump to

Keyboard shortcuts

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