♻️ Refactor av data structure

This commit is contained in:
Daniel 2023-07-13 23:34:13 +08:00
parent 7f097f3b99
commit 19fcd1a034
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -207,29 +207,34 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool
if nil != value.MSelect && nil != other.MSelect && 0 < len(value.MSelect) && 0 < len(other.MSelect) {
switch operator {
case FilterOperatorIsEqual:
return value.MSelect[0].Content == other.MSelect[0].Content
contains := false
for _, v := range value.MSelect {
for _, v2 := range other.MSelect {
if v.Content == v2.Content {
contains = true
break
}
}
}
return contains
case FilterOperatorIsNotEqual:
return value.MSelect[0].Content != other.MSelect[0].Content
case FilterOperatorContains:
contains := false
for _, v := range value.MSelect {
if v.Content == other.MSelect[0].Content {
return true
for _, v2 := range other.MSelect {
if v.Content == v2.Content {
contains = true
break
}
}
case FilterOperatorDoesNotContain:
for _, v := range value.MSelect {
if v.Content == other.MSelect[0].Content {
return false
}
}
return true
return !contains
case FilterOperatorIsEmpty:
return 0 == len(value.MSelect)
case FilterOperatorIsNotEmpty:
return 0 != len(value.MSelect)
}
}
return false
return true
}
// Table 描述了表格实例的结构。