add ristretto caching and process daily and rolling data
This commit is contained in:
@@ -2,9 +2,19 @@ package meteo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MeteoDataFromServiceA struct {
|
||||
Timestamp time.Time `csv:"fecha" json:"timestamp"`
|
||||
Location string `csv:"ciudad" json:"location"`
|
||||
MaxTemp float32 `csv:"temperatura maxima" json:"max_temp"`
|
||||
MinTemp float32 `csv:"temperatura minima" json:"min_temp"`
|
||||
Rainfall float32 `csv:"precipitacion" json:"rainfall"`
|
||||
Cloudiness int `csv:"nubosidad" json:"cloudiness"`
|
||||
}
|
||||
|
||||
type MeteoDataPerDay struct {
|
||||
MaxTemp float32 `json:"max_temp"`
|
||||
MinTemp float32 `json:"min_temp"`
|
||||
@@ -33,6 +43,10 @@ type MeteoData struct {
|
||||
Rolling7 *Rolling7Data `json:"rolling7,omitempty"`
|
||||
}
|
||||
|
||||
func (mt *MeteoData) ComputeCacheKey() string {
|
||||
return fmt.Sprintf("meteo:%s:%s", mt.Location, mt.From)
|
||||
}
|
||||
|
||||
type Unit string
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user