Add query package with first set of conditions and tests

This commit is contained in:
Daniel 2018-08-29 20:02:02 +02:00
parent 1bf7e42d8a
commit 6ed50f34fb
16 changed files with 933 additions and 0 deletions

View file

@ -0,0 +1,28 @@
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
}