visual fixes

This commit is contained in:
Aine
2022-08-24 12:02:41 +03:00
parent afe24beb4d
commit 34735b2614
2 changed files with 39 additions and 52 deletions

27
utils/list.go Normal file
View File

@@ -0,0 +1,27 @@
package utils
// ListItem with key and value
type ListItem struct {
K string
V string
}
// List slice
type List []ListItem
// Get item's value
func (l List) Get(key string) (string, bool) {
for _, item := range l {
if item.K == key {
return item.V, true
}
}
return "", false
}
// ForEach item
func (l List) ForEach(handler func(key, value string)) {
for _, item := range l {
handler(item.K, item.V)
}
}