colltest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockValueCodec

func MockValueCodec[T any]() codec.ValueCodec[T]

MockValueCodec returns a mock of collections.ValueCodec for type T, it can be used for collections Values testing. It also supports interfaces. For the interfaces cases, in order for an interface to be decoded it must have been encoded first. Not concurrency safe. EG: Let's say the value is interface Animal if I want to decode Dog which implements Animal, then I need to first encode it in order to make the type known by the MockValueCodec.

func TestKeyCodec

func TestKeyCodec[T any](t *testing.T, keyCodec codec.KeyCodec[T], key T)

TestKeyCodec asserts the correct behavior of a KeyCodec over the type T.

func TestValueCodec

func TestValueCodec[T any](t *testing.T, encoder codec.ValueCodec[T], value T)

TestValueCodec asserts the correct behavior of a ValueCodec over the type T.

Types

type StoreService

type StoreService struct{}

func MockStore

func MockStore() (*StoreService, context.Context)

MockStore returns a mock store.KVStoreService and a mock context.Context. They can be used to test collections. The StoreService.NewStoreContext can be used to instantiate a new empty KVStore.

func (StoreService) NewStoreContext

func (s StoreService) NewStoreContext() context.Context

func (StoreService) OpenKVStore

func (s StoreService) OpenKVStore(ctx context.Context) store.KVStore

Jump to

Keyboard shortcuts

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