hooks

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package hooks provides a middleware system for CM operations.

Package hooks is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMInterface

type CMInterface interface {
}

CMInterface defines the interface that hooks need from CM.

type ErrorHook

type ErrorHook interface {
	Hook
	OnError(ctx *HookContext) error
}

ErrorHook executes when an operation fails.

type Hook

type Hook interface {
	Name() string
	Priority() int
	Execute(ctx *HookContext) error
}

Hook defines the interface for all hooks.

type HookContext

type HookContext struct {
	OperationName string
	Parameters    map[string]interface{}
	Results       map[string]interface{}
	Error         error
	CM            CMInterface
	Metadata      map[string]interface{}
}

HookContext provides context for hook execution.

type HookManager

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

HookManager manages hook registration and execution.

func (*HookManager) DisableHook

func (hm *HookManager) DisableHook(_, _ string) error

DisableHook disables a hook by name (placeholder for future implementation).

func (*HookManager) EnableHook

func (hm *HookManager) EnableHook(_, _ string) error

EnableHook enables a hook by name (placeholder for future implementation).

func (*HookManager) ExecuteErrorHooks

func (hm *HookManager) ExecuteErrorHooks(operation string, ctx *HookContext) error

ExecuteErrorHooks executes all error-hooks for a specific operation.

func (*HookManager) ExecutePostHooks

func (hm *HookManager) ExecutePostHooks(operation string, ctx *HookContext) error

ExecutePostHooks executes all post-hooks for a specific operation.

func (*HookManager) ExecutePreHooks

func (hm *HookManager) ExecutePreHooks(operation string, ctx *HookContext) error

ExecutePreHooks executes all pre-hooks for a specific operation.

func (*HookManager) ListHooks

func (hm *HookManager) ListHooks(operation string) ([]Hook, error)

ListHooks lists all hooks for a specific operation.

func (*HookManager) RegisterErrorHook

func (hm *HookManager) RegisterErrorHook(operation string, hook ErrorHook) error

RegisterErrorHook registers an error-hook for a specific operation.

func (*HookManager) RegisterPostHook

func (hm *HookManager) RegisterPostHook(operation string, hook PostHook) error

RegisterPostHook registers a post-hook for a specific operation.

func (*HookManager) RegisterPreHook

func (hm *HookManager) RegisterPreHook(operation string, hook PreHook) error

RegisterPreHook registers a pre-hook for a specific operation.

func (*HookManager) RemoveHook

func (hm *HookManager) RemoveHook(operation, hookName string) error

RemoveHook removes a hook by name from a specific operation.

type HookManagerInterface

type HookManagerInterface interface {
	// Hook registration.
	RegisterPreHook(operation string, hook PreHook) error
	RegisterPostHook(operation string, hook PostHook) error
	RegisterErrorHook(operation string, hook ErrorHook) error

	// Hook execution.
	ExecutePreHooks(operation string, ctx *HookContext) error
	ExecutePostHooks(operation string, ctx *HookContext) error
	ExecuteErrorHooks(operation string, ctx *HookContext) error

	// Hook management.
	RemoveHook(operation, hookName string) error
	EnableHook(operation, hookName string) error
	DisableHook(operation, hookName string) error
	ListHooks(operation string) ([]Hook, error)
}

HookManagerInterface defines the interface for hook management.

func NewHookManager

func NewHookManager() HookManagerInterface

NewHookManager creates a new HookManager instance.

type MockHookManagerInterface

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

MockHookManagerInterface is a mock of HookManagerInterface interface.

func NewMockHookManagerInterface

func NewMockHookManagerInterface(ctrl *gomock.Controller) *MockHookManagerInterface

NewMockHookManagerInterface creates a new mock instance.

func (*MockHookManagerInterface) DisableHook

func (m *MockHookManagerInterface) DisableHook(operation, hookName string) error

DisableHook mocks base method.

func (*MockHookManagerInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHookManagerInterface) EnableHook

func (m *MockHookManagerInterface) EnableHook(operation, hookName string) error

EnableHook mocks base method.

func (*MockHookManagerInterface) ExecuteErrorHooks

func (m *MockHookManagerInterface) ExecuteErrorHooks(operation string, ctx *HookContext) error

ExecuteErrorHooks mocks base method.

func (*MockHookManagerInterface) ExecutePostHooks

func (m *MockHookManagerInterface) ExecutePostHooks(operation string, ctx *HookContext) error

