27 lines
854 B
Go
27 lines
854 B
Go
package data
|
|
|
|
import (
|
|
"database/sql"
|
|
"time"
|
|
"weatherstation/internal/database"
|
|
"weatherstation/pkg/types"
|
|
)
|
|
|
|
func DB() *sql.DB { return database.GetDB() }
|
|
|
|
func OnlineDevices() int { return database.GetOnlineDevicesCount(DB()) }
|
|
|
|
func Stations() ([]types.Station, error) { return database.GetStations(DB()) }
|
|
|
|
func SeriesRaw(stationID string, start, end time.Time) ([]types.WeatherPoint, error) {
|
|
return database.GetSeriesRaw(DB(), stationID, start, end)
|
|
}
|
|
|
|
func SeriesFrom10Min(stationID string, start, end time.Time, interval string) ([]types.WeatherPoint, error) {
|
|
return database.GetSeriesFrom10Min(DB(), stationID, start, end, interval)
|
|
}
|
|
|
|
func Forecast(stationID string, start, end time.Time, provider string, versions int) ([]types.ForecastPoint, error) {
|
|
return database.GetForecastData(DB(), stationID, start, end, provider, versions)
|
|
}
|