支持Map类型的包装 #6

Merged
zhangdeman merged 9 commits from feature/support_map into master 2024-11-19 16:31:05 +08:00
Showing only changes of commit dac3a32e6f - Show all commits

View File

@ -21,7 +21,7 @@ import (
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:02 2023/8/10
func EasyMap(mapData any) Map {
func EasyMap(mapData any) easymap.EasyMap {
m, _ := EasyMapWithError(mapData)
return m
}
@ -31,7 +31,7 @@ func EasyMap(mapData any) Map {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:06 2023/8/10
func EasyMapWithError(mapData any) (Map, error) {
func EasyMapWithError(mapData any) (easymap.EasyMap, error) {
if nil == mapData {
return easymap.NewNormal(), nil
}
@ -58,7 +58,7 @@ func EasyMapWithError(mapData any) (Map, error) {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:11 2023/8/10
func EasyMapFromStruct(data any) Map {
func EasyMapFromStruct(data any) easymap.EasyMap {
byteData, _ := json.Marshal(data)
return EasyMapFromByte(byteData)
}
@ -68,7 +68,7 @@ func EasyMapFromStruct(data any) Map {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:12 2023/8/10
func EasyMapFromString(data string) Map {
func EasyMapFromString(data string) easymap.EasyMap {
return EasyMapFromByte([]byte(data))
}
@ -77,7 +77,7 @@ func EasyMapFromString(data string) Map {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:12 2023/8/10
func EasyMapFromByte(data []byte) Map {
func EasyMapFromByte(data []byte) easymap.EasyMap {
res := easymap.NewNormal()
jsonRes := gjson.Parse(string(data))
jsonRes.ForEach(func(key, value gjson.Result) bool {
@ -86,10 +86,3 @@ func EasyMapFromByte(data []byte) Map {
})
return res
}
// Map ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:14 2023/8/10
type Map easymap.EasyMap