feat: resource list and table output formatter
This commit is contained in:
@ -21,3 +21,13 @@ func Select[T any](s []T, selectFn func(i *T) bool) (out []T) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func Map[T any, Tkey comparable, Tval any](s []T, transformFn func(i *T) (Tkey, Tval)) (out map[Tkey]Tval) {
|
||||
out = make(map[Tkey]Tval)
|
||||
for _, i := range s {
|
||||
key, val := transformFn(&i)
|
||||
out[key] = val
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user