Documentation
¶
Index ¶
- type ProjectorModule
- func (pm *ProjectorModule) ID() string
- func (pm *ProjectorModule) Init(ctx context.Context, rt mdk.Runtime) error
- func (pm *ProjectorModule) Models() []any
- func (pm *ProjectorModule) Projector() mdk.Projector
- func (pm *ProjectorModule) Routes() []mdk.Route
- func (pm *ProjectorModule) Shutdown(ctx context.Context) error
- type TestEventBus
- type TestLineageData
- func (tld TestLineageData) GetEndedAt() *time.Time
- func (tld TestLineageData) GetError() string
- func (tld TestLineageData) GetEvents() []mdk.Event
- func (tld TestLineageData) GetID() string
- func (tld TestLineageData) GetName() string
- func (tld TestLineageData) GetStartedAt() time.Time
- func (tld TestLineageData) GetState() string
- type TestProjector
- type TestRuntime
- func (tr *TestRuntime) Bus() mdk.EventBus
- func (tr *TestRuntime) Config(key string) any
- func (tr *TestRuntime) DB() *gorm.DB
- func (tr *TestRuntime) Logger() *slog.Logger
- func (tr *TestRuntime) Module(id string) (mdk.Module, bool)
- func (tr *TestRuntime) SetConfig(key string, val any)
- func (tr *TestRuntime) SetLogger(l *slog.Logger)
- func (tr *TestRuntime) SetModule(id string, m mdk.Module)
- func (tr *TestRuntime) Workflows() mdk.WorkflowEngine
- type TestWorkflowEngine
- func (twe *TestWorkflowEngine) Cancel(ctx context.Context, runID string) error
- func (twe *TestWorkflowEngine) Execute(ctx context.Context, workflowID string, input map[string]any) (string, error)
- func (twe *TestWorkflowEngine) ExecuteSync(ctx context.Context, runID, workflowID string, input map[string]any) (map[string]any, error)
- func (twe *TestWorkflowEngine) Register(w mdk.Workflow) error
- func (twe *TestWorkflowEngine) RegisterHandler(name string, handler mdk.StepHandler) error
- func (twe *TestWorkflowEngine) Status(ctx context.Context, runID string) (mdk.StepStatus, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProjectorModule ¶
ProjectorModule is a generic mock implementation of a module that provides a Projector.
func (*ProjectorModule) ID ¶
func (pm *ProjectorModule) ID() string
ID returns the module ID, defaulting to "core.context".
func (*ProjectorModule) Models ¶
func (pm *ProjectorModule) Models() []any
func (*ProjectorModule) Projector ¶
func (pm *ProjectorModule) Projector() mdk.Projector
func (*ProjectorModule) Routes ¶
func (pm *ProjectorModule) Routes() []mdk.Route
type TestEventBus ¶
TestEventBus is an in-memory implementation of EventBus for testing.
func NewTestEventBus ¶
func NewTestEventBus(rt *TestRuntime) *TestEventBus
func (*TestEventBus) Subscribe ¶
func (teb *TestEventBus) Subscribe(namespace, eventType string, handler mdk.EventHandler) (func(), error)
type TestLineageData ¶
type TestLineageData struct {
ID string
Name string
State string
Error string
StartedAt time.Time
EndedAt *time.Time
Events []mdk.Event
}
TestLineageData implements LineageData for testing.
func (TestLineageData) GetEndedAt ¶
func (tld TestLineageData) GetEndedAt() *time.Time
func (TestLineageData) GetError ¶
func (tld TestLineageData) GetError() string
func (TestLineageData) GetEvents ¶
func (tld TestLineageData) GetEvents() []mdk.Event
func (TestLineageData) GetID ¶
func (tld TestLineageData) GetID() string
func (TestLineageData) GetName ¶
func (tld TestLineageData) GetName() string
func (TestLineageData) GetStartedAt ¶
func (tld TestLineageData) GetStartedAt() time.Time
func (TestLineageData) GetState ¶
func (tld TestLineageData) GetState() string
type TestProjector ¶
type TestProjector struct {
Lineages []mdk.LineageData
}
TestProjector implements Projector for testing.
func (*TestProjector) ListLineages ¶
func (tp *TestProjector) ListLineages() []mdk.LineageData
func (*TestProjector) QueryLineages ¶
func (tp *TestProjector) QueryLineages(filter func(mdk.LineageData) bool) []mdk.LineageData
type TestRuntime ¶
type TestRuntime struct {
// contains filtered or unexported fields
}
TestRuntime is a concrete, in-memory implementation of Runtime designed for unit testing.
func NewTestRuntime ¶
func NewTestRuntime(db *gorm.DB) *TestRuntime
NewTestRuntime creates a new TestRuntime instance.
func (*TestRuntime) Bus ¶
func (tr *TestRuntime) Bus() mdk.EventBus
func (*TestRuntime) Config ¶
func (tr *TestRuntime) Config(key string) any
func (*TestRuntime) DB ¶
func (tr *TestRuntime) DB() *gorm.DB
func (*TestRuntime) Logger ¶
func (tr *TestRuntime) Logger() *slog.Logger
func (*TestRuntime) SetConfig ¶
func (tr *TestRuntime) SetConfig(key string, val any)
func (*TestRuntime) SetLogger ¶
func (tr *TestRuntime) SetLogger(l *slog.Logger)
func (*TestRuntime) Workflows ¶
func (tr *TestRuntime) Workflows() mdk.WorkflowEngine
type TestWorkflowEngine ¶
type TestWorkflowEngine struct {
// contains filtered or unexported fields
}
TestWorkflowEngine is a simple, synchronous implementation of WorkflowEngine for unit tests.
func NewTestWorkflowEngine ¶
func NewTestWorkflowEngine(rt *TestRuntime) *TestWorkflowEngine
func (*TestWorkflowEngine) Cancel ¶
func (twe *TestWorkflowEngine) Cancel(ctx context.Context, runID string) error
func (*TestWorkflowEngine) ExecuteSync ¶
func (*TestWorkflowEngine) RegisterHandler ¶
func (twe *TestWorkflowEngine) RegisterHandler(name string, handler mdk.StepHandler) error
func (*TestWorkflowEngine) Status ¶
func (twe *TestWorkflowEngine) Status(ctx context.Context, runID string) (mdk.StepStatus, error)
Click to show internal directories.
Click to hide internal directories.