map 增加获取字符串结果方法

This commit is contained in:
zhangdeman committed 2024-11-21 15:16:30 +08:00
1 parent 4196d342f7
commit 59aeb88808
1 file changed
+16
+16
View File
@@ -234,3 +234,19 @@ func (m Map) ToString() string {
byteData, _ := m.MarshalJSON() byteData, _ := m.MarshalJSON()
return string(byteData) return string(byteData)
} }
// GetString 获取字符串结果
//
// 参数说明:
// - field : 要查找的字段
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:15 2024/11/21
func (m Map) GetString(field string) (string, error) {
val, err := m.Get(field)
if nil != err {
return "", err
}
return AnyDataType(val).ToString().Value(), nil
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.