functions

package
v0.0.0-...-7072161 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fn

type Fn interface {
	ID() string
	Type() string
	Handle(ctx context.Context, msg *events.FunctionUpdated, storage database.Storage, msgCtx messaging.MsgContext, opts ...options.Option) error
}

func New

func New() Fn

type Registry

type Registry interface {
	Find(ctx context.Context, matchers ...RegistryMatcherFunc) ([]RegistryItem, error)
}

func NewRegistry

func NewRegistry(ctx context.Context, input io.Reader) (Registry, error)

type RegistryItem

type RegistryItem struct {
	FnID    string
	Type    string
	Fn      Fn
	Options []options.Option
}

type RegistryMatcherFunc

type RegistryMatcherFunc func(r *registry) []RegistryItem

func FindByFunctionID

func FindByFunctionID(functionId string) RegistryMatcherFunc

type RegistryMock

type RegistryMock struct {
	// FindFunc mocks the Find method.
	FindFunc func(ctx context.Context, matchers ...RegistryMatcherFunc) ([]RegistryItem, error)
	// contains filtered or unexported fields
}

RegistryMock is a mock implementation of Registry.

func TestSomethingThatUsesRegistry(t *testing.T) {

	// make and configure a mocked Registry
	mockedRegistry := &RegistryMock{
		FindFunc: func(ctx context.Context, matchers ...RegistryMatcherFunc) ([]RegistryItem, error) {
			panic("mock out the Find method")
		},
	}

	// use mockedRegistry in code that requires Registry
	// and then make assertions.

}

func (*RegistryMock) Find

func (mock *RegistryMock) Find(ctx context.Context, matchers ...RegistryMatcherFunc) ([]RegistryItem, error)

Find calls FindFunc.

func (*RegistryMock) FindCalls

func (mock *RegistryMock) FindCalls() []struct {
	Ctx      context.Context
	Matchers []RegistryMatcherFunc
}

FindCalls gets all the calls that were made to Find. Check the length with:

len(mockedRegistry.FindCalls())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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