2024-11-06 18:40:49 +08:00
|
|
|
// Package wrapper ...
|
|
|
|
//
|
|
|
|
// Description : wrapper ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2024-11-06 18:37
|
|
|
|
package wrapper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMap_Exist(t *testing.T) {
|
|
|
|
testData := Map(map[string]any{
|
|
|
|
"name": "zhang",
|
|
|
|
})
|
|
|
|
fmt.Println(testData.Exist("name"))
|
|
|
|
fmt.Println(testData.Exist("age"))
|
|
|
|
}
|
2024-11-19 15:28:47 +08:00
|
|
|
|
|
|
|
func TestMap_IsNil(t *testing.T) {
|
|
|
|
var (
|
|
|
|
m Map
|
|
|
|
m1 *Map
|
|
|
|
)
|
|
|
|
fmt.Println(m.Set("a", 1))
|
|
|
|
fmt.Println(m.IsNil(), m1.IsNil())
|
|
|
|
}
|
2024-11-19 15:39:37 +08:00
|
|
|
|
|
|
|
func TestMap_IsMasher(t *testing.T) {
|
|
|
|
var (
|
|
|
|
m Map
|
|
|
|
m1 = Map(map[string]any{
|
|
|
|
"a": 1,
|
|
|
|
"b": m,
|
|
|
|
"c": Map(map[string]any{
|
|
|
|
"name": "de",
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
)
|
|
|
|
d, err := m.MarshalJSON()
|
|
|
|
fmt.Println(string(d), err)
|
|
|
|
d, err = m1.MarshalJSON()
|
|
|
|
fmt.Println(string(d), err)
|
|
|
|
}
|