Documentation ¶
Index ¶
- Variables
- type Station
- type StationsList
- func (sl *StationsList) Get(idx int) Station
- func (sl *StationsList) GetStations() []Station
- func (sl *StationsList) Len() int
- func (sl *StationsList) More() bool
- func (sl *StationsList) Next() Station
- func (l *StationsList) Print(writer io.Writer) error
- func (l *StationsList) WriteCSV(writer io.Writer) error
- func (l *StationsList) WriteJSON(writer io.Writer) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrStationNotFound = errors.New("Station not found")
)
Functions ¶
This section is empty.
Types ¶
type Station ¶
type Station struct { Name string `json:"name"` Address string `json:"address"` Lat float64 `json:"lat"` Long float64 `json:"long"` // Ref is a short unique reference to a station Ref string `json:"ref"` // contains filtered or unexported fields }
A Station is a train station
func FindStationByRef ¶
FindStation returns a station given its ref
type StationsList ¶
type StationsList struct {
// contains filtered or unexported fields
}
A StationsList is a list of stations
func GlobalList ¶
func GlobalList() (*StationsList, error)
GlobalList returns the list of all stations
func (*StationsList) Get ¶
func (sl *StationsList) Get(idx int) Station
Get returns the station at the given index in the list
func (*StationsList) GetStations ¶
func (sl *StationsList) GetStations() []Station
GetStations return a slice with all stations at once
func (*StationsList) Len ¶
func (sl *StationsList) Len() int
Len returns the number of stations in the list
func (*StationsList) More ¶
func (sl *StationsList) More() bool
More checks if there are more stations available with Next()
func (*StationsList) Next ¶
func (sl *StationsList) Next() Station
Next returns one station at a time. It is more effective when you need to process each station independently.
Click to show internal directories.
Click to hide internal directories.