You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
597 B
26 lines
597 B
package accessctl
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
// FilterNot wraps another Filter. If that filter matches, FilterNot does not
|
|
// match, and vice-versa.
|
|
type FilterNot struct {
|
|
Filter FilterUnion `yaml:"filter"`
|
|
}
|
|
|
|
var _ Filter = FilterNot{}
|
|
|
|
// MatchCommit implements the method for FilterInterface.
|
|
func (f FilterNot) MatchCommit(req CommitRequest) error {
|
|
if err := f.Filter.Filter().MatchCommit(req); errors.As(err, new(ErrFilterNoMatch)) {
|
|
return nil
|
|
} else if err != nil {
|
|
return err
|
|
}
|
|
return ErrFilterNoMatch{Err: errors.New("sub-filter did match")}
|
|
}
|
|
|
|
// TODO FilterAll
|
|
// TODO FilterAny
|
|
|