This commit is contained in:
Liang Ding 2023-01-09 10:34:37 +08:00
parent c631b64d00
commit dc112fd56c
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 36 additions and 31 deletions

View file

@ -581,15 +581,19 @@ func GetBlock(id string) (ret *Block) {
return
}
func GetRootUpdated(rootID string) (ret string, err error) {
rows, err := query("SELECT updated FROM blocks WHERE root_id = ? AND type = 'd'", rootID)
func GetRootUpdated() (ret map[string]string, err error) {
rows, err := query("SELECT root_id, updated FROM blocks WHERE type = 'd'")
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return
}
defer rows.Close()
ret = map[string]string{}
for rows.Next() {
rows.Scan(&ret)
var rootID, updated string
rows.Scan(&rootID, &updated)
ret[rootID] = updated
}
return
}