Documentation
¶
Index ¶
- Constants
- func DBMigrate(db *gorm.DB, log *log.Logger) error
- func GetScheduleEventsByStationRealTime(stationId int, db *gorm.DB) (scheduleEvents []ScheduleEvent, realTimeDetails []RealTimeEventDetail, ...)
- func ImportLiveEvents(db *gorm.DB, events []gomarta.Train)
- type Alias
- type Aliases
- type Direction
- type Directions
- type Feedback
- type FeedbackSource
- type FeedbackType
- type Line
- type Lines
- type RealTimeEventDetail
- type ScheduleEvent
- type ScheduleEventSource
- type StaticEventDetail
- type Station
- type StationDetail
- type Stations
- type Train
Constants ¶
View Source
const FETCH_SCHEDULE_EVENTS_BY_STATION_REALTIME string = `` /* 280-byte string literal not displayed */
View Source
const FETCH_SCHEDULE_EVENTS_BY_STATION_STATIC string = ""
Variables ¶
This section is empty.
Functions ¶
func GetScheduleEventsByStationRealTime ¶
func GetScheduleEventsByStationRealTime(stationId int, db *gorm.DB) (scheduleEvents []ScheduleEvent, realTimeDetails []RealTimeEventDetail, err error)
Types ¶
type Direction ¶
type Direction struct {
ID uint `json:"-" gorm:"primary_key"`
Feedback []Feedback `json:",omitempty"`
Lines []Line `json:",omitempty" gorm:"many2many:line_directions"`
Name string `gorm:"not null"`
Aliases []Alias `json:",omitempty" gorm:"polymorphic:NamedElement;"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"`
}
type Directions ¶
type Directions []Direction
func (Directions) Len ¶
func (d Directions) Len() int
func (Directions) String ¶
func (d Directions) String(i int) string
type FeedbackType ¶
type Line ¶
type Line struct {
ID uint `json:"-" gorm:"primary_key"`
Feedback []Feedback `json:",omitempty"`
Directions []Direction `json:",omitempty" gorm:"many2many:line_directions"`
Stations []Station `json:",omitempty" gorm:"many2man:station_lines"`
Name string `gorm:"not null"`
Aliases []Alias `json:",omitempty" gorm:"polymorphic:NamedElement;"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"`
}
type RealTimeEventDetail ¶
type RealTimeEventDetail struct {
ID uint `json:"-" gorm:"primary_key"`
ScheduleEventID uint `json:"-"`
ScheduleEvent ScheduleEvent `json:"-"`
EventTime time.Time
TrainID uint `json:"-"`
Train Train
WaitingSeconds int `gorm:"not null"`
WaitingTime string `gorm:"not null"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"`
}
type ScheduleEvent ¶
type ScheduleEvent struct {
ID uint `json:"-" gorm:"primary_key"`
EventTypeID uint `json:"-"`
EventType ScheduleEventSource
DestinationID uint `json:"-"`
Destination Station
NextArrival time.Time
NextStationID uint `json:"-"`
NextStation Station
DirectionID uint `json:"-"`
Direction Direction
ExpiresAt time.Time
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"`
}
func (ScheduleEvent) LoadFromGoMartaEvent ¶
func (se ScheduleEvent) LoadFromGoMartaEvent(gmTrain gomarta.Train, db *gorm.DB)
type ScheduleEventSource ¶
type StaticEventDetail ¶
type Station ¶
type Station struct {
ID uint `gorm:"primary_key"`
Feedback []Feedback `json:",omitempty"`
Detail StationDetail `json:",omitempty"`
Aliases []Alias `gorm:"polymorphic:NamedElement;"`
Lines []Line `gorm:"many2many:station_lines;not null;"`
Name string `gorm:"unique;not null"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"`
}
type StationDetail ¶
type StationDetail struct {
ID uint `json:"-" gorm:"primary_key"`
StationID uint `json:"-" gorm:"not null"`
Description string `gorm:"not null"`
Location string `gorm:"unique;not null"`
Distance float64 `json:",omitempty" gorm:"-"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"`
}
Click to show internal directories.
Click to hide internal directories.