mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-08-22 14:28:58 +00:00
switch modules to accept an InputHandler instead of the full router
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
type Module interface {
|
||||
Id() string
|
||||
Type() string
|
||||
Start(context.Context, RouteIO) error
|
||||
Start(context.Context, InputHandler) error
|
||||
Stop()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package common
|
||||
|
||||
type WrappedPayload struct {
|
||||
Payload any
|
||||
Router RouteIO
|
||||
Modules map[string]Module
|
||||
Source string
|
||||
End bool
|
||||
Payload any
|
||||
InputHandler InputHandler
|
||||
Modules map[string]Module
|
||||
Source string
|
||||
End bool
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type RouteIO interface {
|
||||
HandleInput(ctx context.Context, sourceId string, payload any) (bool, []RouteIOError)
|
||||
}
|
||||
type InputHandler func(ctx context.Context, sourceId string, payload any) (bool, []RouteIOError)
|
||||
|
||||
type RouteIOError struct {
|
||||
Index int `json:"index"`
|
||||
|
||||
Reference in New Issue
Block a user