Archived
1
0
Fork 0

style: add comments on filters

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-05-20 17:07:56 +02:00
parent 244c9f68e7
commit 48a763a90c
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
2 changed files with 6 additions and 2 deletions

View file

@ -6,10 +6,12 @@ import (
log "github.com/sirupsen/logrus"
)
// ExcludeFilter struct to store the compiled regex used for the exclusion
type ExcludeFilter struct {
regex *regexp.Regexp
}
// NewExcludeFilter to create an ExcludeFilter
func NewExcludeFilter(regex string) (*ExcludeFilter, error) {
var err error
var compiledRegex *regexp.Regexp
@ -25,7 +27,7 @@ func NewExcludeFilter(regex string) (*ExcludeFilter, error) {
return &ExcludeFilter{regex: compiledRegex}, nil
}
// Filter excludes product with name matching the regex
// Include returns false when the product name matches the regex
// implements the Filter interface
func (f *ExcludeFilter) Include(product *Product) bool {
if f.regex == nil {

View file

@ -6,10 +6,12 @@ import (
log "github.com/sirupsen/logrus"
)
// IncludeFilter struct to store the compiled regex used for the inclusion
type IncludeFilter struct {
regex *regexp.Regexp
}
// NewIncludeFilter to create an IncludeFilter
func NewIncludeFilter(regex string) (*IncludeFilter, error) {
var err error
var compiledRegex *regexp.Regexp
@ -25,7 +27,7 @@ func NewIncludeFilter(regex string) (*IncludeFilter, error) {
return &IncludeFilter{regex: compiledRegex}, nil
}
// Filter includes product with name matching the regex
// Include returns treue when the product name matches the regex
// implements the Filter interface
func (f *IncludeFilter) Include(product *Product) bool {
if f.regex == nil {