This commit is contained in:
白茶清欢 2024-11-21 14:28:15 +08:00
parent a56574ff65
commit b7890f7fd0
2 changed files with 12 additions and 1 deletions

3
any.go
View File

@ -110,7 +110,8 @@ func (at *AnyType) ToString() String {
_ = serialize.JSON.Transition(at.data, &val)
return String(ArrayType[any](val).ToString().Value)
case consts.DataTypeMapAnyAny:
return String(EasyMap(at.data).ToString())
easyMap := EasyMap(at.data)
return String(easyMap.ToString())
case consts.DataTypeInt:
return String(Int(at.data.(int64)).ToString().Value)
case consts.DataTypeUint:

10
map.go
View File

@ -227,3 +227,13 @@ func (m *Map) MarshalJSON() ([]byte, error) {
}
return serialize.JSON.MarshalForByte(mapData)
}
// ToString 序列化成字符串
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 14:24 2024/11/21
func (m *Map) ToString() string {
byteData, _ := m.MarshalJSON()
return string(byteData)
}