Flagship 支持 11 种用于目标定位规则条件的比较运算符。每个运算符将评估上下文中的属性与指定值进行比较。
| 运算符 | 描述 | 示例 | 值类型 |
|---|---|---|---|
equals |
如果属性值与指定值匹配,则返回 true。 | country equals "US" |
String |
not_equals |
如果属性值与指定值不匹配,则返回 true。 | plan not_equals "free" |
String |
greater_than |
如果属性值大于指定值,则返回 true。 | age greater_than 18 |
Number, ISO 8601 datetime |
less_than |
如果属性值小于指定值,则返回 true。 | loginCount less_than 5 |
Number, ISO 8601 datetime |
greater_than_or_equals |
如果属性值大于或等于指定值,则返回 true。 | score greater_than_or_equals 90 |
Number, ISO 8601 datetime |
less_than_or_equals |
如果属性值小于或等于指定值,则返回 true。 | createdAt less_than_or_equals "2025-01-01T00:00:00Z" |
Number, ISO 8601 datetime |
contains |
如果属性值包含指定的子字符串,则返回 true。 | email contains "@cloudflare.com" |
String |
starts_with |
如果属性值以指定前缀开头,则返回 true。 | path starts_with "/api/v2" |
String |
ends_with |
如果属性值以指定后缀结尾,则返回 true。 | domain ends_with ".dev" |
String |
in |
如果属性值在指定的数组中,则返回 true。 | country in ["US", "CA", "UK"] |
Array |
not_in |
如果属性值不在指定的数组中,则返回 true。 | userId not_in ["blocked-1", "blocked-2"] |
Array |
equals, not_equals
使用这些运算符进行精确的字符串匹配。比较区分大小写。
greater_than, less_than, greater_than_or_equals, less_than_or_equals
这些运算符适用于数值和 ISO 8601 日期时间字符串。比较日期时间时,请以 ISO 8601 格式提供值(例如 "2025-01-01T00:00:00Z")。
contains, starts_with, ends_with
这些运算符针对属性值执行子字符串匹配。所有字符串比较均区分大小写。
in, not_in
该值必须是一个数组。Flagship 会检查属性值是否为指定数组的成员。