add kvfilter type that regroups very frequently used filters
This commit is contained in:
parent
9e6d5da277
commit
af38430eb8
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue