github.com/sandwich-go/boost@v1.3.29/xmap/README.md (about)

     1  # xmap
     2  
     3  `map` 辅助函数
     4  
     5  - 有序遍历`map`(根据 `map` 中 `KEY` 进行排序,依次遍历)
     6  
     7  # 例子
     8  ```go
     9  var tm = make(map[string]string)
    10  tm["b"] = "c"
    11  tm["a"] = "b"
    12  tm["1"] = "2"
    13  tm["c"] = "d"
    14  
    15  WalkStringStringMapDeterministic(tm, func(k string, v string) bool {
    16      fmt.Println("key:", k, "value:", v)
    17      return true
    18  })
    19  ```
    20  Output:
    21  ```text
    22  key: 1 value: 2
    23  key: a value: b
    24  key: b value: c
    25  key: c value: d
    26  ```