refactor: Add support for parsing JD Airlines flight schedule data

This commit is contained in:
windyboy
2024-07-31 17:27:14 +08:00
parent 2729e33f59
commit 4bd2adda51
2 changed files with 20 additions and 7 deletions
+5
View File
@@ -15,6 +15,7 @@ type LineParser struct {
}
const (
CANCELLED = "CNL"
AirportCode = "airport"
Date = "date"
Task = "task"
@@ -173,6 +174,10 @@ func ParseWithDef(line string, parserDef *LineParser) *domain.ScheduleLine {
var flightSchedule = &domain.ScheduleLine{
Reference: line,
}
if strings.Contains(line, CANCELLED) {
flightSchedule.Comments = "Cancelled"
return flightSchedule
}
// var result map[string]string
if parserDef == nil {
log.Warnf("No definition found: %s", line)