mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
added docker image
This commit is contained in:
18
functions/iterables.go
Normal file
18
functions/iterables.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package functions
|
||||
|
||||
func MapArrayInsert[K comparable, V any](m map[K][]V, k K, v V) {
|
||||
l, ok := m[k]
|
||||
if !ok {
|
||||
m[k] = []V{v}
|
||||
} else {
|
||||
m[k] = append(l, v)
|
||||
}
|
||||
}
|
||||
|
||||
func Keys[K comparable, V any](m map[K]V) []K {
|
||||
keys := make([]K, 0, len(m))
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
Reference in New Issue
Block a user