Spaces:
Running
Running
File size: 722 Bytes
a4468f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
package mapx
import (
"fmt"
"testing"
)
func TestMapx(t *testing.T) {
mapx := Mapx{
"string": "abc",
"int": 1234,
"float": 12.34,
"slice": []any{
"a",
map[string]any{
"aa": map[string]interface{}{
"qwe": 123,
},
},
"c",
},
"map": map[string]any{
"map": map[string]any{
"bool": true,
"aa": map[string]interface{}{
"qwe": 123,
},
},
},
"m2": Mapx{
//"a": model.PayOrder{OrderNo: "1234"},
//"b": &model.PayOrder{OrderNo: "123444"},
},
}
//v := mapx.ListByIDs("map.map.aa.qwe")
//v := mapx.ListByIDs("slice.[1].aa.qwe")
v := mapx.Get("m2.b.OrderNo")
//v := mapx.ListByIDs("int")
//vv := v.(int)
fmt.Printf("type:%T value:%v\n", v, v)
}
|