mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve graph https://github.com/siyuan-note/siyuan/issues/13040
This commit is contained in:
parent
83b932478e
commit
a48609755e
4 changed files with 10 additions and 8 deletions
|
|
@ -726,7 +726,7 @@ func scanBlockRow(row *sql.Row) (ret *Block) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetChildBlocks(parentID, condition string) (ret []*Block) {
|
||||
func GetChildBlocks(parentID, condition string, limit int) (ret []*Block) {
|
||||
blockIDs := queryBlockChildrenIDs(parentID)
|
||||
var params []string
|
||||
for _, id := range blockIDs {
|
||||
|
|
@ -738,6 +738,7 @@ func GetChildBlocks(parentID, condition string) (ret []*Block) {
|
|||
if "" != condition {
|
||||
sqlStmt += " AND " + condition
|
||||
}
|
||||
sqlStmt += " LIMIT " + strconv.Itoa(limit)
|
||||
rows, err := query(sqlStmt)
|
||||
if err != nil {
|
||||
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
|
||||
|
|
@ -752,12 +753,13 @@ func GetChildBlocks(parentID, condition string) (ret []*Block) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetAllChildBlocks(rootIDs []string, condition string) (ret []*Block) {
|
||||
func GetAllChildBlocks(rootIDs []string, condition string, limit int) (ret []*Block) {
|
||||
ret = []*Block{}
|
||||
sqlStmt := "SELECT * FROM blocks AS ref WHERE ref.root_id IN ('" + strings.Join(rootIDs, "','") + "')"
|
||||
if "" != condition {
|
||||
sqlStmt += " AND " + condition
|
||||
}
|
||||
sqlStmt += " LIMIT " + strconv.Itoa(limit)
|
||||
rows, err := query(sqlStmt)
|
||||
if err != nil {
|
||||
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue