feat: statistics: finish dev

This commit is contained in:
fallen-angle
2022-01-23 18:28:01 +08:00
parent 582807ae10
commit d844711191
29 changed files with 1670 additions and 51 deletions

17
utils/list.go Normal file
View File

@@ -0,0 +1,17 @@
package utils
type ObjectType []interface{}
func ForEach[T any](arr *[]T, fun func(item *T)) {
for i := range *arr {
fun(&((*arr)[i]))
}
}
func Map[T any, V any](arr []T, fun func(item T) V) []V {
res := make([]V, 0, len(arr))
for _, item := range arr {
res = append(res, fun(item))
}
return res
}