allow struct based processors to also operate on pointers to structs

This commit is contained in:
Joel Wetzell
2026-03-08 13:14:50 -05:00
parent e5db9a48a9
commit 0732113a02
4 changed files with 24 additions and 2 deletions

View File

@@ -18,7 +18,11 @@ func (sf *StructFieldGet) Process(ctx context.Context, payload any) (any, error)
s := reflect.ValueOf(payload)
if s.Kind() != reflect.Struct {
return nil, errors.New("struct.field.get processor only accepts a struct payload")
if s.Kind() == reflect.Pointer && s.Elem().Kind() == reflect.Struct {
s = s.Elem()
} else {
return nil, errors.New("struct.field.get processor only accepts a struct payload")
}
}
field := s.FieldByName(sf.Name)