mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-09 01:10:26 +08:00
refactor: 引入日志切割库、indexApi拆分等
This commit is contained in:
@@ -22,3 +22,23 @@ func Kvs(elements ...any) M {
|
||||
}
|
||||
return myMap
|
||||
}
|
||||
|
||||
// Keys returns the keys of the map m.
|
||||
// The keys will be in an indeterminate order.
|
||||
func MapKeys[M ~map[K]V, K comparable, V any](m M) []K {
|
||||
r := make([]K, 0, len(m))
|
||||
for k := range m {
|
||||
r = append(r, k)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// Values returns the values of the map m.
|
||||
// The values will be in an indeterminate order.
|
||||
func MapValues[M ~map[K]V, K comparable, V any](m M) []V {
|
||||
r := make([]V, 0, len(m))
|
||||
for _, v := range m {
|
||||
r = append(r, v)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user