2024-10-19 22:36:33 +08:00
|
|
|
package nex
|
|
|
|
|
2024-11-04 00:12:17 +08:00
|
|
|
import (
|
|
|
|
"github.com/goccy/go-json"
|
|
|
|
)
|
2024-10-19 22:36:33 +08:00
|
|
|
|
2024-10-21 00:05:40 +08:00
|
|
|
func EncodeMap(data any) []byte {
|
2024-11-04 00:12:17 +08:00
|
|
|
raw, _ := json.Marshal(data)
|
2024-10-19 22:36:33 +08:00
|
|
|
return raw
|
|
|
|
}
|
|
|
|
|
|
|
|
func DecodeMap(raw []byte) map[string]any {
|
|
|
|
var out map[string]any
|
2024-11-04 00:12:17 +08:00
|
|
|
_ = json.Unmarshal(raw, &out)
|
2024-10-19 22:36:33 +08:00
|
|
|
return out
|
|
|
|
}
|