Fix timestamp SELECT code

This commit is contained in:
The Magician 2024-05-21 14:31:20 +01:00
parent 411383704c
commit 01e06c0152
1 changed files with 3 additions and 3 deletions

View File

@ -18,16 +18,16 @@ func GetGamepieceByName(db *sql.DB, name string) (entities.Gamepiece, error) {
func GetCacheTimestampByType(db *sql.DB, cacheType string) (time.Time, error) {
var timestamp string
query := "SELECT Stamp FROM CacheTimestamps WHERE CacheType = ?;"
query := "SELECT Stamp FROM CacheTimestamp WHERE CacheType = ?;"
err := db.QueryRow(query, cacheType).Scan(&timestamp)
if err == sql.ErrNoRows {
return time.Unix(0, 0), nil
return time.Unix(0, 0), err
}
stamp, err := time.Parse("2006-01-02 15:04:05", timestamp)
if err != nil {
return time.Unix(0, 0), nil
return time.Unix(0, 0), err
}
return stamp, err