Documentation ¶
Overview ¶
WIP: Tried using goquery / html parser. Doesn't seem to be working; probably go back to encoding/xml and structs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Sample = []Forecast{ Forecast{ Date: "3 Jan", Description: "Hot and sunny", ChanceOfRain: "10%", PreciseForecast: nil, }, Forecast{ Date: "4 Jan", Description: "Cold and rainy", PrecipitationRange: "1-2mm", PreciseForecast: &PreciseForecast{ MaxTemperature: 36, MinTemperature: 12, }, }, }
View Source
var WeatherUrl, _ = url.Parse("ftp://ftp2.bom.gov.au/anon/gen/fwo/IDV10450.xml")
Functions ¶
This section is empty.
Types ¶
type BomXmlExtractor ¶
type BomXmlExtractor struct { Version string `xml:"version,attr"` Forecast []BomXmlForecast `xml:"forecast>area"` }
type BomXmlForecast ¶
type BomXmlForecast struct { // Content string `xml:",chardata"` Aac string `xml:"aac,attr"` ForecastPeriod []struct { Index int `xml:"index,attr"` StartTimeLocal time.Time `xml:"start-time-local,attr"` EndTimeLocal time.Time `xml:"end-time-local,attr"` Elements BomXmlTexts `xml:"element"` Text BomXmlTexts `xml:"text"` } `xml:"forecast-period"` }
type BomXmlText ¶
type BomXmlTexts ¶
type BomXmlTexts []BomXmlText
func (BomXmlTexts) ToPreciseForecast ¶
func (t BomXmlTexts) ToPreciseForecast() (*PreciseForecast, error)
type ErrKeyMissing ¶
type ErrKeyMissing string
func (ErrKeyMissing) Error ¶
func (e ErrKeyMissing) Error() string
type Forecast ¶
type Forecast struct { Date string Description string ChanceOfRain string PrecipitationRange string *PreciseForecast }
type PreciseForecast ¶
Click to show internal directories.
Click to hide internal directories.