Skip to content
Snippets Groups Projects
Verified Commit 10a92db1 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: Support Slice and Arrays

parent c4f15f6c
No related branches found
No related tags found
No related merge requests found
......@@ -134,6 +134,17 @@ func SetValue[D any](obj D, keyWithDots string, newValue any) error {
v.SetFloat(s)
}
case reflect.Slice, reflect.Array:
if newValueKind == reflect.Ptr {
newValue = reflect.ValueOf(newValue).Elem().Interface()
v.Set(reflect.ValueOf(newValue))
} else if newValueKind == reflect.Slice {
v.Set(reflect.ValueOf(newValue))
} else {
return newUnsupportedTypePathError(keyWithDots, v.Type())
}
default:
return newInvalidTypeForPathError(keyWithDots, v.Type().String(), newValueKind.String())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment