style: add comments on filters
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
244c9f68e7
commit
48a763a90c
2 changed files with 6 additions and 2 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Reference in a new issue