Another small bug fix

This commit is contained in:
2024-08-05 19:34:40 +02:00
parent 5616b51512
commit 892af71e19

View File

@@ -29,7 +29,7 @@ func GetGameById(gameId int) (models.GameData, error) {
var added, deleted, lastChanged, lastPlayed pgtype.Timestamp var added, deleted, lastChanged, lastPlayed pgtype.Timestamp
err := pool.QueryRow(context.Background(), err := pool.QueryRow(context.Background(),
"SELECT id, game_name, added, deleted, last_changed, path, times_played, last_played, number_of_songs "+ "SELECT id, game_name, added, deleted, last_changed, path, times_played, last_played, number_of_songs "+
"FROM game WHERE id = $1 AND deleted IS NULL", gameId).Scan(&id, &gameName, &added, &deleted, &lastChanged, &path, &timesPlayed, &lastPlayed, &numberOfSongs) "FROM game WHERE id = $1 AND deleted IS NULL ", gameId).Scan(&id, &gameName, &added, &deleted, &lastChanged, &path, &timesPlayed, &lastPlayed, &numberOfSongs)
if err != nil { if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "QueryRow failed: %v\n", err) _, _ = fmt.Fprintf(os.Stderr, "QueryRow failed: %v\n", err)
return models.GameData{}, errors.New("Game not found") return models.GameData{}, errors.New("Game not found")
@@ -121,7 +121,7 @@ func InsertGameWithExistingId(id int, name string, path string) {
func FindAllGames() []models.GameData { func FindAllGames() []models.GameData {
rows, err := pool.Query(context.Background(), rows, err := pool.Query(context.Background(),
"SELECT id, game_name, added, deleted, last_changed, path, times_played, last_played, number_of_songs "+ "SELECT id, game_name, added, deleted, last_changed, path, times_played, last_played, number_of_songs "+
"FROM game WHERE deleted IS NULL"+ "FROM game WHERE deleted IS NULL "+
"ORDER BY game_name") "ORDER BY game_name")
if err != nil { if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "QueryRow failed: %v\n", err) _, _ = fmt.Fprintf(os.Stderr, "QueryRow failed: %v\n", err)