Almost there

This commit is contained in:
Daniel Ledda
2020-11-14 15:20:39 +01:00
parent 4a62cac5b1
commit 99b7c21c76

View File

@@ -70,7 +70,7 @@ func getLastSnapshotRecordFromDb() (*SnapshotRecord, error) {
func getSnapshotRecordsFromDb(dateSince time.Time) ([]*SnapshotRecord, error) {
snapshots := make([]*SnapshotRecord, 0)
query := "SELECT `%s`, `%s`, `%s`, `%s`, `%s` FROM `snapshots` WHERE `%s` > %s ORDER BY `id` DESC;"
rows, err := ClimateDb.Query(fmt.Sprintf(query, "id", "temp", "humidity", "co2", "time", "time", dateSince.String()))
rows, err := ClimateDb.Query(fmt.Sprintf(query, "id", "temp", "humidity", "co2", "time", "time", dateSince))
if err != nil {
return nil, fmt.Errorf("couldn't execute select query: %w", err)
}