From ab548c502b5ecba40003067a6bd6050479efe5ee Mon Sep 17 00:00:00 2001 From: "marko.tikvic" Date: Thu, 22 Nov 2018 09:49:39 +0100 Subject: [PATCH] added Valid() to filters --- email.go | 12 ++++++------ filtering.go | 8 ++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/email.go b/email.go index 7097825..052981e 100644 --- a/email.go +++ b/email.go @@ -134,12 +134,12 @@ func SendEmail(email *Email, conf *EmailConfig) error { } type EmailConfig struct { - ServerName string - Identity string - Username string - Password string - Host string - Port int + ServerName string `json:"-"` + Identity string `json:"-"` + Username string `json:"username"` + Password string `json:"password"` + Host string `json:"host"` + Port int `json:"port"` } func NewEmailConfig(ident, uname, pword, host string, port int) *EmailConfig { diff --git a/filtering.go b/filtering.go index 8ad95ac..ab86f30 100644 --- a/filtering.go +++ b/filtering.go @@ -8,6 +8,14 @@ import ( type Filter map[string]string +func (f *Filter) Size() int { + return len(*f) +} + +func (f *Filter) Valid() bool { + return len(*f) > 0 +} + func (fs Filter) validate(validFilters []string) (Filter, bool) { goodFilters := make(map[string]string) cnt := 0 -- 1.8.1.2