Documentation ¶
Index ¶
- type AddTrainAlarmCmd
- type Application
- func (a *Application) AddTrainAlarm(ctx context.Context, cmd AddTrainAlarmCmd) error
- func (a *Application) DeleteOldStates(ctx context.Context) error
- func (a *Application) DeleteOldTrainAlarms(ctx context.Context) error
- func (a *Application) DeleteTrainAlarm(ctx context.Context, cmd DeleteTrainAlarmCmd) (*trainalarm.TrainAlarm, error)
- func (a *Application) NotifyUsers(ctx context.Context, ...) error
- func (a *Application) UpdateTrainAlarmThreshold(ctx context.Context, cmd UpdateTrainAlarmThresholdCmd) error
- type DeleteTrainAlarmCmd
- type HafasService
- type Train
- type UpdateTrainAlarmThresholdCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddTrainAlarmCmd ¶
type AddTrainAlarmCmd struct { Identifyer string Plattform string TrainName string StationEVA int StationDate int64 }
AddTrainAlarmCmd for AddTrainAlarm
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents all usecases
func NewApplication ¶
func NewApplication(hafas HafasService, repo trainalarm.Repository, log *logrus.Entry) *Application
NewApplication returns a application service object
func (*Application) AddTrainAlarm ¶
func (a *Application) AddTrainAlarm(ctx context.Context, cmd AddTrainAlarmCmd) error
AddTrainAlarm to database
func (*Application) DeleteOldStates ¶ added in v0.2.3
func (a *Application) DeleteOldStates(ctx context.Context) error
DeleteOldStates to clear the database
func (*Application) DeleteOldTrainAlarms ¶
func (a *Application) DeleteOldTrainAlarms(ctx context.Context) error
DeleteOldTrainAlarms to clear the database
func (*Application) DeleteTrainAlarm ¶
func (a *Application) DeleteTrainAlarm(ctx context.Context, cmd DeleteTrainAlarmCmd) (*trainalarm.TrainAlarm, error)
DeleteTrainAlarm at database
func (*Application) NotifyUsers ¶
func (a *Application) NotifyUsers(ctx context.Context, notifyFn func(ctx context.Context, alarm *trainalarm.TrainAlarm, train marudor.HafasTrain, diff time.Duration) error) error
NotifyUsers check train delay threshold and call the notifyFn
func (*Application) UpdateTrainAlarmThreshold ¶
func (a *Application) UpdateTrainAlarmThreshold(ctx context.Context, cmd UpdateTrainAlarmThresholdCmd) error
UpdateTrainAlarmThreshold at database
type DeleteTrainAlarmCmd ¶
type DeleteTrainAlarmCmd struct {
AlarmID string
}
DeleteTrainAlarmCmd for DeleteTrainAlarm
type HafasService ¶
type HafasService interface {
GetTrainByStation(ctx context.Context, trainName string, stationEVA int, stationDate int64) (*marudor.HafasTrain, error)
}
HafasService to request train informations
type UpdateTrainAlarmThresholdCmd ¶
UpdateTrainAlarmThresholdCmd for UpdateTrainAlarmThreshold
Click to show internal directories.
Click to hide internal directories.