photoprism/internal/entity/string_keyvalue.go
Michael Mayer c74fcbf282 People: Show real name instead of uid in logs #1438 #2182
Since caching all subject data proved too complex in the time available,
this implementation uses a simple key/value lookup table to cache
subject names and perform backward searches by uid.
2022-04-04 14:21:43 +02:00

22 lines
409 B
Go

package entity
// KeyValue represents a string key/value pair.
type KeyValue struct {
K string `json:"value"`
V string `json:"text"`
}
// KeyValues represents a list of string key/value pairs.
type KeyValues []KeyValue
// Strings returns the list as a lookup map.
func (v KeyValues) Strings() Strings {
result := make(Strings, len(v))
for i := range v {
result[v[i].K] = v[i].V
}
return result
}