From 135ef12c4da1e286b628651f19ed26f5ae039cf2 Mon Sep 17 00:00:00 2001 From: windyboy Date: Sat, 20 Jul 2024 22:25:28 +0800 Subject: [PATCH] ```text 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. --- internal/parsers/aviation_parser.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/parsers/aviation_parser.go b/internal/parsers/aviation_parser.go index da52e8c..34e705d 100644 --- a/internal/parsers/aviation_parser.go +++ b/internal/parsers/aviation_parser.go @@ -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 }