mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 18:45:58 +08:00
groupServer
This commit is contained in:
@@ -509,3 +509,14 @@ func NotNilReplace[T any](old, new_ *T) {
|
||||
}
|
||||
*old = *new_
|
||||
}
|
||||
|
||||
func Batch[T any, V any](fn func(T) V, ts []T) []V {
|
||||
if ts == nil {
|
||||
return nil
|
||||
}
|
||||
res := make([]V, 0, len(ts))
|
||||
for i := range ts {
|
||||
res = append(res, fn(ts[i]))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user