darwintimetable

package
v0.0.0-...-fd78167 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Reference timetable

Reference timetable

Reference timetable

Reference timetable

Reference timetable

Reference timetable

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssocService

type AssocService struct {
	RID string `json:"rid" xml:"rid,attr"`
	Wta string `json:"wta,omitempty" xml:"wta,attr"`
	Wtd string `json:"wtd,omitempty" xml:"wtd,attr"`
	Wtp string `json:"wtp,omitempty" xml:"wtp,attr"`
	Pta string `json:"pta,omitempty" xml:"pta,attr"`
	Ptd string `json:"ptd,omitempty" xml:"ptd,attr"`
}

func (*AssocService) Equals

func (a *AssocService) Equals(b *AssocService) bool

type Association

type Association struct {
	XMLName   xml.Name     `json:"-" xml:"Association"`
	Main      AssocService `json:"main" xml:"main"`
	Assoc     AssocService `json:"assoc" xml:"assoc"`
	Tiploc    string       `json:"tiploc" xml:"tiploc,attr"`
	Category  string       `json:"category" xml:"category,attr"`
	Cancelled bool         `json:"cancelled" xml:"isCancelled,attr"`
	Deleted   bool         `json:"deleted" xml:"isDeleted,attr"`
	// Date entry was inserted into the database
	Date time.Time `json:"date" xml:"date,attr"`
}

func (*Association) Equals

func (a *Association) Equals(b *Association) bool

type DT

type DT struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// CallPtAttributes
	Pta string `xml:"pta,attr"`
	Ptd string `xml:"ptd,attr"`
	// Working times
	Wta string `xml:"wta,attr"`
	Wtd string `xml:"wtd,attr"`
	// Delay implied by a change to the services route
	RDelay string `xml:"rdelay,attr"`
}

func (*DT) Location

func (s *DT) Location() *Location

type DarwinTimetable

type DarwinTimetable struct {
	// contains filtered or unexported fields
}

func (*DarwinTimetable) Close

func (r *DarwinTimetable) Close()

Close the database. If Init() was used to open the db then that db is closed. If UseDB() was used this simply detaches the DarwinReference from that DB. The DB is not closed()

func (*DarwinTimetable) GetJourney

func (r *DarwinTimetable) GetJourney(tx *bolt.Tx, rid string) (*Journey, bool)

GetJourney returns details of a Journey

func (*DarwinTimetable) GetJourneyBucket

func (r *DarwinTimetable) GetJourneyBucket(bucket *bolt.Bucket, rid string) (*Journey, bool)

func (*DarwinTimetable) OpenDB

func (r *DarwinTimetable) OpenDB(dbFile string) error

Init opens a DarwinReference database.

func (*DarwinTimetable) PruneSchedules

func (t *DarwinTimetable) PruneSchedules() (int, error)

PruneSchedules prunes all expired schedules NB: Corrupt schedules are also removed

func (*DarwinTimetable) TimetableId

func (r *DarwinTimetable) TimetableId() string

Return's the timetableId for this reference dataset

func (*DarwinTimetable) UnmarshalXML

func (t *DarwinTimetable) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

func (*DarwinTimetable) Update

func (r *DarwinTimetable) Update(f func(*bolt.Tx) error) error

SnapshotUpdate performs a read write opertation on the database

func (*DarwinTimetable) UseDB

func (r *DarwinTimetable) UseDB(db *bolt.DB) error

UseDB Allows an already open database to be used with DarwinReference.

func (*DarwinTimetable) View

func (r *DarwinTimetable) View(f func(*bolt.Tx) error) error

View performs a readonly operation on the database

type IP

type IP struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// CallPtAttributes
	Pta string `xml:"pta,attr"`
	Ptd string `xml:"ptd,attr"`
	// Working times
	Wta string `xml:"wta,attr"`
	Wtd string `xml:"wtd,attr"`
	// Delay implied by a change to the services route
	RDelay string `xml:"rdelay,attr"`
	// False destination to be used at this location
	FalseDest string `xml:"fd,attr"`
}

func (*IP) Location

func (s *IP) Location() *Location

type Journey

type Journey struct {
	XMLName xml.Name `json:"-" xml:"Journey"`
	// RTTI unique Train ID
	RID string `json:"rid" xml:"rid,attr"`
	// Train UID
	UID string `json:"uid" xml:"uid,attr"`
	// Train ID (Headcode)
	TrainID string `json:"trainId" xml:"trainId"`
	// Scheduled Start Date
	SSD util.SSD `json:"ssd" xml:"ssd,attr"`
	// ATOC Code
	Toc string `json:"toc" xml:"toc,attr"`
	// Type of service, i.e. Train/Bus/Ship.
	Status string `json:"status,omitempty" xml:"status,attr,omitempty"`
	// Category of service.
	TrainCat string `json:"trainCat" xml:"trainCat,attr"`
	// True if Darwin classifies the train category as a passenger service.
	Passenger bool `json:"isPassengerSvc" xml:"isPassengerSvc,attr"`
	// Service has been deleted and should not be used/displayed.
	Deleted bool `json:"deleted,omitempty" xml:"deleted,attr,omitempty"`
	// Indicates if this service is a charter service.
	Charter bool `json:"isCharter,omitempty" xml:"isCharter,attr,omitempty"`
	// True if this is a Q Train (runs as required) that has not yet been activated.
	// Note that a Q Train that has been activated before the XML Timetable file
	// has been built will not have this attribute set true.
	QTrain bool `json:"qtrain,omitempty" xml:"qtrain,attr,omitempty"`
	// The schedule
	Schedule     []*Location `json:"locations" xml:location`
	CancelReason int         `json:"cancelReason" xml:"cancelReason,attr"`
	// Associations
	Associations []*Association `json:"association" xml:"-"`
	// Date entry was inserted into the database
	Date time.Time `json:"date" xml:"date,attr"`
}

func (*Journey) Equals

func (a *Journey) Equals(b *Journey) bool

func (*Journey) UnmarshalXML

func (j *Journey) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

type Location

type Location struct {
	XMLName xml.Name `json:"-" xml:"location"`
	// The type of this location:
	//   OR Origin location
	// OPOR Operational origin location
	//   IP Intermediate calling location
	// OPIP Intermediate operational calling location
	//   PP Passing location
	//   DT Destination location
	// OPDT Operational destination location
	Type string `json:"type" xml:"type,attr"`
	// Location Tiploc
	Tiploc string `json:"tpl" xml:"tpl,attr"`
	// Activity at this location
	Act string `json:"act,omitempty" xml:"act,attr,omitempty"`
	// Planned Activity Codes (if different to current activities)
	PlanAct string `json:"planAct,omitempty" xml:"planAct,attr,omitempty"`
	// Cancelled at this location
	Cancelled bool `json:"cancelled,omitempty" xml:"can,attr,omitempty"`
	// Platform at this location
	Platform string `json:"plat,omitempty" xml:"plat,attr,omitempty"`
	// Public Scheduled Time of Arrival
	Pta *util.PublicTime `json:"pta,omitempty" xml:"pta,attr,omitempty"`
	// Public Scheduled Time of Departure
	Ptd *util.PublicTime `json:"ptd,omitempty" xml:"ptd,attr,omitempty"`
	// Working Scheduled Time of Arrival
	Wta *util.WorkingTime `json:"wta,omitempty" xml:"wta,attr,omitempty"`
	// Working Scheduled Time of Departure
	Wtd *util.WorkingTime `json:"wtd,omitempty" xml:"wtd,attr,omitempty"`
	// Working Scheduled Time of Passing
	Wtp *util.WorkingTime `json:"wtp,omitempty" xml:"wtp,attr,omitempty"`
	// A delay value that is implied by a change to the service's route.
	RDelay string `json:"rdelay,omitempty" xml:"rdelay,attr,omitempty"`
	// TIPLOC of False Destination to be used at this location
	FalseDest string `json:"fd,omitempty" xml:"fd,attr,omitempty"`
}

Common location object used in persistence

type OPDT

type OPDT struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// Working times
	Wta string `xml:"wta,attr"`
	Wtd string `xml:"wtd,attr"`
	// Delay implied by a change to the services route
	RDelay string `xml:"rdelay,attr"`
}

func (*OPDT) Location

func (s *OPDT) Location() *Location

type OPIP

type OPIP struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// Working times
	Wta string `xml:"wta,attr"`
	Wtd string `xml:"wtd,attr"`
	// Delay implied by a change to the services route
	RDelay string `xml:"rdelay,attr"`
}

func (*OPIP) Location

func (s *OPIP) Location() *Location

type OPOR

type OPOR struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// Working times
	Wta string `xml:"wta,attr"`
	Wtd string `xml:"wtd,attr"`
}

func (*OPOR) Location

func (s *OPOR) Location() *Location

type OR

type OR struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// CallPtAttributes
	Pta string `xml:"pta,attr"`
	Ptd string `xml:"ptd,attr"`
	// Working times
	Wta string `xml:"wta,attr"`
	Wtd string `xml:"wtd,attr"`
	// False destination to be used at this location
	FalseDest string `xml:"fd,attr"`
}

func (*OR) Location

func (s *OR) Location() *Location

type PP

type PP struct {
	// SchedLocAttributes
	Tiploc    string `xml:"tpl,attr"`
	Act       string `xml:"act,attr"`
	PlanAct   string `xml:"planAct,attr"`
	Cancelled bool   `xml:"can,attr"`
	Platform  string `xml:"plat,attr"`
	// Working times
	Wtp string `xml:"wtp,attr"`
	// Delay implied by a change to the services route
	RDelay string `xml:"rdelay,attr"`
}

func (*PP) Location

func (s *PP) Location() *Location

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL