优化any -> string

This commit is contained in:
白茶清欢 2023-12-06 21:32:22 +08:00
parent 1dd7ccf026
commit a427bc63c5

3
any.go
View File

@ -8,6 +8,7 @@
package wrapper package wrapper
import ( import (
"fmt"
"git.zhangdeman.cn/zhangdeman/serialize" "git.zhangdeman.cn/zhangdeman/serialize"
"reflect" "reflect"
) )
@ -96,7 +97,7 @@ func (at *AnyType) ToString() String {
case DataTypePtr: case DataTypePtr:
return String(serialize.JSON.MarshalForString(at.data)) return String(serialize.JSON.MarshalForString(at.data))
} }
return String("") return String(fmt.Sprintf("%v", at.data))
} }
// ToObject 任意类型转为对象 // ToObject 任意类型转为对象