timetable-mgr/src/vstp/actions.go

27 lines
805 B
Go
Raw Normal View History

2023-07-19 21:31:00 +01:00
package vstp
import (
"git.fjla.uk/owlboard/go-types/pkg/database"
"git.fjla.uk/owlboard/mq-client/log"
)
2023-07-19 21:31:00 +01:00
// Decide, based on the DB Formatted message type, what action needs taking
// then either insert, or delete from the database as required
func processEntryType(entry database.Service) {
if entry.TransactionType == "Create" {
createEntry(entry)
} else if entry.TransactionType == "Delete" {
deleteEntry(entry)
} else {
log.Msg.Error("Unknown TransactionType: " + entry.TransactionType)
}
}
func createEntry(entry database.Service) {
log.Msg.Info("Entry Creation requested for: " + entry.TrainUid + " - " + entry.Headcode + " - " + entry.Operator)
}
func deleteEntry(entry database.Service) {
log.Msg.Info("Entry DELETE requested for: " + entry.TrainUid + " - " + entry.Headcode)
}