Skip to content

Commit 640e082

Browse files
committed
json
1 parent 2987182 commit 640e082

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tool.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,12 @@ func ArrayReduce(data interface{}, cb func(float64, interface{}) float64, start
224224
return start
225225
}
226226

227-
type ArrayKeyByS map[interface{}][]interface{}
228-
229-
func ArrayKeyBy(data interface{}, key string) ArrayKeyByS {
227+
func ArrayKeyBy(data interface{}, key string) map[interface{}][]interface{} {
230228
v := TryInterfacePtr(data)
231229
AssetsSlice(v.Kind(), "数组转换接口错误, 非数组接口")
232230

233231
vl := v.Len()
234-
dst := make(ArrayKeyByS, vl)
232+
dst := make(map[interface{}][]interface{}, vl)
235233
for i := 0; i < vl; i++ {
236234
tmp := v.Index(i).Interface()
237235
// 相信宝贝你不会存在不存在的情况 - -
@@ -241,12 +239,12 @@ func ArrayKeyBy(data interface{}, key string) ArrayKeyByS {
241239
return dst
242240
}
243241

244-
func ArrayKeyFuncBy(data interface{}, key string, cb func(interface{}) interface{}) ArrayKeyByS {
242+
func ArrayKeyFuncBy(data interface{}, key string, cb func(interface{}) interface{}) map[interface{}][]interface{} {
245243
v := TryInterfacePtr(data)
246244
AssetsSlice(v.Kind(), "数组转换接口错误, 非数组接口")
247245

248246
vl := v.Len()
249-
dst := make(ArrayKeyByS, vl)
247+
dst := make(map[interface{}][]interface{}, vl)
250248
for i := 0; i < vl; i++ {
251249
tmp := v.Index(i).Interface()
252250
// 相信宝贝你不会存在不存在的情况 - -

0 commit comments

Comments
 (0)