diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2020-07-02 14:42:09 +0100 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2020-07-02 14:42:09 +0100 |
| commit | 9983d8b5162756f5016e4c0d0bc28ad86c2293e6 (patch) | |
| tree | 3795641e63fa55a0fe685a9760977593e9d65d44 /internal | |
| parent | 51998506b2f51eba9b6d82d07003c4f27928ae7f (diff) | |
add lacks string operator, lacks is the opposite of contains. e.g.: not contains
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/mapr/wherecondition.go | 5 |
1 files changed, 5 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) } |
