TheMathemagicians/sevenkeys/logic/storage.go

23 lines
421 B
Go

package logic
import (
"database/sql"
"sevenkeys/database"
)
func StoreCard(db *sql.DB, storageLocation database.CardStorageLocation) error {
lastPosition, err := database.GetLastPositionInBox(db, storageLocation.StorageBox)
if err != nil {
return err
}
storageLocation.Position = lastPosition + 1
err = database.InsertCardStorageLocation(db, storageLocation)
if err != nil {
return err
}
return nil
}