mirror of
https://github.com/safing/portbase
synced 2025-09-02 18:50:14 +00:00
28 lines
444 B
Go
28 lines
444 B
Go
package query
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
type existsCondition struct {
|
|
key string
|
|
operator uint8
|
|
}
|
|
|
|
func newExistsCondition(key string, operator uint8) *existsCondition {
|
|
return &existsCondition{
|
|
key: key,
|
|
operator: operator,
|
|
}
|
|
}
|
|
|
|
func (c *existsCondition) complies(f Fetcher) bool {
|
|
return f.Exists(c.key)
|
|
}
|
|
|
|
func (c *existsCondition) check() error {
|
|
if c.operator == errorPresent {
|
|
return errors.New(c.key)
|
|
}
|
|
return nil
|
|
}
|