增加转为对象的能力

This commit is contained in:
白茶清欢 2023-10-11 17:20:03 +08:00
parent 160f464d15
commit 3432f85c3d

14
any.go
View File

@ -96,5 +96,17 @@ func (at *AnyType) ToString() String {
case DataTypePtr: case DataTypePtr:
return String(serialize.JSON.MarshalForString(at.data)) return String(serialize.JSON.MarshalForString(at.data))
} }
return "" return String("")
}
// ToObject 任意类型转为对象
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:19 2023/10/11
func (at *AnyType) ToObject() MapResult {
return MapResult{
Value: EasyMapFromString(at.ToString().Value()),
Err: nil,
}
} }