TheMathemagicians/sevenkeys/logic/remove.go

23 lines
532 B
Go
Raw Normal View History

2024-09-12 12:37:41 +00:00
package logic
import (
"database/sql"
"errors"
"sevenkeys/database"
)
var UnrecognizedStorageAreaTypeError error = errors.New("Unrecognized storage area type.")
2024-09-13 11:32:18 +00:00
func RemoveFromStorage(db *sql.DB, location database.LocateCardResult) error {
2024-09-13 11:33:20 +00:00
if location.StorageAreaType == database.StorageAreaTypeBinder {
2024-09-12 12:37:41 +00:00
database.RemoveFromBinder(db, location)
2024-09-13 11:33:20 +00:00
} else if location.StorageAreaType == database.StorageAreaTypeBox {
2024-09-12 12:37:41 +00:00
database.RemoveFromBox(db, location)
} else {
return UnrecognizedStorageAreaTypeError
}
return nil
}