Added StatDB data type and IsKeyInvalid, AddStatistics methods

This commit is contained in:
2025-06-18 16:58:52 +02:00
parent e46ce3e2b2
commit 2db2c57ce2
5 changed files with 131 additions and 11 deletions

17
model/statisticsModel.go Normal file
View File

@@ -0,0 +1,17 @@
package model
import (
"errors"
"github.com/ceticamarco/zephyr/types"
)
func GetStatistics(cityName string, statDB *types.StatDB) (types.StatResult, error) {
// Check whether there are sufficient and updated records for the given location
if statDB.IsKeyInvalid(cityName) {
return types.StatResult{}, errors.New("Insufficient or outdated data to perform statistical analysis")
}
// TODO: we have enough data, do the math!
return types.StatResult{}, nil
}