🎨 Identify the database view whether is a "mirror" https://github.com/siyuan-note/siyuan/issues/9578

This commit is contained in:
Daniel 2023-11-03 11:15:33 +08:00
parent 029dfefd1f
commit e964eddbeb
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 42 additions and 0 deletions

View file

@ -53,6 +53,21 @@ type BlockTree struct {
Type string // 类型
}
func GetBlockTreesByType(typ string) (ret []*BlockTree) {
blockTrees.Range(func(key, value interface{}) bool {
slice := value.(*btSlice)
slice.m.Lock()
for _, b := range slice.data {
if b.Type == typ {
ret = append(ret, b)
}
}
slice.m.Unlock()
return true
})
return
}
func GetBlockTreeByPath(path string) (ret *BlockTree) {
blockTrees.Range(func(key, value interface{}) bool {
slice := value.(*btSlice)