mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Add a kernel internal api /api/av/getAttributeViewKeysByID
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
01ed3fe4c4
commit
cf3e9ca081
3 changed files with 33 additions and 3 deletions
|
|
@ -1179,7 +1179,7 @@ func DuplicateDatabaseBlock(avID string) (newAvID, newBlockID string, err error)
|
|||
return
|
||||
}
|
||||
|
||||
func GetAttributeViewKeysByAvID(avID string) (ret []*av.Key) {
|
||||
func GetAttributeViewKeysByID(avID string, keyIDs ...string) (ret []*av.Key) {
|
||||
ret = []*av.Key{}
|
||||
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
|
|
@ -1188,9 +1188,21 @@ func GetAttributeViewKeysByAvID(avID string) (ret []*av.Key) {
|
|||
return
|
||||
}
|
||||
|
||||
if 1 > len(keyIDs) {
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
key := keyValues.Key
|
||||
ret = append(ret, key)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
key := keyValues.Key
|
||||
ret = append(ret, key)
|
||||
for _, keyID := range keyIDs {
|
||||
if key.ID == keyID {
|
||||
ret = append(ret, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue