package helper
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test_HttpBuildQuery(t *testing.T) {
|
|
|
|
a := map[string]interface{}{"id": "11", "name": "8", "price": "2.3"}
|
|
b := map[string]interface{}{"id": "4", "name": "7", "price": "2.8"}
|
|
c := map[string]interface{}{"id": "3", "name": "9", "price": "2.1"}
|
|
list := []map[string]interface{}{}
|
|
list = append(list, a)
|
|
list = append(list, b)
|
|
list = append(list, c)
|
|
//ret := HttpBuildQuery(list)
|
|
ret, err := MapSort("desc", "id", "float64", list)
|
|
|
|
if err != nil {
|
|
|
|
}
|
|
t.Log(ret)
|
|
|
|
}
|
|
|
|
func Test_SetMapFirstToUpper(t *testing.T) {
|
|
a := map[string]interface{}{"id": "11", "name": "8", "a_c": 99, "price": "2.3", "cc_dd_ee": 22}
|
|
ret := SetMapFirstToUpper(a)
|
|
t.Log(ret)
|
|
}
|
|
|
|
func Test_MergeMaps(t *testing.T) {
|
|
a := map[string]string{"a": "1", "b": "2", "c": "3"}
|
|
b := map[string]string{"e": "5", "f": "6", "g": "7"}
|
|
// c := map[string]string{"a": "0", "h": "8", "f": "10"}
|
|
|
|
ret := MergeMaps(a, b)
|
|
t.Log(ret)
|
|
}
|