mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
♻️ Refactor av data structure
This commit is contained in:
parent
7f097f3b99
commit
19fcd1a034
1 changed files with 18 additions and 13 deletions
|
|
@ -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 描述了表格实例的结构。
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue