feat(reflection): add support for nested struct mapping
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in -33m9s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in -32m37s
Build , Vet Test, and Lint / Build (push) Successful in -32m41s
Build , Vet Test, and Lint / Lint Code (push) Successful in -31m55s
Tests / Unit Tests (push) Successful in -33m29s
Tests / Integration Tests (push) Failing after -33m42s

This commit is contained in:
Hein
2026-04-16 13:45:46 +02:00
parent f79a400772
commit 325769be4e
2 changed files with 128 additions and 0 deletions

View File

@@ -1244,6 +1244,16 @@ func setFieldValue(field reflect.Value, value interface{}) error {
}
}
// Handle map[string]interface{} → nested struct (e.g. relation fields like AFN, DEF)
if m, ok := value.(map[string]interface{}); ok {
if field.CanAddr() {
if err := MapToStruct(m, field.Addr().Interface()); err != nil {
return err
}
return nil
}
}
// Fallback: Try to find a "Val" field (for SqlNull types) and set it directly
valField := field.FieldByName("Val")
if valField.IsValid() && valField.CanSet() {