code refactoring

This commit is contained in:
2025-06-18 11:13:47 +02:00
parent a87b6a0c06
commit e46ce3e2b2
5 changed files with 45 additions and 60 deletions

View File

@@ -62,14 +62,12 @@ func GetWind(city *types.City, apiKey string) (types.Wind, error) {
defer res.Body.Close()
// Structures representing the JSON response
type CurrentRes struct {
Speed float64 `json:"wind_speed"`
Degrees float64 `json:"wind_deg"`
}
// Structure representing the JSON response
type WindRes struct {
Current CurrentRes `json:"current"`
Current struct {
Speed float64 `json:"wind_speed"`
Degrees float64 `json:"wind_deg"`
} `json:"current"`
}
var windRes WindRes