mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
align variable names with struct name
This commit is contained in:
@@ -20,12 +20,12 @@ type MIDIMessageCreate struct {
|
|||||||
ProcessFunc func(ctx context.Context, payload any) (any, error)
|
ProcessFunc func(ctx context.Context, payload any) (any, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mmd *MIDIMessageCreate) Process(ctx context.Context, payload any) (any, error) {
|
func (mmc *MIDIMessageCreate) Process(ctx context.Context, payload any) (any, error) {
|
||||||
return mmd.ProcessFunc(ctx, payload)
|
return mmc.ProcessFunc(ctx, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mmd *MIDIMessageCreate) Type() string {
|
func (mmc *MIDIMessageCreate) Type() string {
|
||||||
return mmd.config.Type
|
return mmc.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMidiNoteOnCreate(config config.ProcessorConfig) (Processor, error) {
|
func newMidiNoteOnCreate(config config.ProcessorConfig) (Processor, error) {
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ type OSCMessageCreate struct {
|
|||||||
Types string
|
Types string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageCreate) Process(ctx context.Context, payload any) (any, error) {
|
func (omc *OSCMessageCreate) Process(ctx context.Context, payload any) (any, error) {
|
||||||
|
|
||||||
var addressBuffer bytes.Buffer
|
var addressBuffer bytes.Buffer
|
||||||
err := o.Address.Execute(&addressBuffer, payload)
|
err := omc.Address.Execute(&addressBuffer, payload)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -45,7 +45,7 @@ func (o *OSCMessageCreate) Process(ctx context.Context, payload any) (any, error
|
|||||||
|
|
||||||
args := []osc.OSCArg{}
|
args := []osc.OSCArg{}
|
||||||
|
|
||||||
for argIndex, argTemplate := range o.Args {
|
for argIndex, argTemplate := range omc.Args {
|
||||||
var argBuffer bytes.Buffer
|
var argBuffer bytes.Buffer
|
||||||
err := argTemplate.Execute(&argBuffer, payload)
|
err := argTemplate.Execute(&argBuffer, payload)
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ func (o *OSCMessageCreate) Process(ctx context.Context, payload any) (any, error
|
|||||||
|
|
||||||
argString := argBuffer.String()
|
argString := argBuffer.String()
|
||||||
|
|
||||||
typedArg, err := argToTypedArg(argString, o.Types[argIndex])
|
typedArg, err := argToTypedArg(argString, omc.Types[argIndex])
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -71,8 +71,8 @@ func (o *OSCMessageCreate) Process(ctx context.Context, payload any) (any, error
|
|||||||
return payloadMessage, nil
|
return payloadMessage, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageCreate) Type() string {
|
func (omc *OSCMessageCreate) Type() string {
|
||||||
return o.config.Type
|
return omc.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type OSCMessageDecode struct {
|
|||||||
config config.ProcessorConfig
|
config config.ProcessorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageDecode) Process(ctx context.Context, payload any) (any, error) {
|
func (omd *OSCMessageDecode) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadBytes, ok := payload.([]byte)
|
payloadBytes, ok := payload.([]byte)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -34,8 +34,8 @@ func (o *OSCMessageDecode) Process(ctx context.Context, payload any) (any, error
|
|||||||
return message, nil
|
return message, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageDecode) Type() string {
|
func (omd *OSCMessageDecode) Type() string {
|
||||||
return o.config.Type
|
return omd.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type OSCMessageEncode struct {
|
|||||||
config config.ProcessorConfig
|
config config.ProcessorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageEncode) Process(ctx context.Context, payload any) (any, error) {
|
func (ome *OSCMessageEncode) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadMessage, ok := payload.(osc.OSCMessage)
|
payloadMessage, ok := payload.(osc.OSCMessage)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -23,8 +23,8 @@ func (o *OSCMessageEncode) Process(ctx context.Context, payload any) (any, error
|
|||||||
return bytes, nil
|
return bytes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageEncode) Type() string {
|
func (ome *OSCMessageEncode) Type() string {
|
||||||
return o.config.Type
|
return ome.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type OSCMessageFilter struct {
|
|||||||
Address *regexp.Regexp
|
Address *regexp.Regexp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageFilter) Process(ctx context.Context, payload any) (any, error) {
|
func (omf *OSCMessageFilter) Process(ctx context.Context, payload any) (any, error) {
|
||||||
|
|
||||||
payloadMessage, ok := payload.(osc.OSCMessage)
|
payloadMessage, ok := payload.(osc.OSCMessage)
|
||||||
|
|
||||||
@@ -24,15 +24,15 @@ func (o *OSCMessageFilter) Process(ctx context.Context, payload any) (any, error
|
|||||||
return nil, errors.New("osc.message.filter can only operate on OSCMessage payloads")
|
return nil, errors.New("osc.message.filter can only operate on OSCMessage payloads")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !o.Address.MatchString(payloadMessage.Address) {
|
if !omf.Address.MatchString(payloadMessage.Address) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return payloadMessage, nil
|
return payloadMessage, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageFilter) Type() string {
|
func (omf *OSCMessageFilter) Type() string {
|
||||||
return o.config.Type
|
return omf.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ type OSCMessageTransform struct {
|
|||||||
Address *template.Template
|
Address *template.Template
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageTransform) Process(ctx context.Context, payload any) (any, error) {
|
func (omt *OSCMessageTransform) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadMessage, ok := payload.(osc.OSCMessage)
|
payloadMessage, ok := payload.(osc.OSCMessage)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -23,7 +23,7 @@ func (o *OSCMessageTransform) Process(ctx context.Context, payload any) (any, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
var addressBuffer bytes.Buffer
|
var addressBuffer bytes.Buffer
|
||||||
err := o.Address.Execute(&addressBuffer, payloadMessage)
|
err := omt.Address.Execute(&addressBuffer, payloadMessage)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -44,8 +44,8 @@ func (o *OSCMessageTransform) Process(ctx context.Context, payload any) (any, er
|
|||||||
return payloadMessage, nil
|
return payloadMessage, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSCMessageTransform) Type() string {
|
func (omt *OSCMessageTransform) Type() string {
|
||||||
return o.config.Type
|
return omt.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -13,22 +13,22 @@ type StringFilter struct {
|
|||||||
Pattern *regexp.Regexp
|
Pattern *regexp.Regexp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (se *StringFilter) Process(ctx context.Context, payload any) (any, error) {
|
func (sf *StringFilter) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadString, ok := payload.(string)
|
payloadString, ok := payload.(string)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("string.filter processor only accepts a string")
|
return nil, errors.New("string.filter processor only accepts a string")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !se.Pattern.MatchString(payloadString) {
|
if !sf.Pattern.MatchString(payloadString) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return payloadString, nil
|
return payloadString, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (se *StringFilter) Type() string {
|
func (sf *StringFilter) Type() string {
|
||||||
return se.config.Type
|
return sf.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ type StringSplit struct {
|
|||||||
Separator string
|
Separator string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (se *StringSplit) Process(ctx context.Context, payload any) (any, error) {
|
func (ss *StringSplit) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadString, ok := payload.(string)
|
payloadString, ok := payload.(string)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("string.split only accepts a string")
|
return nil, errors.New("string.split only accepts a string")
|
||||||
}
|
}
|
||||||
|
|
||||||
payloadParts := strings.Split(payloadString, se.Separator)
|
payloadParts := strings.Split(payloadString, ss.Separator)
|
||||||
|
|
||||||
return payloadParts, nil
|
return payloadParts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (se *StringSplit) Type() string {
|
func (ss *StringSplit) Type() string {
|
||||||
return se.config.Type
|
return ss.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user