feat: Add timestamp fields to ParsedMessage struct

The code changes in `aviation_parser.go` add the `ParsedAt` and `ReceivedAt` fields to the `ParsedMessage` struct. These fields store the timestamps when the message was parsed and received, respectively. This enhancement provides valuable information for tracking and analyzing message processing times.
This commit is contained in:
windyboy
2024-07-20 22:25:28 +08:00
parent 2b83d9b785
commit 135ef12c4d
+3
View File
@@ -7,6 +7,7 @@ import (
"errors" // Import errors package to handle errors
"fmt"
"strings"
"time"
)
const (
@@ -115,6 +116,7 @@ func Parse(rawText string) (*domain.ParsedMessage, error) {
if err != nil {
return nil, err
}
message.ParsedAt = time.Now()
message.BodyData = bodyData
return &message, nil
}
@@ -150,6 +152,7 @@ func ParseHeader(fullMessage string) (domain.ParsedMessage, error) {
Originator: originator,
OriginatorDateTime: originatorDateTime,
BodyAndFooter: bodyAndFooter,
ReceivedAt: time.Now(),
}, nil
}