Help us shape the future of Go! Take the 2026 Go Developer Survey

mock

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0, CC-BY-SA-4.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(endpoints []string, options *store.Config) (store.Store, error)

New creates a Mock store

Types

type Lock

type Lock struct {
	mock.Mock
}

Lock mock implementation of Locker

func (*Lock) Lock

func (l *Lock) Lock(stopCh chan struct{}) (<-chan struct{}, error)

Lock mock

func (*Lock) Unlock

func (l *Lock) Unlock() error

Unlock mock

type Mock

type Mock struct {
	mock.Mock

	// Endpoints passed to InitializeMock
	Endpoints []string

	// Options passed to InitializeMock
	Options *store.Config
}

Mock store. Mocks all Store functions using testify.Mock

func (*Mock) AtomicDelete

func (s *Mock) AtomicDelete(key string, previous *store.KVPair) (bool, error)

AtomicDelete mock

func (*Mock) AtomicPut

func (s *Mock) AtomicPut(key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error)

AtomicPut mock

func (*Mock) Close

func (s *Mock) Close()

Close mock

func (*Mock) Delete

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

Delete mock

func (*Mock) DeleteTree

func (s *Mock) DeleteTree(prefix string) error

DeleteTree mock

func (*Mock) Exists

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

Exists mock

func (*Mock) Get

func (s *Mock) Get(key string) (*store.KVPair, error)

Get mock

func (*Mock) List

func (s *Mock) List(prefix string) ([]*store.KVPair, error)

List mock

func (*Mock) NewLock

func (s *Mock) NewLock(key string, options *store.LockOptions) (store.Locker, error)

NewLock mock

func (*Mock) Put

func (s *Mock) Put(key string, value []byte, opts *store.WriteOptions) error

Put mock

func (*Mock) Watch

func (s *Mock) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error)

Watch mock

func (*Mock) WatchTree

func (s *Mock) WatchTree(prefix string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error)

WatchTree mock

Jump to

Keyboard shortcuts

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