Almost there
This commit is contained in:
@@ -68,7 +68,7 @@ func getLastSnapshotRecordFromDb() (*SnapshotRecord, error) {
|
|||||||
|
|
||||||
func getSnapshotRecordsFromDb(dateSince string) ([]*SnapshotRecord, error) {
|
func getSnapshotRecordsFromDb(dateSince string) ([]*SnapshotRecord, error) {
|
||||||
snapshots := make([]*SnapshotRecord, 0)
|
snapshots := make([]*SnapshotRecord, 0)
|
||||||
query := "SELECT `%s`, `%s`, `%s`, `%s`, `%s` FROM `snapshots` WHERE `%s` > %s ORDER BY `id` DESC;"
|
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))
|
rows, err := ClimateDb.Query(fmt.Sprintf(query, "id", "temp", "humidity", "co2", "time", "time", dateSince))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("couldn't execute select query: %w", err)
|
return nil, fmt.Errorf("couldn't execute select query: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user