mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958
This commit is contained in:
parent
50156a0dc9
commit
e29b674301
3 changed files with 78 additions and 0 deletions
|
|
@ -38,6 +38,46 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func SearchAttributeViewNonRelationKey(avID, keyword string) (ret []*av.Key) {
|
||||
waitForSyncingStorages()
|
||||
|
||||
ret = []*av.Key{}
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
if av.KeyTypeRelation != keyValues.Key.Type {
|
||||
if strings.Contains(strings.ToLower(keyValues.Key.Name), strings.ToLower(keyword)) {
|
||||
ret = append(ret, keyValues.Key)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SearchAttributeViewRelationKey(avID, keyword string) (ret []*av.Key) {
|
||||
waitForSyncingStorages()
|
||||
|
||||
ret = []*av.Key{}
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
if av.KeyTypeRelation == keyValues.Key.Type && nil != keyValues.Key.Relation {
|
||||
if strings.Contains(strings.ToLower(keyValues.Key.Name), strings.ToLower(keyword)) {
|
||||
ret = append(ret, keyValues.Key)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetAttributeView(avID string) (ret *av.AttributeView) {
|
||||
waitForSyncingStorages()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue