vrs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type Aircraft

type Aircraft struct {
	ICAO                 string `csv:"ICAO"`
	Registration         string `csv:"Registration"`
	ModelICAO            string `csv:"ModelICAO"`
	Manufacturer         string `csv:"Manufacturer"`
	Model                string `csv:"Model"`
	ManufacturerAndModel string `csv:"ManufacturerAndModel"`
	Operator             string `csv:"Operator"`
	AirlineCode          string `csv:"AirlineCode"`
	SerialNumber         string `csv:"SerialNumber"`
	YearBuilt            string `csv:"YearBuilt"` // set to string, as may be blank
	IsPrivateOperator    bool   `csv:"IsPrivateOperator"`
}

func (Aircraft) Key

func (a Aircraft) Key() string

type Airline

type Airline struct {
	Code                     string `csv:"Code"`
	Name                     string `csv:"Name"`
	ICAO                     string `csv:"ICAO"`
	IATA                     string `csv:"IATA"`
	PositioningFlightPattern string `csv:"PositioningFlightPattern"`
	CharterFlightPattern     string `csv:"CharterFlightPattern"`
}

func (Airline) Key

func (a Airline) Key() string

type Airport

type Airport struct {
	Code         string  `csv:"Code"`
	Name         string  `csv:"Name"`
	ICAO         string  `csv:"ICAO"`
	IATA         string  `csv:"IATA"`
	Location     string  `csv:"Location"`
	CountryISO2  string  `csv:"CountryISO2"`
	Latitude     float64 `csv:"Latitude"`
	Longitude    float64 `csv:"Longitude"`
	AltitudeFeet float64 `csv:"AltitudeFeet"`
}

func (Airport) Key

func (a Airport) Key() string

type AirportCodes

type AirportCodes struct {
	DepartureCode string
	ArrivalCode   string
}

func (*AirportCodes) UnmarshalCSV

func (a *AirportCodes) UnmarshalCSV(b []byte) error

type CacheMetric

type CacheMetric interface {
	Request()
	Hit()
}

type Country

type Country struct {
	Code string `csv:"ISO"`
	Name string `csv:"Name"`
}

func (Country) Key

func (c Country) Key() string

type ModelType

type ModelType struct {
	ICAO                string `csv:"ICAO"`
	Manufacturer        string `csv:"Manufacturer"`
	Model               string `csv:"Model"`
	EngineTypeCode      string `csv:"EngineTypeCode"`
	EnginePlacementCode string `csv:"EnginePlacementCode"`
	SpeciesCode         string `csv:"SpeciesCode"`
	WakeTurbulenceCode  string `csv:"WakeTurbulenceCode"`
	Engines             int    `csv:"Engines"`
	IsActive            bool   `csv:"IsActive"`
}

func (ModelType) Key

func (m ModelType) Key() string

type Repository

type Repository struct {
	Aircraft   Store[Aircraft]
	Airlines   Store[Airline]
	Airports   Store[Airport]
	Countries  Store[Country]
	ModelTypes Store[ModelType]
	Routes     Store[Route]
}

func NewRepository

func NewRepository(baseDir string, cacheMetrics map[RepositoryName]CacheMetric) *Repository

type RepositoryName

type RepositoryName string
const (
	RepositoryNameAircraft   RepositoryName = "aircraft"
	RepositoryNameAirlines   RepositoryName = "airlines"
	RepositoryNameAirports   RepositoryName = "airports"
	RepositoryNameCountries  RepositoryName = "countries"
	RepositoryNameModelTypes RepositoryName = "model_types"
	RepositoryNameRoutes     RepositoryName = "routes"
)

type Route

type Route struct {
	CallSign     string       `csv:"Callsign"`
	Code         string       `csv:"Code"`
	Number       string       `csv:"Number"`
	Airline      string       `csv:"AirlineCode"`
	AirportCodes AirportCodes `csv:"AirportCodes"`
}

func (Route) Key

func (r Route) Key() string

type Store

type Store[T any] interface {
	Get(string) (T, error)
}

Jump to

Keyboard shortcuts

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