Skip to content

Commit 7e368f9

Browse files
committed
Update examples
1 parent 935a5a3 commit 7e368f9

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

examples/e2e/main.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ func main() {
7979

8080
for _, slice := range offer.Slices {
8181
for _, segment := range slice.Segments {
82+
dep, _ := segment.DepartingAt()
83+
arr, _ := segment.ArrivingAt()
8284
t.AppendRow(table.Row{
8385
slice.ID,
8486
segment.Origin.IATACode,
8587
segment.Destination.IATACode,
86-
time.Time(segment.DepartingAt).Format(time.RFC822),
87-
time.Time(segment.ArrivingAt).Format(time.RFC822),
88+
89+
dep.Format(time.RFC822),
90+
arr.Format(time.RFC822),
8891
segment.Passengers[0].CabinClass.String(),
8992
renderChangeableStatus(slice),
9093
})
@@ -209,25 +212,30 @@ func main() {
209212

210213
for _, slice := range offer.Slices.Add {
211214
for _, segment := range slice.Segments {
215+
dep, _ := segment.DepartingAt()
216+
arr, _ := segment.ArrivingAt()
217+
212218
t.AppendRow(table.Row{
213219
fmt.Sprintf("Add %s", slice.ID),
214220
segment.Origin.IATACode,
215221
segment.Destination.IATACode,
216-
time.Time(segment.DepartingAt).Format(time.RFC822),
217-
time.Time(segment.ArrivingAt).Format(time.RFC822),
222+
dep.Format(time.RFC822),
223+
arr.Format(time.RFC822),
218224
// segment.Passengers != nil && segment.Passengers[0].CabinClass.String(),
219225
renderChangeableStatus(slice),
220226
})
221227
}
222228
}
223229
for _, slice := range offer.Slices.Remove {
224230
for _, segment := range slice.Segments {
231+
dep, _ := segment.DepartingAt()
232+
arr, _ := segment.ArrivingAt()
225233
t.AppendRow(table.Row{
226234
fmt.Sprintf("Remove %s", slice.ID),
227235
segment.Origin.IATACode,
228236
segment.Destination.IATACode,
229-
time.Time(segment.DepartingAt).Format(time.RFC822),
230-
time.Time(segment.ArrivingAt).Format(time.RFC822),
237+
dep.Format(time.RFC822),
238+
arr.Format(time.RFC822),
231239
segment.Passengers[0].CabinClass.String(),
232240
renderChangeableStatus(slice),
233241
})

examples/offer-requests/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ func main() {
8585
fmt.Printf(" 🛫 %s to %s\n", *s.Origin.CityName, *s.Destination.CityName)
8686

8787
for _, f := range s.Segments {
88-
fmt.Printf(" Departing at %s • Arriving at %s\n", f.DepartingAt, f.ArrivingAt)
88+
dep, _ := f.DepartingAt()
89+
arr, _ := f.ArrivingAt()
90+
91+
fmt.Printf(" Departing at %s • Arriving at %s\n", dep, arr)
8992
}
9093

9194
fmt.Printf(" 🛬 %s • %s\n", s.FareBrandName, time.Duration(s.Duration).String())

0 commit comments

Comments
 (0)