1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-17 11:12:28 +08:00

compatible with pointer in convert.ToString

This commit is contained in:
guanhongli
2025-01-26 12:04:55 +08:00
parent d4b425e39c
commit f861e18bc3
2 changed files with 21 additions and 1 deletions

View File

@@ -108,6 +108,13 @@ func ToString(value any) string {
if value == nil {
return ""
}
rv := reflect.ValueOf(value)
if rv.Kind() == reflect.Ptr {
if rv.IsNil() {
return ""
}
return ToString(rv.Elem().Interface())
}
switch val := value.(type) {
case float32: