application

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 Train

type Train struct {
}

Train by hafas

type UpdateTrainAlarmThresholdCmd

type UpdateTrainAlarmThresholdCmd struct {
	AlarmID          string
	ThresholdMinutes int
}

UpdateTrainAlarmThresholdCmd for UpdateTrainAlarmThreshold

Jump to

Keyboard shortcuts

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