From 7b1fe470398d9d44261f3e46a1f2ec81cde73128 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sun, 8 Mar 2026 09:36:59 -0500 Subject: [PATCH] align variable names --- internal/processor/filter-expr.go | 8 ++++---- internal/processor/free-d-decode.go | 6 +++--- internal/processor/free-d-encode.go | 6 +++--- internal/processor/http-response-create.go | 10 +++++----- internal/processor/router-output.go | 8 ++++---- internal/processor/script-wasm.go | 10 +++++----- internal/processor/sip-response-audio-create.go | 12 ++++++------ internal/processor/sip-response-dtmf-create.go | 14 +++++++------- internal/processor/time-sleep.go | 12 ++++++------ 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/internal/processor/filter-expr.go b/internal/processor/filter-expr.go index a075ccd..4072d4b 100644 --- a/internal/processor/filter-expr.go +++ b/internal/processor/filter-expr.go @@ -27,11 +27,11 @@ type ExprEnv struct { Payload any } -func (se *FilterExpr) Process(ctx context.Context, payload any) (any, error) { +func (fe *FilterExpr) Process(ctx context.Context, payload any) (any, error) { exprEnv := SafeExprEnv(payload) - output, err := expr.Run(se.Program, exprEnv) + output, err := expr.Run(fe.Program, exprEnv) if err != nil { return nil, err } @@ -47,8 +47,8 @@ func (se *FilterExpr) Process(ctx context.Context, payload any) (any, error) { return payload, nil } -func (se *FilterExpr) Type() string { - return se.config.Type +func (fe *FilterExpr) Type() string { + return fe.config.Type } func init() { diff --git a/internal/processor/free-d-decode.go b/internal/processor/free-d-decode.go index 6b169cf..a5312b1 100644 --- a/internal/processor/free-d-decode.go +++ b/internal/processor/free-d-decode.go @@ -12,7 +12,7 @@ type FreeDDecode struct { config config.ProcessorConfig } -func (fdd *FreeDDecode) Process(ctx context.Context, payload any) (any, error) { +func (fd *FreeDDecode) Process(ctx context.Context, payload any) (any, error) { payloadBytes, ok := GetAnyAs[[]byte](payload) if !ok { @@ -26,8 +26,8 @@ func (fdd *FreeDDecode) Process(ctx context.Context, payload any) (any, error) { return payloadMessage, nil } -func (fdd *FreeDDecode) Type() string { - return fdd.config.Type +func (fd *FreeDDecode) Type() string { + return fd.config.Type } func init() { diff --git a/internal/processor/free-d-encode.go b/internal/processor/free-d-encode.go index e7efbbd..9211a24 100644 --- a/internal/processor/free-d-encode.go +++ b/internal/processor/free-d-encode.go @@ -12,7 +12,7 @@ type FreeDEncode struct { config config.ProcessorConfig } -func (fde *FreeDEncode) Process(ctx context.Context, payload any) (any, error) { +func (fe *FreeDEncode) Process(ctx context.Context, payload any) (any, error) { payloadPosition, ok := GetAnyAs[freeD.FreeDPosition](payload) if !ok { @@ -23,8 +23,8 @@ func (fde *FreeDEncode) Process(ctx context.Context, payload any) (any, error) { return payloadBytes, nil } -func (fde *FreeDEncode) Type() string { - return fde.config.Type +func (fe *FreeDEncode) Type() string { + return fe.config.Type } func init() { diff --git a/internal/processor/http-response-create.go b/internal/processor/http-response-create.go index 452b775..f4a034c 100644 --- a/internal/processor/http-response-create.go +++ b/internal/processor/http-response-create.go @@ -20,24 +20,24 @@ type HTTPResponse struct { Body []byte } -func (hre *HTTPResponseCreate) Process(ctx context.Context, payload any) (any, error) { +func (hrc *HTTPResponseCreate) Process(ctx context.Context, payload any) (any, error) { templateData := GetTemplateData(ctx, payload) var bodyBuffer bytes.Buffer - err := hre.BodyTmpl.Execute(&bodyBuffer, templateData) + err := hrc.BodyTmpl.Execute(&bodyBuffer, templateData) if err != nil { return nil, err } return HTTPResponse{ - Status: hre.Status, + Status: hrc.Status, Body: bodyBuffer.Bytes(), }, nil } -func (hre *HTTPResponseCreate) Type() string { - return hre.config.Type +func (hrc *HTTPResponseCreate) Type() string { + return hrc.config.Type } func init() { diff --git a/internal/processor/router-output.go b/internal/processor/router-output.go index 8524cf3..1e83ff1 100644 --- a/internal/processor/router-output.go +++ b/internal/processor/router-output.go @@ -16,14 +16,14 @@ type RouterOutput struct { logger *slog.Logger } -func (dl *RouterOutput) Process(ctx context.Context, payload any) (any, error) { +func (ro *RouterOutput) Process(ctx context.Context, payload any) (any, error) { router, ok := ctx.Value(common.RouterContextKey).(common.RouteIO) if !ok { return nil, errors.New("router.output no router found") } - err := router.HandleOutput(ctx, dl.ModuleId, payload) + err := router.HandleOutput(ctx, ro.ModuleId, payload) if err != nil { return nil, fmt.Errorf("router.output failed to send output: %w", err) @@ -32,8 +32,8 @@ func (dl *RouterOutput) Process(ctx context.Context, payload any) (any, error) { return payload, nil } -func (dl *RouterOutput) Type() string { - return dl.config.Type +func (ro *RouterOutput) Type() string { + return ro.config.Type } func init() { diff --git a/internal/processor/script-wasm.go b/internal/processor/script-wasm.go index 829fbfd..a8c785b 100644 --- a/internal/processor/script-wasm.go +++ b/internal/processor/script-wasm.go @@ -15,7 +15,7 @@ type ScriptWASM struct { Function string } -func (se *ScriptWASM) Process(ctx context.Context, payload any) (any, error) { +func (sw *ScriptWASM) Process(ctx context.Context, payload any) (any, error) { payloadBytes, ok := GetAnyAs[[]byte](payload) @@ -23,13 +23,13 @@ func (se *ScriptWASM) Process(ctx context.Context, payload any) (any, error) { return nil, fmt.Errorf("script.wasm can only operator on byte array") } - program, err := se.Program.Instance(ctx, extism.PluginInstanceConfig{}) + program, err := sw.Program.Instance(ctx, extism.PluginInstanceConfig{}) if err != nil { return nil, err } - _, output, err := program.Call(se.Function, payloadBytes) + _, output, err := program.Call(sw.Function, payloadBytes) if err != nil { return nil, err @@ -38,8 +38,8 @@ func (se *ScriptWASM) Process(ctx context.Context, payload any) (any, error) { return output, nil } -func (se *ScriptWASM) Type() string { - return se.config.Type +func (sw *ScriptWASM) Type() string { + return sw.config.Type } func init() { diff --git a/internal/processor/sip-response-audio-create.go b/internal/processor/sip-response-audio-create.go index b1d939c..e84e217 100644 --- a/internal/processor/sip-response-audio-create.go +++ b/internal/processor/sip-response-audio-create.go @@ -22,12 +22,12 @@ type SipAudioFileResponse struct { AudioFile string } -func (scc *SipResponseAudioCreate) Process(ctx context.Context, payload any) (any, error) { +func (srac *SipResponseAudioCreate) Process(ctx context.Context, payload any) (any, error) { templateData := GetTemplateData(ctx, payload) var audioFileBuffer bytes.Buffer - err := scc.AudioFile.Execute(&audioFileBuffer, templateData) + err := srac.AudioFile.Execute(&audioFileBuffer, templateData) if err != nil { return nil, err @@ -36,14 +36,14 @@ func (scc *SipResponseAudioCreate) Process(ctx context.Context, payload any) (an audioFileString := audioFileBuffer.String() return SipAudioFileResponse{ - PreWait: scc.PreWait, - PostWait: scc.PostWait, + PreWait: srac.PreWait, + PostWait: srac.PostWait, AudioFile: audioFileString, }, nil } -func (scc *SipResponseAudioCreate) Type() string { - return scc.config.Type +func (srac *SipResponseAudioCreate) Type() string { + return srac.config.Type } func init() { diff --git a/internal/processor/sip-response-dtmf-create.go b/internal/processor/sip-response-dtmf-create.go index d4d7317..e7dddb2 100644 --- a/internal/processor/sip-response-dtmf-create.go +++ b/internal/processor/sip-response-dtmf-create.go @@ -25,12 +25,12 @@ type SipDTMFResponse struct { Digits string } -func (scc *SipResponseDTMFCreate) Process(ctx context.Context, payload any) (any, error) { +func (srdc *SipResponseDTMFCreate) Process(ctx context.Context, payload any) (any, error) { templateData := GetTemplateData(ctx, payload) var digitsBuffer bytes.Buffer - err := scc.Digits.Execute(&digitsBuffer, templateData) + err := srdc.Digits.Execute(&digitsBuffer, templateData) if err != nil { return nil, err @@ -38,19 +38,19 @@ func (scc *SipResponseDTMFCreate) Process(ctx context.Context, payload any) (any digitsString := digitsBuffer.String() - if !scc.validDTMF.MatchString(digitsString) { + if !srdc.validDTMF.MatchString(digitsString) { return nil, errors.New("sip.response.dtmf.create result of digits template contains invalid characters") } return SipDTMFResponse{ - PreWait: scc.PreWait, - PostWait: scc.PostWait, + PreWait: srdc.PreWait, + PostWait: srdc.PostWait, Digits: digitsString, }, nil } -func (scc *SipResponseDTMFCreate) Type() string { - return scc.config.Type +func (srdc *SipResponseDTMFCreate) Type() string { + return srdc.config.Type } func init() { diff --git a/internal/processor/time-sleep.go b/internal/processor/time-sleep.go index a67e03c..fd7bb18 100644 --- a/internal/processor/time-sleep.go +++ b/internal/processor/time-sleep.go @@ -8,18 +8,18 @@ import ( "github.com/jwetzell/showbridge-go/internal/config" ) -type MetaDelay struct { +type TimeSleep struct { config config.ProcessorConfig Duration time.Duration } -func (md *MetaDelay) Process(ctx context.Context, payload any) (any, error) { - time.Sleep(md.Duration) +func (ts *TimeSleep) Process(ctx context.Context, payload any) (any, error) { + time.Sleep(ts.Duration) return payload, nil } -func (md *MetaDelay) Type() string { - return md.config.Type +func (ts *TimeSleep) Type() string { + return ts.config.Type } func init() { @@ -33,7 +33,7 @@ func init() { return nil, fmt.Errorf("time.sleep duration error: %w", err) } - return &MetaDelay{config: config, Duration: time.Millisecond * time.Duration(durationNum)}, nil + return &TimeSleep{config: config, Duration: time.Millisecond * time.Duration(durationNum)}, nil }, }) }