move init functions to top of file

This commit is contained in:
Joel Wetzell
2026-05-22 17:45:03 -05:00
parent fb3c775765
commit 4323a21015
67 changed files with 1706 additions and 1706 deletions
+30 -30
View File
@@ -11,36 +11,6 @@ import (
"github.com/jwetzell/showbridge-go/internal/config"
)
type RouterInput struct {
config config.ProcessorConfig
SourceId string
logger *slog.Logger
}
func (ri *RouterInput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
payload := wrappedPayload.Payload
if wrappedPayload.InputHandler == nil {
wrappedPayload.End = true
return wrappedPayload, errors.New("router.input no input handler found")
}
_, err := wrappedPayload.InputHandler(ctx, ri.SourceId, payload)
if err != nil {
wrappedPayload.End = true
return wrappedPayload, errors.New("router.input failed to send input")
}
wrappedPayload.Payload = payload
return wrappedPayload, nil
}
func (ri *RouterInput) Type() string {
return ri.config.Type
}
func init() {
RegisterProcessor(ProcessorRegistration{
Type: "router.input",
@@ -71,3 +41,33 @@ func init() {
},
})
}
type RouterInput struct {
config config.ProcessorConfig
SourceId string
logger *slog.Logger
}
func (ri *RouterInput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
payload := wrappedPayload.Payload
if wrappedPayload.InputHandler == nil {
wrappedPayload.End = true
return wrappedPayload, errors.New("router.input no input handler found")
}
_, err := wrappedPayload.InputHandler(ctx, ri.SourceId, payload)
if err != nil {
wrappedPayload.End = true
return wrappedPayload, errors.New("router.input failed to send input")
}
wrappedPayload.Payload = payload
return wrappedPayload, nil
}
func (ri *RouterInput) Type() string {
return ri.config.Type
}