框架优化

This commit is contained in:
hoteas
2022-03-13 05:06:28 +08:00
parent 369c06724a
commit 716b3dfa6b
11 changed files with 255 additions and 114 deletions
+17
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"reflect"
"sort"
)
//hotime的常用map
@@ -98,6 +99,22 @@ func (that Map) GetBool(key string, err ...*Error) bool {
return v
}
func (that Map) RangeSort(callback func(k string, v interface{}) (isEnd bool)) {
testQu := []string{}
//testQuData:= qu[0].(Map)
for key, _ := range that {
//fmt.Println(key, ":", value)
testQu = append(testQu, key)
}
sort.Strings(testQu)
for _, k := range testQu {
re := callback(k, that[k])
if re {
return
}
}
}
func (that Map) GetMap(key string, err ...*Error) Map {