iata

package
v0.0.0-...-8dfb9f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAirports = errors.New("no airports in country")

ErrNoAirports is returned if Lookup can find no airports.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages the IATA data.

func New

func New(ctx context.Context, u *url.URL) (*Client, error)

New creates a new Client from IATA data contained at the given URL. Any URL supported m-lab/go/content may be provided.

func (*Client) Find

func (c *Client) Find(iata string) (Row, error)

Find returns the row with metadata about the given iata code.

func (*Client) Load

func (c *Client) Load(ctx context.Context) error

Load downloads and parses the iata data from the provider source.

func (*Client) Lookup

func (c *Client) Lookup(country string, lat, lon float64) (string, error)

Lookup searches for the IATA code closest to the given lat/lon within the given country.

type Row

type Row struct {
	CountryCode string
	IATA        string
	Latitude    float64
	Longitude   float64
}

Row is a single row in the IATA dataset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL