From afd464369608a9fcd7ecc3f0e31ef52819c4b2dc Mon Sep 17 00:00:00 2001 From: windyboy Date: Sat, 20 Jul 2024 00:46:31 +0800 Subject: [PATCH] feat: Add FPL message parsing functionality This commit adds functionality to parse FPL messages in the `aftn_parser.go` file. The `Parse` method now correctly parses the FPL message type and extracts the relevant data fields. The `FPL` struct is introduced in the `domain` package to represent FPL messages. The parsing logic is implemented to populate the `FPL` struct with the parsed data. This change enables the application to handle FPL messages and process them accordingly. --- internal/config/config.go | 10 ++++++++++ internal/parsers/aftn_parser.go | 16 ++++++++++++++++ internal/parsers/aftn_parser_test.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index e78f8e9..80e04f1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -49,6 +49,7 @@ type PatternConfig struct { const ( arrPatternString = `^\((?P[A-Z]{3})-(?P[A-Z0-9]+)-(?P[A-Z0-9]+)-(?P[A-Z]{4})-(?P[A-Z]{4})\)$` depPatternString = `^\((?P[A-Z]{3})-(?P[A-Z0-9]+)-(?P[A-Z0-9]+)-(?P[A-Z]{4})-(?P\d{4})-(?P[A-Z]{4})\)$` + fplPatternString = `^\((?P[A-Z]{3})\-(?P[A-Z]+\d+)\-(?P[A-Z]{2})(?:.*\s*)?\-(?P[A-Z]+\d+\/?[A-Z]?)\s*\-(?P.*)\s*\-(?P[A-Z]{4})(?P\d{4})\s*\-(?P[A-Z]+\d+)(?P[A-Z0-9]+)\s(?P.*)\s*\-(?P[A-Z]{4})(?P\d{4})\s(?P[A-Z]{4})\s*\-(?PPBN\/[A-Z0-9]+)\s(?P