trainalarm

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

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) GetID

func (t *TrainAlarm) GetID() string

GetID from domain

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) GetPlattform

func (t *TrainAlarm) GetPlattform() string

GetPlattform from user

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

Jump to

Keyboard shortcuts

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