summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/mapr/wherecondition.go5
-rwxr-xr-xsamples/dtail.schema.json23
2 files changed, 28 insertions, 0 deletions
diff --git a/internal/mapr/wherecondition.go b/internal/mapr/wherecondition.go
index 5ca3c44..3ca9103 100644
--- a/internal/mapr/wherecondition.go
+++ b/internal/mapr/wherecondition.go
@@ -18,6 +18,7 @@ const (
StringEq QueryOperation = iota
StringNe QueryOperation = iota
StringContains QueryOperation = iota
+ StringNotContains QueryOperation = iota
FloatOperation QueryOperation = iota
FloatEq QueryOperation = iota
FloatNe QueryOperation = iota
@@ -99,6 +100,8 @@ func makeWhereConditions(tokens []token) (where []whereCondition, err error) {
wc.Operation = StringNe
case "contains":
wc.Operation = StringContains
+ case "lacks":
+ wc.Operation = StringNotContains
default:
return wc, nil, errors.New(invalidQuery + "Unknown operation in 'where' clause: " + whereOp)
}
@@ -187,6 +190,8 @@ func (wc *whereCondition) stringClause(lValue string, rValue string) bool {
return lValue != rValue
case StringContains:
return strings.Contains(lValue, rValue)
+ case StringNotContains:
+ return !strings.Contains(lValue, rValue)
default:
logger.Error("Unknown string operation", lValue, wc.Operation, rValue)
}
diff --git a/samples/dtail.schema.json b/samples/dtail.schema.json
index 68db788..73807fc 100755
--- a/samples/dtail.schema.json
+++ b/samples/dtail.schema.json
@@ -43,6 +43,29 @@
}
}
},
+ "Monitor": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "Name": {
+ "type": "string"
+ },
+ "Enable": {
+ "type": "boolean"
+ },
+ "Files": {
+ "type": "string"
+ },
+ "Outfile": {
+ "type": "string"
+ },
+ "Query": {
+ "type": "string"
+ }
+ }
+ }
+ },
"HostKeyFile": {
"type": "string"
},