Documentation ¶
Index ¶
- type Repository
- type TrainAlarm
- func (t *TrainAlarm) Compare(other *TrainAlarm) bool
- func (t *TrainAlarm) GetDelayThresholdMinutes() int
- func (t *TrainAlarm) GetFinalArrivalAt() time.Time
- func (t *TrainAlarm) GetID() string
- func (t *TrainAlarm) GetIdentifyer() string
- func (t *TrainAlarm) GetLastDelay() int
- func (t *TrainAlarm) GetLastNotificationAt() *time.Time
- func (t *TrainAlarm) GetPlattform() string
- func (t *TrainAlarm) GetStationDate() int64
- func (t *TrainAlarm) GetStationEVA() int
- func (t *TrainAlarm) GetTrainName() string
- func (t *TrainAlarm) SetDelayThresholdMinutes(minutes int)
- func (t *TrainAlarm) SetLastDelay(delayMinutes int)
- func (t *TrainAlarm) SetSuccessfulNotification()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { GetOrCreateTrainAlarm(ctx context.Context, alarm *TrainAlarm) (*TrainAlarm, error) GetTrainAlarm(ctx context.Context, alarmID string) (*TrainAlarm, error) GetTrainAlarms(ctx context.Context, identifyer string, plattform string) ([]*TrainAlarm, error) GetTrainAlarmsSortByLastNotificationAt(ctx context.Context, limit int) ([]*TrainAlarm, error) DeleteTrainAlarm(ctx context.Context, alarmID string) error DeleteOldTrainAlarms(ctx context.Context, threshold time.Time) error UpdateTrainAlarm(ctx context.Context, alarmID string, updateFn func(alarm *TrainAlarm) (*TrainAlarm, error)) error }
Repository interface to datahandling between repository and application
type TrainAlarm ¶
type TrainAlarm struct {
// contains filtered or unexported fields
}
TrainAlarm represent a alarm from a user
func NewTrainAlarm ¶
func NewTrainAlarm( identifyer string, plattform string, trainName string, stationEVA int, stationDate int64, finalArrivalAt time.Time, ) (*TrainAlarm, error)
NewTrainAlarm returns a new train alarm
func NewTrainAlarmFromRepository ¶
func NewTrainAlarmFromRepository( id string, identifyer string, plattform string, trainName string, stationEVA int, stationDate int64, finalArrivalAt time.Time, delayThresholdMinutes int, lastNotificationAt *time.Time, lastDelayMinutes int, ) (*TrainAlarm, error)
NewTrainAlarmFromRepository returns a new train alarm
func (*TrainAlarm) Compare ¶
func (t *TrainAlarm) Compare(other *TrainAlarm) bool
Compare two train alarms without id
func (*TrainAlarm) GetDelayThresholdMinutes ¶
func (t *TrainAlarm) GetDelayThresholdMinutes() int
GetDelayThresholdMinutes before alarm
func (*TrainAlarm) GetFinalArrivalAt ¶
func (t *TrainAlarm) GetFinalArrivalAt() time.Time
GetFinalArrivalAt from train
func (*TrainAlarm) GetIdentifyer ¶
func (t *TrainAlarm) GetIdentifyer() string
GetIdentifyer from user
func (*TrainAlarm) GetLastDelay ¶
func (t *TrainAlarm) GetLastDelay() int
GetLastDelay returns last crawled delay in minutes
func (*TrainAlarm) GetLastNotificationAt ¶
func (t *TrainAlarm) GetLastNotificationAt() *time.Time
GetLastNotificationAt returns nil if no notification is send yet
func (*TrainAlarm) GetStationDate ¶
func (t *TrainAlarm) GetStationDate() int64
GetStationDate from train
func (*TrainAlarm) GetStationEVA ¶
func (t *TrainAlarm) GetStationEVA() int
GetStationEVA from train
func (*TrainAlarm) GetTrainName ¶
func (t *TrainAlarm) GetTrainName() string
GetTrainName from train
func (*TrainAlarm) SetDelayThresholdMinutes ¶
func (t *TrainAlarm) SetDelayThresholdMinutes(minutes int)
SetDelayThresholdMinutes for train
func (*TrainAlarm) SetLastDelay ¶
func (t *TrainAlarm) SetLastDelay(delayMinutes int)
SetLastDelay in minutes
func (*TrainAlarm) SetSuccessfulNotification ¶
func (t *TrainAlarm) SetSuccessfulNotification()
SetSuccessfulNotification add the current timestamp