Show information about airports in decoded reports
This commit is contained in:
parent
35c5c70b25
commit
d5d2f35b15
320696
airports/airports.go
Normal file
320696
airports/airports.go
Normal file
File diff suppressed because it is too large
Load Diff
6
taf.go
6
taf.go
@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/participle/v2"
|
||||
"go.elara.ws/taf/airports"
|
||||
"go.elara.ws/taf/internal/parser"
|
||||
"go.elara.ws/taf/units"
|
||||
)
|
||||
@ -77,7 +78,10 @@ func ParseWithOptions(r io.Reader, opts Options) (*Forecast, error) {
|
||||
for _, item := range ast.Items {
|
||||
switch {
|
||||
case item.ID != nil:
|
||||
setField(out, "Identifier", *item.ID)
|
||||
fc.Identifier = *item.ID
|
||||
if a, ok := airports.Airports[fc.Identifier]; ok {
|
||||
fc.Airport = a
|
||||
}
|
||||
case item.Time != nil:
|
||||
t, err := parseTime(*item.Time)
|
||||
if err != nil {
|
||||
|
4
types.go
4
types.go
@ -3,13 +3,13 @@ package taf
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.elara.ws/taf/airports"
|
||||
"go.elara.ws/taf/units"
|
||||
)
|
||||
|
||||
const None = ""
|
||||
|
||||
type Forecast struct {
|
||||
Identifier string `json:"identifier,omitempty"`
|
||||
Airport airports.Airport `json:"airport,omitempty"`
|
||||
PublishTime time.Time `json:"publish_time,omitempty"`
|
||||
Valid ValidPair `json:"valid,omitempty"`
|
||||
Visibility Visibility `json:"visibility,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user