🎨 Improve upload assets to cloud

This commit is contained in:
Daniel 2024-01-01 16:54:00 +08:00
parent b9f1da33f0
commit fdb0600dbb
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 15 additions and 25 deletions

View file

@ -115,21 +115,6 @@ func QueryAssetByHash(hash string) (ret *Asset) {
return
}
func QueryRootBlockAssets(rootID string) (ret []*Asset) {
sqlStmt := "SELECT * FROM assets WHERE root_id = ?"
rows, err := query(sqlStmt, rootID)
if nil != err {
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
return
}
defer rows.Close()
for rows.Next() {
asset := scanAssetRows(rows)
ret = append(ret, asset)
}
return
}
func scanAssetRows(rows *sql.Rows) (ret *Asset) {
var asset Asset
if err := rows.Scan(&asset.ID, &asset.BlockID, &asset.RootID, &asset.Box, &asset.DocPath, &asset.Path, &asset.Name, &asset.Title, &asset.Hash); nil != err {