translate maps to sequences in pkg metadata (#2553)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2024-02-01 11:58:10 -05:00
committed by GitHub
parent fef0e54c0f
commit 6107e5e2ad
19 changed files with 3153 additions and 543 deletions
+28
View File
@@ -0,0 +1,28 @@
package pkg
type KeyValue struct {
Key string `json:"key"`
Value string `json:"value"`
}
type KeyValues []KeyValue
func (k KeyValues) Get(key string) (string, bool) {
for _, kv := range k {
if kv.Key == key {
return kv.Value, true
}
}
return "", false
}
func (k KeyValues) MustGet(key string) string {
for _, kv := range k {
if kv.Key == key {
return kv.Value
}
}
return ""
}