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) {
|
if nil != value.MSelect && nil != other.MSelect && 0 < len(value.MSelect) && 0 < len(other.MSelect) {
|
||||||
switch operator {
|
switch operator {
|
||||||
case FilterOperatorIsEqual:
|
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:
|
case FilterOperatorIsNotEqual:
|
||||||
return value.MSelect[0].Content != other.MSelect[0].Content
|
contains := false
|
||||||
case FilterOperatorContains:
|
|
||||||
for _, v := range value.MSelect {
|
for _, v := range value.MSelect {
|
||||||
if v.Content == other.MSelect[0].Content {
|
for _, v2 := range other.MSelect {
|
||||||
return true
|
if v.Content == v2.Content {
|
||||||
|
contains = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case FilterOperatorDoesNotContain:
|
return !contains
|
||||||
for _, v := range value.MSelect {
|
|
||||||
if v.Content == other.MSelect[0].Content {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
case FilterOperatorIsEmpty:
|
case FilterOperatorIsEmpty:
|
||||||
return 0 == len(value.MSelect)
|
return 0 == len(value.MSelect)
|
||||||
case FilterOperatorIsNotEmpty:
|
case FilterOperatorIsNotEmpty:
|
||||||
return 0 != len(value.MSelect)
|
return 0 != len(value.MSelect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table 描述了表格实例的结构。
|
// Table 描述了表格实例的结构。
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue