aboutsummaryrefslogtreecommitdiff
path: root/pkg/adapters
diff options
context:
space:
mode:
authorleshe4ka46 <alex9102naid1@ya.ru>2025-10-28 13:42:55 +0300
committerleshe4ka46 <alex9102naid1@ya.ru>2025-10-28 13:43:08 +0300
commitded279a489631651943b5b65cdb3acb6764cf288 (patch)
tree9ea2c846f5efdab6521b4e7236dcbea34c9b544b /pkg/adapters
parentbb833561aa74f02970aee13cdc75973b29716491 (diff)
unmarshal all formats, merge them in the single table, users are truly unique
Diffstat (limited to 'pkg/adapters')
-rw-r--r--pkg/adapters/xlsx/model.go12
-rw-r--r--pkg/adapters/yaml/yaml.go5
2 files changed, 7 insertions, 10 deletions
diff --git a/pkg/adapters/xlsx/model.go b/pkg/adapters/xlsx/model.go
index 79434f0..ff92def 100644
--- a/pkg/adapters/xlsx/model.go
+++ b/pkg/adapters/xlsx/model.go
@@ -23,11 +23,11 @@ type Ticket struct {
ToCountry string
ToAirport string
ToCoords model.LatLong
- FlightDate string // (raw, expected YYYY-MM-DD; Excel text may start with ')
- FlightTime string // (raw, expected HH-MM or HH:MM; Excel text may start with ')
+ FlightDate string // expected YYYY-MM-DD
+ FlightTime string // expected HH-MM or HH:MM
PNR string
Card string
- TicketNumber string // (may have a leading ' in Excel)
+ TicketNumber string
}
func (t Ticket) DateTime() (time.Time, *time.Location, error) {
@@ -62,13 +62,13 @@ func iataToLocation(code string) *time.Location {
if err != nil {
return nil
}
- // Prefer IANA tz name
+ // prefer IATA tz name
if tz := strings.TrimSpace(ap.Tz); tz != "" && tz != `\N` {
if loc, err := time.LoadLocation(tz); err == nil {
return loc
}
}
- // Fallback: fixed offset (no DST)
+ // fallback to fixed offset (no DST)
if ap.Timezone != 0 {
sec := int(ap.Timezone * 3600.0)
return time.FixedZone("UTC"+offsetLabel(sec), sec)
@@ -91,4 +91,4 @@ func two(x int) string {
return "0" + strconv.Itoa(x)
}
return strconv.Itoa(x)
-} \ No newline at end of file
+}
diff --git a/pkg/adapters/yaml/yaml.go b/pkg/adapters/yaml/yaml.go
index 9a79a72..9304c8f 100644
--- a/pkg/adapters/yaml/yaml.go
+++ b/pkg/adapters/yaml/yaml.go
@@ -16,8 +16,6 @@ import (
"gopkg.in/yaml.v3"
)
-// ---------- Data model ----------
-
type FareInfo struct {
Class string `yaml:"CLASS" json:"class"`
Fare string `yaml:"FARE" json:"fare"`
@@ -34,13 +32,12 @@ type Schedule struct {
data map[string]map[string]Flight
}
-// ParseSchedule reads YAML from r into a Schedule.
func ParseSchedule(r io.Reader) (*Schedule, error) {
s := &Schedule{
data: make(map[string]map[string]Flight),
}
dec := yaml.NewDecoder(r)
- // dec.KnownFields(true) // enable if you want strict field checking
+ // dec.KnownFields(true) // strict field checking
if err := dec.Decode(&s.data); err != nil {
return nil, err
}