Skip to content

Commit 20e7011

Browse files
pawels-optimizelyMichael Ng
authored andcommitted
feat(decision): matchers (#34)
1 parent 6442cf1 commit 20e7011

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

optimizely/decision/evaluator/condition.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ import (
2424
)
2525

2626
const (
27-
// EXACT match type performs an equality comparison
2827
exactMatchType = "exact"
28+
existsMatchType = "exists"
29+
ltMatchType = "lt"
30+
gtMatchType = "gt"
2931
)
3032

3133
// ConditionEvaluator evaluates a condition against the given user's attributes
@@ -50,6 +52,18 @@ func (c CustomAttributeConditionEvaluator) Evaluate(condition entities.Condition
5052
matcher = matchers.ExactMatcher{
5153
Condition: condition,
5254
}
55+
case existsMatchType:
56+
matcher = matchers.ExistsMatcher{
57+
Condition: condition,
58+
}
59+
case ltMatchType:
60+
matcher = matchers.LtMatcher{
61+
Condition: condition,
62+
}
63+
case gtMatchType:
64+
matcher = matchers.GtMatcher{
65+
Condition: condition,
66+
}
5367
}
5468

5569
result, err := matcher.Match(user)

0 commit comments

Comments
 (0)