mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Minor changes
This commit is contained in:
parent
f1a8a067d4
commit
dc8addf062
2 changed files with 22 additions and 6 deletions
8
internal/cache/sqlite/sqlite.go
vendored
8
internal/cache/sqlite/sqlite.go
vendored
|
|
@ -72,7 +72,13 @@ func DeleteScannedAssets(path string, assets ...magellan.RemoteAsset) error {
|
|||
}
|
||||
tx := db.MustBegin()
|
||||
for _, asset := range assets {
|
||||
sql := fmt.Sprintf(`DELETE FROM %s WHERE host=:host AND port=:port;`, TABLE_NAME)
|
||||
if asset.Host == "" && asset.Port <= 0 {
|
||||
continue
|
||||
}
|
||||
sql := fmt.Sprintf(`DELETE FROM %s WHERE port=:port;`, TABLE_NAME)
|
||||
if asset.Host != "" {
|
||||
sql += "AND host=:host"
|
||||
}
|
||||
_, err := tx.NamedExec(sql, &asset)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to execute DELETE transaction: %v\n", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue