From d7e8e0a94e5116e22f5afb860489c01302d4e67d Mon Sep 17 00:00:00 2001 From: "marko.tikvic" Date: Wed, 30 Jan 2019 22:15:46 +0100 Subject: [PATCH] count; add --- filtering.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/filtering.go b/filtering.go index 7eacd49..82db975 100644 --- a/filtering.go +++ b/filtering.go @@ -14,12 +14,12 @@ func (f Filter) Get(key string) (values []string, ok bool) { return values, ok } -func (f Filter) Size() int { +func (f Filter) Count() int { return len(f) } -func (f Filter) IsNotEmpty() bool { - return len(f) > 0 +func (f Filter) Add(key, val string) { + f[key] = append(f[key], val) } func (f Filter) ValueAt(val string, index int) string { @@ -84,7 +84,7 @@ func MakeFilterString(prefix string, filters Filter, validFilters []string) (res prefix += "." } - if !filters.IsNotEmpty() { + if filters.Count() == 0 { return "", true } -- 1.8.1.2