🎨 Backlink count at the doc block title including sub-blocks https://github.com/siyuan-note/siyuan/issues/13791

This commit is contained in:
Daniel
2025-01-12 21:19:03 +08:00
parent ae7eaebf9e
commit 1a991bf20f
3 changed files with 8 additions and 11 deletions

View File

@@ -32,22 +32,21 @@ type FileAnnotationRef struct {
Type string
}
func QueryRefIDsByAnnotationID(annotationID string) (refIDs, refTexts []string) {
func QueryRefIDsByAnnotationID(annotationID string) (refIDs []string) {
refIDs = []string{}
rows, err := query("SELECT block_id, content FROM file_annotation_refs WHERE annotation_id = ?", annotationID)
rows, err := query("SELECT block_id FROM file_annotation_refs WHERE annotation_id = ?", annotationID)
if err != nil {
logging.LogErrorf("sql query failed: %s", err)
return
}
defer rows.Close()
for rows.Next() {
var id, content string
if err = rows.Scan(&id, &content); err != nil {
var id string
if err = rows.Scan(&id); err != nil {
logging.LogErrorf("query scan field failed: %s", err)
return
}
refIDs = append(refIDs, id)
refTexts = append(refTexts, content)
}
return
}