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
+25 -25
View File
@@ -11,31 +11,6 @@ import (
"github.com/jwetzell/showbridge-go/internal/config"
)
type StringCreate struct {
config config.ProcessorConfig
Template *template.Template
}
func (sc *StringCreate) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
templateData := wrappedPayload
var templateBuffer bytes.Buffer
err := sc.Template.Execute(&templateBuffer, templateData)
if err != nil {
wrappedPayload.End = true
return wrappedPayload, err
}
wrappedPayload.Payload = templateBuffer.String()
return wrappedPayload, nil
}
func (sc *StringCreate) Type() string {
return sc.config.Type
}
func init() {
RegisterProcessor(ProcessorRegistration{
Type: "string.create",
@@ -67,3 +42,28 @@ func init() {
},
})
}
type StringCreate struct {
config config.ProcessorConfig
Template *template.Template
}
func (sc *StringCreate) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
templateData := wrappedPayload
var templateBuffer bytes.Buffer
err := sc.Template.Execute(&templateBuffer, templateData)
if err != nil {
wrappedPayload.End = true
return wrappedPayload, err
}
wrappedPayload.Payload = templateBuffer.String()
return wrappedPayload, nil
}
func (sc *StringCreate) Type() string {
return sc.config.Type
}