23 lines
532 B
Go
23 lines
532 B
Go
package logic
|
|
|
|
import (
|
|
"database/sql"
|
|
"errors"
|
|
|
|
"sevenkeys/database"
|
|
)
|
|
|
|
var UnrecognizedStorageAreaTypeError error = errors.New("Unrecognized storage area type.")
|
|
|
|
func RemoveFromStorage(db *sql.DB, location database.LocateCardResult) error {
|
|
if location.StorageAreaType == database.StorageAreaTypeBinder {
|
|
database.RemoveFromBinder(db, location)
|
|
} else if location.StorageAreaType == database.StorageAreaTypeBox {
|
|
database.RemoveFromBox(db, location)
|
|
} else {
|
|
return UnrecognizedStorageAreaTypeError
|
|
}
|
|
|
|
return nil
|
|
}
|