Files
golifehk/datasources/kmb/BusStop.go
2026-03-08 15:38:28 +08:00

53 lines
1.1 KiB
Go

package kmb
import (
i18n "github.com/tgckpg/golifehk/i18n"
query "github.com/tgckpg/golifehk/query"
)
type BusStopJson struct {
BusStopId string `json:"stop"`
Latitude float64 `json:"lat,string"`
Longitude float64 `json:"long,string"`
Name_en string `json:"name_en"`
Name_tc string `json:"name_tc"`
Name_sc string `json:"name_sc"`
}
type BusStop struct {
BusStopId string
// Routes[ Route ][ Direction ]
Routes *[]*RouteStop
i18n.Generics
query.GeoLocation
}
type BusStopsJson struct {
Type string `json:"type"`
Version string `json:"version"`
DateCreated string `json:"generated_timestamp"`
BusStops []*BusStopJson `json:"data"`
}
func (b BusStop) Register(registers map[string]struct{}) bool {
if _, ok := registers[b.BusStopId]; ok {
return false
}
registers[b.BusStopId] = struct{}{}
return true
}
func (this *BusStop) Reload() {
searchData := []*string{}
searchData = append(searchData, &this.BusStopId)
for _, v := range *this.Name {
searchData = append(searchData, &v)
}
this.Key = &this.BusStopId
this.SearchData = &searchData
}