Add support for 'Update' transaction type
This commit is contained in:
parent
5cbc6aef9b
commit
0aa77f2a21
@ -10,12 +10,16 @@ import (
|
|||||||
// Decide, based on the DB Formatted message type, what action needs taking
|
// Decide, based on the DB Formatted message type, what action needs taking
|
||||||
// then either insert, or delete from the database as required
|
// then either insert, or delete from the database as required
|
||||||
func processEntryType(entry database.Service) {
|
func processEntryType(entry database.Service) {
|
||||||
if entry.TransactionType == "Create" {
|
|
||||||
|
switch entry.TransactionType {
|
||||||
|
case "Create":
|
||||||
createEntry(entry)
|
createEntry(entry)
|
||||||
} else if entry.TransactionType == "Delete" {
|
case "Update":
|
||||||
|
updateEntry(entry)
|
||||||
|
case "Delete":
|
||||||
deleteEntry(entry)
|
deleteEntry(entry)
|
||||||
} else {
|
default:
|
||||||
log.Msg.Error("Unknown TransactionType: " + entry.TransactionType)
|
log.Msg.Error("Unknown transaction type: " + entry.TransactionType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +27,10 @@ func createEntry(entry database.Service) {
|
|||||||
log.Msg.Info("Entry Creation requested for: " + entry.TrainUid + " - " + entry.Headcode + " - " + entry.Operator)
|
log.Msg.Info("Entry Creation requested for: " + entry.TrainUid + " - " + entry.Headcode + " - " + entry.Operator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateEntry(entry database.Service) {
|
||||||
|
log.Msg.Info("Entry UPDATE requested for: " + entry.TrainUid + " - " + entry.Headcode + " - " + entry.Operator)
|
||||||
|
}
|
||||||
|
|
||||||
func deleteEntry(entry database.Service) {
|
func deleteEntry(entry database.Service) {
|
||||||
log.Msg.Info("Entry DELETE requested for: " + entry.TrainUid + " - " + entry.Headcode)
|
log.Msg.Info("Entry DELETE requested for: " + entry.TrainUid + " - " + entry.Headcode)
|
||||||
fmt.Printf("%+v\n", entry)
|
fmt.Printf("%+v\n", entry)
|
||||||
|
Loading…
Reference in New Issue
Block a user