diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2021-12-08 10:30:42 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2021-12-08 10:30:42 +0000 |
| commit | 534418b298341df1585018b59d576191ed35dd93 (patch) | |
| tree | f695d2575ff7d98ac0a2361b1e9d60e26bf0b1f9 /internal | |
| parent | 94a958723db8e0a98f9b3759fd714b6ea037e173 (diff) | |
add missing dmap test file
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/mapr/whereclause.go | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/internal/mapr/whereclause.go b/internal/mapr/whereclause.go index 740df71..617aa79 100644 --- a/internal/mapr/whereclause.go +++ b/internal/mapr/whereclause.go @@ -9,22 +9,13 @@ import ( // WhereClause interprets the where clause of the mapreduce query. func (q *Query) WhereClause(fields map[string]string) bool { for _, wc := range q.Where { - var ok bool if wc.Operation > FloatOperation { if !whereClauseFloatValues(fields, wc) { return false } continue } - - var lValue, rValue string - if lValue, ok = whereClauseStringValue(fields, wc.lString, wc.lType); !ok { - return false - } - if rValue, ok = whereClauseStringValue(fields, wc.rString, wc.rType); !ok { - return false - } - if ok = wc.stringClause(lValue, rValue); !ok { + if !whereClauseStringValues(fields, wc) { return false } } @@ -70,6 +61,23 @@ func whereClauseFloatValue(fields map[string]string, str string, float float64, } } +func whereClauseStringValues(fields map[string]string, wc whereCondition) bool { + var lValue, rValue string + var ok bool + + if lValue, ok = whereClauseStringValue(fields, wc.lString, wc.lType); !ok { + return false + } + if rValue, ok = whereClauseStringValue(fields, wc.rString, wc.rType); !ok { + return false + } + if ok = wc.stringClause(lValue, rValue); !ok { + return false + } + + return true +} + func whereClauseStringValue(fields map[string]string, str string, t fieldType) (string, bool) { |
