mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Global search supports pagination to display results https://github.com/siyuan-note/siyuan/issues/7948
This commit is contained in:
parent
685b7e1383
commit
1eba131624
6 changed files with 21 additions and 12 deletions
|
|
@ -417,7 +417,7 @@ func SelectBlocksRawStmtNoParse(stmt string, limit int) (ret []*Block) {
|
|||
return selectBlocksRawStmt(stmt, limit)
|
||||
}
|
||||
|
||||
func SelectBlocksRawStmt(stmt string, limit int) (ret []*Block) {
|
||||
func SelectBlocksRawStmt(stmt string, page, limit int) (ret []*Block) {
|
||||
parsedStmt, err := sqlparser.Parse(stmt)
|
||||
if nil != err {
|
||||
return selectBlocksRawStmt(stmt, limit)
|
||||
|
|
@ -433,6 +433,15 @@ func SelectBlocksRawStmt(stmt string, limit int) (ret []*Block) {
|
|||
Val: []byte(strconv.Itoa(limit)),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
slct.Limit.Rowcount = &sqlparser.SQLVal{
|
||||
Type: sqlparser.IntVal,
|
||||
Val: []byte(strconv.Itoa(limit)),
|
||||
}
|
||||
slct.Limit.Offset = &sqlparser.SQLVal{
|
||||
Type: sqlparser.IntVal,
|
||||
Val: []byte(strconv.Itoa((page - 1) * 32)),
|
||||
}
|
||||
}
|
||||
|
||||
stmt = sqlparser.String(slct)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue