常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
946 B

  1. package helper
  2. import (
  3. "testing"
  4. )
  5. func Test_HttpBuildQuery(t *testing.T) {
  6. a := map[string]interface{}{"id": "11", "name": "8", "price": "2.3"}
  7. b := map[string]interface{}{"id": "4", "name": "7", "price": "2.8"}
  8. c := map[string]interface{}{"id": "3", "name": "9", "price": "2.1"}
  9. list := []map[string]interface{}{}
  10. list = append(list, a)
  11. list = append(list, b)
  12. list = append(list, c)
  13. //ret := HttpBuildQuery(list)
  14. ret, err := MapSort("desc", "id", "float64", list)
  15. if err != nil {
  16. }
  17. t.Log(ret)
  18. }
  19. func Test_SetMapFirstToUpper(t *testing.T) {
  20. a := map[string]interface{}{"id": "11", "name": "8", "a_c": 99, "price": "2.3", "cc_dd_ee": 22}
  21. ret := SetMapFirstToUpper(a)
  22. t.Log(ret)
  23. }
  24. func Test_MergeMaps(t *testing.T) {
  25. a := map[string]string{"a": "1", "b": "2", "c": "3"}
  26. b := map[string]string{"e": "5", "f": "6", "g": "7"}
  27. // c := map[string]string{"a": "0", "h": "8", "f": "10"}
  28. ret := MergeMaps(a, b)
  29. t.Log(ret)
  30. }