Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Board ¶
Board represents a snapshot in time of the departure board at a station. Station is the statation the departure board is for. AsAt is the time the snapshot was taken. Departures holds the departing trains.
func LoadFromFile ¶
LoadFromFile processes a National Rail HTML snapshot, stored in a file, and returns the departure board that it represents. No attempt is made to identify the station or the time the information was captured so these must also be supplied as additional arguments.
func LoadFromInternet ¶
LoadFromInternet makes a call to fetch the departure board for the specified station and returns the associated departure board.
type Departure ¶
type Departure struct {
Destination string
Platform string
DepartureTime time.Time
ExpectedTime time.Time
LateByMins int
Status TrainStatus
}
Departure represents a single train departure. Destination is the destination of the train Platform is the platform the train will be departing from - will be blank until a platform is assigned. DepartureTime is the scheduled departure time for the train. ExpectedTime is the actual time the trains is expected to leave. LateByMins is the delay in minutes of the train when the status is late Status is the status of the train.
type TrainStatus ¶
type TrainStatus int
TrainStatus defines that status that the departing train is in. The values are limited to: OnTime, Delayed, Cancelled, Late and Unknown
const ( // OnTime - the train is expect at it's scheduled departure time OnTime TrainStatus = iota + 1 // Delayed - there is a delay in the departure, no further details about the delay Delayed // Cancelled - the train has been cancelled Cancelled // Late - the train is delayed and is running late by a known amout of time Late // Unknown - No know information about the train exists Unknown )
func (TrainStatus) String ¶
func (ts TrainStatus) String() string