registration

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package registration normalises aircraft registrations to the canonical notation of their state of registry, looked up in the nationality mark table in prefixes.go.

A registration is only rewritten when its nationality mark is recognised and the remainder matches the shape that state issues. Anything else is returned uppercased and trimmed, otherwise unchanged.

Design and maintenance: docs/AIRCRAFT_REGISTRATIONS.md.

Index

Constants

View Source
const LastReviewed = "2026-08-17"

LastReviewed is the date this table was last checked against upstream, reported via GET /admin/config.

Variables

This section is empty.

Functions

func Canonical

func Canonical(raw string) string

Canonical is Normalize for callers that only want the normalised string.

func Count

func Count() int

Count is how many nationality marks the table holds.

Types

type Entry

type Entry struct {
	// Prefix is the nationality mark itself, uppercase and without a
	// separator: "D", "N", "9XR", "RDPL".
	Prefix string
	// Country is the ISO 3166-1 alpha-2 code of the state of registry.
	Country string
	// CountryName is the English name of the state of registry.
	CountryName string
	// NoHyphen marks states that write the two marks without a separator.
	// The zero value is hyphenated.
	NoHyphen bool
	// Suffix constrains the registration mark; empty means defaultSuffix.
	Suffix string
	// contains filtered or unexported fields
}

Entry is one state's nationality mark.

func Entries

func Entries() []Entry

Entries returns a copy of the nationality mark table, longest mark first.

func Lookup

func Lookup(prefix string) (Entry, bool)

Lookup returns the table entry for a nationality mark.

func (Entry) Hyphenated

func (e Entry) Hyphenated() bool

Hyphenated reports whether this state's canonical notation separates the nationality mark from the registration mark with a hyphen.

type Result

type Result struct {
	// Value is the normalised registration: always uppercase and trimmed,
	// and rewritten into canonical notation when Matched is true.
	Value string
	// Entry is the matched nationality mark, zero when Matched is false.
	Entry Entry
	// Matched reports whether a nationality mark was recognised and the
	// registration mark had the shape that state issues.
	Matched bool
}

Result is the outcome of normalising one registration.

func Normalize

func Normalize(raw string) Result

Normalize rewrites a registration into the canonical notation of its state of registry, leaving unrecognised input uppercased and trimmed.

Jump to

Keyboard shortcuts

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