refactoring

This commit is contained in:
Alex
2025-03-24 17:45:33 +01:00
parent 741145b960
commit 28dfe7ecde
11 changed files with 528 additions and 155 deletions

View File

@@ -10,7 +10,7 @@ type User struct {
Age int
Address *Address
Tags []string
License License
Licence Licence
}
type Address struct {
@@ -18,7 +18,7 @@ type Address struct {
Country string
}
type License struct {
type Licence struct {
ID string
Categories []string
}
@@ -98,22 +98,22 @@ func TestFilterAllowedStructFields(t *testing.T) {
{
name: "Filter slice of structs",
input: &User{
License: License{
Licence: Licence{
ID: "123",
Categories: []string{"A", "B"},
},
},
existing: &User{
License: License{
Licence: Licence{
ID: "456",
Categories: []string{"C"},
},
},
allowedFields: map[string]bool{
"License.ID": true,
"Licence.ID": true,
},
expectedResult: &User{
License: License{
Licence: Licence{
ID: "123", // Allowed field
Categories: []string{"C"}, // Kept from existing
},