This commit is contained in:
Liang Ding 2023-01-31 20:24:44 +08:00
parent bc7b29bd0e
commit bd153b89c5
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 18 additions and 11 deletions

View file

@ -92,14 +92,10 @@ func docTitleImgAsset(root *ast.Node) *Asset {
return nil
}
func DeleteAssetsByHashes(hashes []string) {
func deleteAssetsByHashes(tx *sql.Tx, hashes []string) (err error) {
sqlStmt := "DELETE FROM assets WHERE hash IN ('" + strings.Join(hashes, "','") + "') OR hash = ''"
tx, err := beginTx()
if nil != err {
return
}
execStmtTx(tx, sqlStmt)
commitTx(tx)
err = execStmtTx(tx, sqlStmt)
return
}
func QueryAssetByHash(hash string) (ret *Asset) {