反链面板

This commit is contained in:
Liang Ding 2022-09-29 12:11:52 +08:00
parent 8ae5858302
commit f6411dba9a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 156 additions and 0 deletions

View file

@ -343,6 +343,21 @@ func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref) {
return
}
func QueryRefsByDefIDRefRootID(defBlockID, refRootBlockID string) (ret []*Ref) {
stmt := "SELECT * FROM refs WHERE def_block_id = ? AND root_id = ?"
rows, err := query(stmt, defBlockID, refRootBlockID)
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return
}
defer rows.Close()
for rows.Next() {
ref := scanRefRows(rows)
ret = append(ret, ref)
}
return
}
func QueryRefsByDefIDRefID(defBlockID, refBlockID string) (ret []*Ref) {
stmt := "SELECT * FROM refs WHERE def_block_id = ? AND block_id = ?"
rows, err := query(stmt, defBlockID, refBlockID)