Added kmb and refactored query.Parse
This commit is contained in:
40
datasources/kmb/BusStop.go
Normal file
40
datasources/kmb/BusStop.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package kmb
|
||||
|
||||
import (
|
||||
i18n "github.com/tgckpg/golifehk/i18n"
|
||||
)
|
||||
|
||||
type BusStop struct {
|
||||
BusStopId string `json:"stop"`
|
||||
Latitude float64 `json:"lat,string"`
|
||||
Longtitude float64 `json:"long,string"`
|
||||
Name_en string `json:"name_en"`
|
||||
Name_tc string `json:"name_tc"`
|
||||
Name_sc string `json:"name_sc"`
|
||||
|
||||
// Routes[ Route ][ Direction ]
|
||||
Routes *[] *RouteStop
|
||||
|
||||
i18n.Generics
|
||||
}
|
||||
|
||||
type BusStops struct {
|
||||
Type string `json:"type"`
|
||||
Version string `json:"version"`
|
||||
DateCreated string `json:"generated_timestamp"`
|
||||
BusStops [] *BusStop `json:"data"`
|
||||
}
|
||||
|
||||
func ( this *BusStop ) Reload() {
|
||||
i18n_Name := map[string] string{}
|
||||
i18n_Name["en"] = this.Name_en
|
||||
i18n_Name["zh-Hant"] = this.Name_tc
|
||||
|
||||
searchData := [] *string{}
|
||||
searchData = append( searchData, &this.Name_en )
|
||||
searchData = append( searchData, &this.Name_tc )
|
||||
|
||||
this.Name = &i18n_Name
|
||||
this.Key = &this.BusStopId
|
||||
this.SearchData = &searchData
|
||||
}
|
||||
Reference in New Issue
Block a user