|
@@ -54,17 +54,36 @@ func (s ConditionLogic) IsValid() bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+const (
|
|
|
+ MethodEmpty = ""
|
|
|
+ MethodLower = "lower"
|
|
|
+ MethodUpper = "upper"
|
|
|
+)
|
|
|
+
|
|
|
+type ConditionMethod string
|
|
|
+
|
|
|
+func (s ConditionMethod) IsValid() bool {
|
|
|
+ switch s {
|
|
|
+ case MethodEmpty:
|
|
|
+ case MethodLower:
|
|
|
+ default:
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+}
|
|
|
+
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
type Condition struct {
|
|
|
Field string `json:"Field"`
|
|
|
Logic ConditionLogic `json:"Logic"`
|
|
|
Operator ConditionOperator `json:"Operator"`
|
|
|
+ Method ConditionMethod `json:"Method"`
|
|
|
Value any `json:"Value"`
|
|
|
}
|
|
|
|
|
|
func (s *Condition) IsValid() bool {
|
|
|
- return len(s.Field) > 0 && s.Logic.IsValid() && s.Operator.IsValid()
|
|
|
+ return len(s.Field) > 0 && s.Logic.IsValid() && s.Operator.IsValid() && s.Method.IsValid()
|
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|