mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-04-16 21:03:51 +00:00
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
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user