ExecutePostHooks mocks base method.

func (*MockHookManagerInterface) ExecutePreHooks

func (m *MockHookManagerInterface) ExecutePreHooks(operation string, ctx *HookContext) error

ExecutePreHooks mocks base method.

func (*MockHookManagerInterface) ListHooks

func (m *MockHookManagerInterface) ListHooks(operation string) ([]Hook, error)

ListHooks mocks base method.

func (*MockHookManagerInterface) RegisterErrorHook

func (m *MockHookManagerInterface) RegisterErrorHook(operation string, hook ErrorHook) error

RegisterErrorHook mocks base method.

func (*MockHookManagerInterface) RegisterPostHook

func (m *MockHookManagerInterface) RegisterPostHook(operation string, hook PostHook) error

RegisterPostHook mocks base method.

func (*MockHookManagerInterface) RegisterPreHook

func (m *MockHookManagerInterface) RegisterPreHook(operation string, hook PreHook) error

RegisterPreHook mocks base method.

func (*MockHookManagerInterface) RemoveHook

func (m *MockHookManagerInterface) RemoveHook(operation, hookName string) error

RemoveHook mocks base method.

type MockHookManagerInterfaceMockRecorder

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

MockHookManagerInterfaceMockRecorder is the mock recorder for MockHookManagerInterface.

func (*MockHookManagerInterfaceMockRecorder) DisableHook

func (mr *MockHookManagerInterfaceMockRecorder) DisableHook(operation, hookName any) *gomock.Call

DisableHook indicates an expected call of DisableHook.

func (*MockHookManagerInterfaceMockRecorder) EnableHook

func (mr *MockHookManagerInterfaceMockRecorder) EnableHook(operation, hookName any) *gomock.Call

EnableHook indicates an expected call of EnableHook.

func (*MockHookManagerInterfaceMockRecorder) ExecuteErrorHooks

func (mr *MockHookManagerInterfaceMockRecorder) ExecuteErrorHooks(operation, ctx any) *gomock.Call

ExecuteErrorHooks indicates an expected call of ExecuteErrorHooks.

func (*MockHookManagerInterfaceMockRecorder) ExecutePostHooks

func (mr *MockHookManagerInterfaceMockRecorder) ExecutePostHooks(operation, ctx any) *gomock.Call

ExecutePostHooks indicates an expected call of ExecutePostHooks.

func (*MockHookManagerInterfaceMockRecorder) ExecutePreHooks

func (mr *MockHookManagerInterfaceMockRecorder) ExecutePreHooks(operation, ctx any) *gomock.Call

ExecutePreHooks indicates an expected call of ExecutePreHooks.

func (*MockHookManagerInterfaceMockRecorder) ListHooks

func (mr *MockHookManagerInterfaceMockRecorder) ListHooks(operation any) *gomock.Call

ListHooks indicates an expected call of ListHooks.

func (*MockHookManagerInterfaceMockRecorder) RegisterErrorHook

func (mr *MockHookManagerInterfaceMockRecorder) RegisterErrorHook(operation, hook any) *gomock.Call

RegisterErrorHook indicates an expected call of RegisterErrorHook.

func (*MockHookManagerInterfaceMockRecorder) RegisterPostHook

func (mr *MockHookManagerInterfaceMockRecorder) RegisterPostHook(operation, hook any) *gomock.Call

RegisterPostHook indicates an expected call of RegisterPostHook.

func (*MockHookManagerInterfaceMockRecorder) RegisterPreHook

func (mr *MockHookManagerInterfaceMockRecorder) RegisterPreHook(operation, hook any) *gomock.Call

RegisterPreHook indicates an expected call of RegisterPreHook.

func (*MockHookManagerInterfaceMockRecorder) RemoveHook

func (mr *MockHookManagerInterfaceMockRecorder) RemoveHook(operation, hookName any) *gomock.Call

RemoveHook indicates an expected call of RemoveHook.

type PostHook

type PostHook interface {
	Hook
	PostExecute(ctx *HookContext) error
}

PostHook executes after an operation.

type PreHook

type PreHook interface {
	Hook
	PreExecute(ctx *HookContext) error
}

PreHook executes before an operation.

Directories

Path Synopsis
Package ide provides IDE opening functionality through hooks.
Package ide provides IDE opening functionality through hooks.

Jump to

Keyboard shortcuts

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