From b7890f7fd03dca9a2b186dd63a3d24b86aa2b45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 21 Nov 2024 14:28:15 +0800 Subject: [PATCH] fix --- any.go | 3 ++- map.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/any.go b/any.go index 6d4a033..a74a343 100644 --- a/any.go +++ b/any.go @@ -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: diff --git a/map.go b/map.go index 16ae07c..9ad1697 100644 --- a/map.go +++ b/map.go @@ -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) +}