matcher

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyOperationId

type EmptyOperationId struct{}

func (*EmptyOperationId) Error

func (e *EmptyOperationId) Error() string

type EntityCreationError

type EntityCreationError struct{}

func (*EntityCreationError) Error

func (e *EntityCreationError) Error() string

type EntityCreationKeyLookupError

type EntityCreationKeyLookupError struct {
	Key         string
	OperationId string
}

func (*EntityCreationKeyLookupError) Error

type Matcher

type Matcher struct {
	Types          map[string]reflect.Type
	EntityCreators map[string]entity.EntityFactoryFunc
}

The matcher is utilized in order to keep track of the name and type of each operation. This is required because we only send the OperationRequest through the service bus, but we utilize the name in that struct to create an instance of the right operation type (e.g. LongRunning) and Run with the correct logic. The matcher can also be used to create the Entity based on the name of the operation by using a stored EntityFactoryFunc.

func NewMatcher

func NewMatcher() *Matcher

func (*Matcher) CreateEntityInstance

func (m *Matcher) CreateEntityInstance(ctx context.Context, key string, lastOperationId string) (entity.Entity, error)

This will create an Entity using the EntityFactoryFunc with the lastOperationId by matching with the key passed in.

func (*Matcher) CreateHookedInstance

func (m *Matcher) CreateHookedInstance(ctx context.Context, key string, hookList []hooks.BaseOperationHooksInterface) (*hooks.HookedApiOperation, error)

Creates an instance of the operation with hooks enabled.

func (*Matcher) CreateOperationInstance

func (m *Matcher) CreateOperationInstance(ctx context.Context, key string) (operation.ApiOperation, error)

This will create an empty instance of the type, with which you can then call op.Init() and initialize any info you need.

func (*Matcher) Get

func (m *Matcher) Get(ctx context.Context, key string) (reflect.Type, bool)

Get retrieves a type from the map by its key.

func (*Matcher) Register

func (m *Matcher) Register(ctx context.Context, key string, value operation.ApiOperation)

Set adds a key-value pair to the map Ex: matcher.Register("LongRunning", &LongRunning{})

func (*Matcher) RegisterEntity

func (m *Matcher) RegisterEntity(ctx context.Context, key string, value entity.EntityFactoryFunc)

Set adds a key-value pair to the map Ex: matcher.RegisterEntity("LongRunning", longRunningOperation.CreateLroEntityFunc)

type OperationKeyLookupError

type OperationKeyLookupError struct {
	Key string
}

func (*OperationKeyLookupError) Error

func (e *OperationKeyLookupError) Error() string

Jump to

Keyboard shortcuts

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