Documentation ¶
Index ¶
- Constants
- func GetFilteredRemarks(modifications []Modification, language string) []string
- func GetRemarks(modifications []Modification, language string) []string
- func Translate(remarkNL, remarkEN, language string) string
- func TranslateCause(causeLong string) string
- func TranslateStations(remarkNL, remarkEN string, stations []Station, language string) string
- type Arrival
- func (arrival Arrival) ActualOriginCodes() []string
- func (arrival Arrival) ActualOriginString() string
- func (arrival *Arrival) GenerateID()
- func (arrival Arrival) PlannedOriginString() string
- func (arrival Arrival) PlatformChanged() bool
- func (arrival Arrival) RealArrivalTime() time.Time
- func (arrival Arrival) ViaStationsString() string
- type BoardingTip
- type ChangeTip
- type Departure
- func (departure Departure) ActualDestinationCodes() []string
- func (departure Departure) ActualDestinationString() string
- func (departure Departure) ActualViaStationsString() string
- func (departure *Departure) GenerateID()
- func (departure Departure) GetRemarksTips(language string) (remarks, tips []string)
- func (departure Departure) PlannedDestinationString() string
- func (departure Departure) PlannedViaStationsString() string
- func (departure Departure) PlatformChanged() bool
- func (departure Departure) RealDepartureTime() time.Time
- type Material
- type Modification
- type Service
- type ServicePart
- type ServiceStop
- type Station
- type StoreItem
- type TrainWing
- type TravelTip
Constants ¶
const ModificationArrivalPlatformAllocated = 23
ModificationArrivalPlatformAllocated when a arrival platform is allocated (only DVM stations, i.e. Schiphol Airport)
const ModificationBusReplacement = 51
ModificationBusReplacement service is a bus replacement service
const ModificationCancelledArrival = 39
ModificationCancelledArrival train was scheduled to arrive, but didn't
const ModificationCancelledDeparture = 32
ModificationCancelledDeparture cancelled departure (train was scheduled to stop here)
const ModificationCancelledThroughTrain = 44
ModificationCancelledThroughTrain passing-through train has been cancelled (train would not stop at this station)
const ModificationCancelledTrain = 25
ModificationCancelledTrain Train is cancelled
const ModificationChangedArrivalPlatform = 21
ModificationChangedArrivalPlatform is for changed arrival platforms (compared to the schedule)
const ModificationChangedArrivalTime = 13
ModificationChangedArrivalTime when the arrival time has been changed
const ModificationChangedDeparturePlatform = 20
ModificationChangedDeparturePlatform is for changed departure platforms (compared to the schedule)
const ModificationChangedDepartureTime = 12
ModificationChangedDepartureTime when the departure time has been changed
const ModificationChangedDestination = 41
ModificationChangedDestination destination has been changed (not extended nor shortened, it's a new route)
const ModificationChangedOrigin = 42
ModificationChangedOrigin origin has been changed (not an extension or shortening of the normal route)
const ModificationChangedStopPattern = 30
ModificationChangedStopPattern when an extra stop is added or a stop is changed
const ModificationDelayedArrival = 11
ModificationDelayedArrival is the status for delays on arriving trains
const ModificationDelayedDeparture = 10
ModificationDelayedDeparture is the status for delays on departing trains
const ModificationDeparturePlatformAllocated = 22
ModificationDeparturePlatformAllocated when a departure platform is allocated (only DVM stations, i.e. Schiphol Airport)
const ModificationDiverted = 33
ModificationDiverted train is diverted, takes another route
const ModificationExtraArrival = 38
ModificationExtraArrival extra arrival, i.e. train doesn't normally arrive at this station
const ModificationExtraDeparture = 31
ModificationExtraDeparture extra departure for this station (train usually doesn't depart here)
const ModificationExtraThroughTrain = 43
ModificationExtraThroughTrain extra train which just passes by (doesn't stop at this station)
const ModificationExtraTrain = 24
ModificationExtraTrain for extra trains (not in the normal schedule)
const ModificationIntercityRunsAsSprinter = 81
ModificationSprinterRunsAsIntercity when an Sprinter train is running with intercity stock
const ModificationMaterialAdded = 83
ModificationMaterialAdded when material is added on a station
const ModificationMaterialAlreadyRemoved = 85
ModificationMaterialAlreadyRemoved when the material that was left behind has already been removed (driven away)
const ModificationMaterialClosed = 82
ModificationMaterialClosed when material is closed for passengers
const ModificationMaterialLeftBehind = 84
ModificationMaterialLeftBehind when material is left behind on a station
const ModificationNotActual = 50
ModificationNotActual indicator for non-realtime information, e.g. replacement buses or some foreign trains
const ModificationOriginRouteExtended = 37
ModificationOriginRouteExtended train departs from an earlier stop than the normal origin station
const ModificationOriginRouteShortened = 36
ModificationOriginRouteShortened departs from a later stop than usual
const ModificationRouteExtended = 35
ModificationRouteExtended train continues beyond normal destination
const ModificationRouteShortened = 34
ModificationRouteShortened train terminates early
const ModificationSprinterRunsAsIntercity = 80
ModificationSprinterRunsAsIntercity when an intercity train is running with Sprinter stock
const ModificationStatusChange = 40
ModificationStatusChange train status changed (i.e. from 'at platform' to 'departed')
Variables ¶
This section is empty.
Functions ¶
func GetFilteredRemarks ¶
func GetFilteredRemarks(modifications []Modification, language string) []string
GetFilteredRemarks filters out modification types for arrival/departure platforms (useful for wings)
func GetRemarks ¶
func GetRemarks(modifications []Modification, language string) []string
GetRemarks translates a slice of Modification structs to remarks in the requested language
func TranslateCause ¶
TranslateCause translates a Dutch cause (long version) to an English cause
Types ¶
type Arrival ¶
type Arrival struct { StoreItem ServiceID string ServiceDate string ServiceName string Station Station LineNumber string Status int ServiceNumber string ServiceType string ServiceTypeCode string Company string ArrivalTime time.Time Delay int ReservationRequired bool WithSupplement bool SpecialTicket bool RearPartRemains bool DoNotBoard bool Cancelled bool NotRealTime bool OriginActual []Station OriginPlanned []Station ViaActual []Station ViaPlanned []Station PlatformActual string PlatformPlanned string Modifications []Modification Hidden bool }
Arrival is an arriving train on a single station
func (Arrival) ActualOriginCodes ¶
ActualOriginCodes returns a slice of all actual origin station codes
func (Arrival) ActualOriginString ¶
ActualOriginString returns a string of all actual origins (long name)
func (*Arrival) GenerateID ¶
func (arrival *Arrival) GenerateID()
GenerateID generates an ID for this arrival
func (Arrival) PlannedOriginString ¶
PlannedOriginString returns a string of all planned origins (long name)
func (Arrival) PlatformChanged ¶
PlatformChanged returns true when the platform has been changed
func (Arrival) RealArrivalTime ¶
RealArrivalTime returns the actual arrival time, including delay
func (Arrival) ViaStationsString ¶
ViaStationsString returns a string of all actual via stations (medium name)
type BoardingTip ¶
type BoardingTip struct { ExitStation Station Destination Station TrainType string TrainTypeCode string DeparturePlatform string DepartureTime time.Time }
BoardingTip is a tip for passengers to board another train for certain destinations
func (BoardingTip) Translation ¶
func (tip BoardingTip) Translation(language string) string
Translation provides a translation for this tip
type ChangeTip ¶
ChangeTip is a tip to change trains at ChangeStation for the given destination
func (ChangeTip) Translation ¶
Translation provides a translation for this tip
type Departure ¶
type Departure struct { StoreItem ServiceID string ServiceDate string ServiceName string Station Station LineNumber string Status int ServiceNumber string ServiceType string ServiceTypeCode string Company string DepartureTime time.Time Delay int ReservationRequired bool WithSupplement bool SpecialTicket bool RearPartRemains bool DoNotBoard bool Cancelled bool NotRealTime bool DestinationActual []Station DestinationPlanned []Station ViaActual []Station ViaPlanned []Station PlatformActual string PlatformPlanned string TrainWings []TrainWing BoardingTips []BoardingTip TravelTips []TravelTip ChangeTips []ChangeTip Modifications []Modification Hidden bool }
Departure is a train service which departs from a single station
func (Departure) ActualDestinationCodes ¶
ActualDestinationCodes returns a slice of all actual destination station codes
func (Departure) ActualDestinationString ¶
ActualDestinationString returns a string of all actual destinations (long name)
func (Departure) ActualViaStationsString ¶
ActualViaStationsString returns a string of all actual via stations (medium name)
func (*Departure) GenerateID ¶
func (departure *Departure) GenerateID()
GenerateID generates an ID for this departure
func (Departure) GetRemarksTips ¶
GetRemarksTips returns all (translated) remarks and tips, both travel tips and tips based on departure flags
func (Departure) PlannedDestinationString ¶
PlannedDestinationString returns a string of all planned destinations (long name)
func (Departure) PlannedViaStationsString ¶
PlannedViaStationsString returns a string of all planned via stations (medium name)
func (Departure) PlatformChanged ¶
PlatformChanged returns true when the platform has been changed
func (Departure) RealDepartureTime ¶
RealDepartureTime returns the actual departure time, including delay
type Material ¶
type Material struct { NaterialType string `json:"type"` Number string `json:"number"` Position int `json:"position"` DestinationActual Station `json:"destination_actual"` DestinationPlanned Station `json:"destination_planned"` Accessible bool `json:"accessible"` Closed bool `json:"closed"` RemainsBehind bool `json:"remains_behind"` Added bool `json:"added"` AlreadyRemoved bool `json:"already_removed"` Modifications []Modification }
Material is the physical train unit
func (Material) NormalizedNumber ¶
NormalizedNumber returns a normal material number (i.e. it removes the 000000-0...-0 prefixes and suffixes). Example: 000000-09547-0 will be translated to 9547
type Modification ¶
type Modification struct { ModificationType int `json:"type"` CauseShort string `json:"cause_short"` CauseLong string `json:"cause_long"` Station Station `json:"station"` }
Modification is a change (to the schedule) which is communicated to travellers
type Service ¶
type Service struct { StoreItem ValidUntil time.Time ServiceNumber string ServiceDate string ServiceType string ServiceTypeCode string LineNumber string Company string ServiceParts []ServicePart ReservationRequired bool WithSupplement bool SpecialTicket bool JourneyPlanner bool Modifications []Modification Hidden bool }
Service is the train service containing all parts, stops etc.
func (*Service) GenerateID ¶
func (service *Service) GenerateID()
GenerateID generates an ID for this service
func (*Service) GetStops ¶
func (service *Service) GetStops() map[string]ServiceStop
GetStops returns all stops (from all service parts) as a map, with the station code as key
type ServicePart ¶
type ServicePart struct { ServiceNumber string Stops []ServiceStop Modifications []Modification }
ServicePart is a single part of a train service (a service usually contains just one part, but may contain more)
func (ServicePart) GetStoppingStations ¶
func (servicePart ServicePart) GetStoppingStations() (stops []ServiceStop)
GetStoppingStations filters out ServiceStops which are not called by the service.
type ServiceStop ¶
type ServiceStop struct { Station Station StationAccessible bool AssistanceAvailable bool DestinationActual string DestinationPlanned string ArrivalPlatformActual string ArrivalPlatformPlanned string DeparturePlatformActual string DeparturePlatformPlanned string StoppingActual bool StoppingPlanned bool StopType string DoNotBoard bool ArrivalTime time.Time ArrivalDelay int DepartureTime time.Time DepartureDelay int ArrivalCancelled bool DepartureCancelled bool Modifications []Modification Material []Material }
ServiceStop is a stops which is called by a train service.
func (*ServiceStop) ArrivalPlatformChanged ¶
func (stop *ServiceStop) ArrivalPlatformChanged() bool
ArrivalPlatformChanged returns true when the planned platform is not the actual one
func (*ServiceStop) DeparturePlatformChanged ¶
func (stop *ServiceStop) DeparturePlatformChanged() bool
DeparturePlatformChanged returns true when the planned platform is not the actual one
func (*ServiceStop) IsStopping ¶
func (stop *ServiceStop) IsStopping() bool
IsStopping checks whether the service is stopping at this stop or whether is was planned to do so
type Station ¶
type Station struct { Code string `json:"code"` NameShort string `json:"short"` NameMedium string `json:"medium"` NameLong string `json:"long"` }
Station is a station in the railway network. It has a code and 3 names (short, medium, long)
type StoreItem ¶
type StoreItem struct { ID string `json:"-"` Timestamp time.Time `json:"-"` ProductID string `json:"-"` }
StoreItem is for shared fields like ID, timestamp etc.
type TrainWing ¶
type TrainWing struct { DestinationActual []Station DestinationPlanned []Station Stations []Station StationsPlanned []Station Material []Material Modifications []Modification }
TrainWing is a part of a train departure with a single destination
func (TrainWing) DestinationActualString ¶ added in v1.0.5
DestinationActualString returns a string of all actual destination stations (medium name)
func (TrainWing) DestinationPlannedString ¶ added in v1.0.5
DestinationPlannedString returns a string of all planned destination stations (medium name)