Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultPref = 13
Variables ¶
This section is empty.
Functions ¶
func GetWeatherName ¶
Convert WMO codes to their corresponding strings.
Types ¶
type CurrentData ¶
type CurrentData struct {
Time string `json:"time"`
Interval int `json:"interval"`
Temperature2m float64 `json:"temperature_2m"`
WeatherCode int `json:"weather_code"`
Precipitation float64 `json:"precipitation"`
RelativeHumidity2m int `json:"relative_humidity_2m"`
PressureMsl float64 `json:"pressure_msl"`
}
type CurrentUnits ¶
type CurrentUnits struct {
Time string `json:"time"`
Interval string `json:"interval"`
Temperature2m string `json:"temperature_2m"`
WeatherCode string `json:"weather_code"`
Precipitation string `json:"precipitation"`
RelativeHumidity2m string `json:"relative_humidity_2m"`
PressureMsl string `json:"pressure_msl"`
}
type DailyData ¶
type DailyData struct {
Time []string `json:"time"`
WeatherCode []int `json:"weather_code"`
Temperature2mMax []float64 `json:"temperature_2m_max"`
Temperature2mMin []float64 `json:"temperature_2m_min"`
PrecipitationProbabilityMax []int `json:"precipitation_probability_max"`
PrecipitationSum []float64 `json:"precipitation_sum"`
PressureMslMax []float64 `json:"pressure_msl_max"`
PressureMslMin []float64 `json:"pressure_msl_min"`
Sunrise []string `json:"sunrise"`
Sunset []string `json:"sunset"`
}
type DailyUnits ¶
type DailyUnits struct {
Time string `json:"time"`
WeatherCode string `json:"weather_code"`
Temperature2mMax string `json:"temperature_2m_max"`
Temperature2mMin string `json:"temperature_2m_min"`
PrecipitationProbabilityMax string `json:"precipitation_probability_max"`
PrecipitationSum string `json:"precipitation_sum"`
PressureMslMax string `json:"pressure_msl_max"`
PressureMslMin string `json:"pressure_msl_min"`
Sunrise string `json:"sunrise"`
Sunset string `json:"sunset"`
}
type GeoResponse ¶
type GeoResponse struct {
IP string `json:"ip"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Region string `json:"region"`
City string `json:"city"`
Latitude string `json:"latitude"` // 文字列で返るためstring
Longitude string `json:"longitude"` // 文字列で返るためstring
Organization string `json:"organization"`
Timezone string `json:"timezone"`
}
GeoResponse はGeoJS APIからのレスポンス構造を定義します
func GetGeoInfo ¶
func GetGeoInfo() (*GeoResponse, error)
type Location ¶
type Location struct {
Prefecture string // 都道府県名
City string // 都市名
Latitude float64 // 緯度
Longitude float64 // 経度
}
県庁所在地の情報を表す構造体
func GetPrefCapitalData ¶
都道府県コードから Location を取得
type WeatherResponse ¶
type WeatherResponse struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
GenerationTimeMS float64 `json:"generationtime_ms"`
UtcOffsetSeconds int `json:"utc_offset_seconds"`
Timezone string `json:"timezone"`
TimezoneAbbreviation string `json:"timezone_abbreviation"`
Elevation float64 `json:"elevation"`
CurrentUnits CurrentUnits `json:"current_units"`
Current CurrentData `json:"current"`
DailyUnits DailyUnits `json:"daily_units"`
Daily DailyData `json:"daily"`
}
func GetWeatherInfo ¶
func GetWeatherInfo(latitude, longitude float64) (*WeatherResponse, error)
Click to show internal directories.
Click to hide internal directories.