add kvfilter type that regroups very frequently used filters

This commit is contained in:
Adrien Delorme 2020-03-13 17:17:00 +01:00
parent 9e6d5da277
commit af38430eb8
1 changed files with 16 additions and 0 deletions

View File

@ -6,3 +6,19 @@ type KeyValue struct {
Key string
Value string
}
type KVFilter struct {
Filters map[string]string
Filter []KeyValue
}
func (kvf *KVFilter) Prepare() error {
for _, filter := range kvf.Filter {
kvf.Filters[filter.Key] = filter.Value
}
return nil
}
func (kvf *KVFilter) Empty() bool {
return len(kvf.Filters) == 0
}