hooks

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPersistentRepo

func NewPersistentRepo(
	localHooks map[string]taskengine.HookRepo,
	dbInstance libdb.DBManager,
	httpClient *http.Client,
) taskengine.HookRepo

func NewSimpleProvider

func NewSimpleProvider(hooks map[string]taskengine.HookRepo) taskengine.HookRepo

Types

type HookCallRecord

type HookCallRecord struct {
	Args       taskengine.HookCall
	Input      any
	InputType  taskengine.DataType
	Transition string
}

type HookResponse

type HookResponse struct {
	Status     int
	Output     any
	OutputType taskengine.DataType
	Transition string
}

type MockHookRepo

type MockHookRepo struct {
	Calls           []HookCallRecord
	ResponseMap     map[string]HookResponse
	DefaultResponse HookResponse
	ErrorSequence   []error
	// contains filtered or unexported fields
}

MockHookRepo is a mock implementation of the HookProvider interface.

func NewMockHookRegistry

func NewMockHookRegistry() *MockHookRepo

NewMockHookRegistry returns a new instance of MockHookProvider.

func (*MockHookRepo) CallCount

func (m *MockHookRepo) CallCount() int

CallCount returns number of times Exec was called

func (*MockHookRepo) Exec

func (m *MockHookRepo) Exec(
	ctx context.Context,
	startingTime time.Time,
	input any,
	inputType taskengine.DataType,
	transition string,
	args *taskengine.HookCall,
) (int, any, taskengine.DataType, string, error)

Exec simulates execution of a hook call.

func (*MockHookRepo) LastCall

func (m *MockHookRepo) LastCall() *HookCallRecord

LastCall returns the most recent hook call

func (*MockHookRepo) Reset

func (m *MockHookRepo) Reset()

Reset clears all recorded calls and resets counters

func (*MockHookRepo) Supports

func (m *MockHookRepo) Supports(ctx context.Context) ([]string, error)

func (*MockHookRepo) WithErrorSequence

func (m *MockHookRepo) WithErrorSequence(errors ...error) *MockHookRepo

WithErrorSequence sets a sequence of errors to return

func (*MockHookRepo) WithResponse

func (m *MockHookRepo) WithResponse(hookType string, response HookResponse) *MockHookRepo

WithResponse configures a response for a specific hook type

type PersistentRepo

type PersistentRepo struct {
	// contains filtered or unexported fields
}

func (*PersistentRepo) Exec

func (p *PersistentRepo) Exec(
	ctx context.Context,
	startingTime time.Time,
	input any,
	dataType taskengine.DataType,
	transition string,
	args *taskengine.HookCall,
) (any, taskengine.DataType, string, error)

func (*PersistentRepo) Supports

func (p *PersistentRepo) Supports(ctx context.Context) ([]string, error)

type SimpleRepo

type SimpleRepo struct {
	// contains filtered or unexported fields
}

func (*SimpleRepo) Exec

func (m *SimpleRepo) Exec(ctx context.Context, startingTime time.Time, input any, dataType taskengine.DataType, transition string, args *taskengine.HookCall) (any, taskengine.DataType, string, error)

func (*SimpleRepo) Supports

func (m *SimpleRepo) Supports(ctx context.Context) ([]string, error)

Jump to

Keyboard shortcuts

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