Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( YilanCounty = iota TaoyuanCounty HsinchuCounty MiaoliCounty ChanghuaCounty NantouCounty YunlinCounty ChiayiCounty PingtungCounty TaitungCounty HualienCounty PenghuCounty KeelungCity HsinchuCity ChiayiCity TaipeiCity KaohsiungCity NewTapipeiCity TaichungCity TainanCity LienchiangCounty KinmenCounty )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Forecast ¶
type Forecast struct { Description string Language string IssueTime time.Time UpdateTime time.Time ContentDescription string LocationName string }
func (*Forecast) UnmarshalXML ¶
type LocationForecast ¶
type LocationForecast struct { Location WeatherElements []TimelineWeatherElement `xml:"weatherElement"` }
type Measurement ¶
type Timed ¶
func (*Timed) UnmarshalXML ¶
type TimelineWeatherElement ¶
type WeeklyForecast ¶
type WeeklyForecast struct { Forecast Locations []LocationForecast }
func GetWeeklyForecast ¶
func GetWeeklyForecast(apiKey string, city int) (f *WeeklyForecast, err error)
func OpenDataToWeeklyForecast ¶
func OpenDataToWeeklyForecast(opendata *cwbdata.CwbOpenData) (*WeeklyForecast, error)
Example ¶
data := testutil.Load("weekly_forecast_sample.xml") opendata, err := cwbdata.GetOpenDataByData(data) if err != nil { log.Panic(err) } wf, err := OpenDataToWeeklyForecast(opendata) if err != nil { log.Panic(err) } fmt.Println(wf.Description) fmt.Println(wf.Language) fmt.Println(wf.IssueTime.UTC()) fmt.Println(wf.UpdateTime.UTC())
Output: 宜蘭縣未來1週天氣預報 zh-TW 2018-01-13 09:00:00 +0000 UTC 2018-01-13 09:06:00 +0000 UTC
func (*WeeklyForecast) UnmarshalXML ¶
func (wf *WeeklyForecast) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Click to show internal directories.
Click to hide internal directories.