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
+27 -27
View File
@@ -11,6 +11,33 @@ import (
"github.com/jwetzell/showbridge-go/internal/config"
)
func init() {
RegisterProcessor(ProcessorRegistration{
Type: "struct.field.get",
Title: "Get Struct Field",
ParamsSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"name": {
Title: "Field Name",
Type: "string",
},
},
Required: []string{"name"},
AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
},
New: func(config config.ProcessorConfig) (Processor, error) {
params := config.Params
nameString, err := params.GetString("name")
if err != nil {
return nil, fmt.Errorf("struct.field.get name error: %w", err)
}
return &StructFieldGet{config: config, Name: nameString}, nil
},
})
}
type StructFieldGet struct {
config config.ProcessorConfig
Name string
@@ -42,30 +69,3 @@ func (sfg *StructFieldGet) Process(ctx context.Context, wrappedPayload common.Wr
func (sfg *StructFieldGet) Type() string {
return sfg.config.Type
}
func init() {
RegisterProcessor(ProcessorRegistration{
Type: "struct.field.get",
Title: "Get Struct Field",
ParamsSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"name": {
Title: "Field Name",
Type: "string",
},
},
Required: []string{"name"},
AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
},
New: func(config config.ProcessorConfig) (Processor, error) {
params := config.Params
nameString, err := params.GetString("name")
if err != nil {
return nil, fmt.Errorf("struct.field.get name error: %w", err)
}
return &StructFieldGet{config: config, Name: nameString}, nil
},
})
}