2023-07-19 21:31:00 +01:00
|
|
|
package vstp
|
|
|
|
|
2023-07-21 12:12:16 +01:00
|
|
|
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
|
2023-07-21 12:12:16 +01:00
|
|
|
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) {
|
2023-07-21 14:40:24 +01:00
|
|
|
log.Msg.Info("Entry Creation requested for: " + entry.TrainUid + " - " + entry.Headcode + " - " + entry.Operator)
|
2023-07-21 12:12:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func deleteEntry(entry database.Service) {
|
|
|
|
log.Msg.Info("Entry DELETE requested for: " + entry.TrainUid + " - " + entry.Headcode)
|
|
|
|
}
|