rename processing to processor

This commit is contained in:
Joel Wetzell
2025-12-07 10:41:14 -06:00
parent 2e7feede28
commit 0bd43ca0c3
36 changed files with 159 additions and 115 deletions

View File

@@ -0,0 +1,37 @@
package processor
import (
"context"
"fmt"
"github.com/jwetzell/showbridge-go/internal/config"
)
type StringDecode struct {
config config.ProcessorConfig
}
func (sd *StringDecode) Process(ctx context.Context, payload any) (any, error) {
payloadBytes, ok := payload.([]byte)
if !ok {
return nil, fmt.Errorf("string.decode processor only accepts a []byte")
}
payloadMessage := string(payloadBytes)
return payloadMessage, nil
}
func (sd *StringDecode) Type() string {
return sd.config.Type
}
func init() {
RegisterProcessor(ProcessorRegistration{
Type: "string.decode",
New: func(config config.ProcessorConfig) (Processor, error) {
return &StringDecode{config: config}, nil
},
})
}