Documentation
¶
Index ¶
Constants ¶
const ( UndefinedCountryCodeISO2 = gogeo.UndefinedCountryCodeISO2 UndefinedCountryCodeISO3 = gogeo.UndefinedCountryCodeISO3 UndefinedRegionISO3166 = gogeo.UndefinedRegionISO3166 )
Variables ¶
var ( UndefinedCountryCode2 = gogeo.UndefinedCountryCode2 UndefinedRegionCode = gogeo.UndefinedRegionCode ErrCode2InvalidScanType = gogeo.ErrCode2InvalidScanType ErrCode2InvalidValueSize = gogeo.ErrCode2InvalidValueSize ErrRegionCodeInvalidScanType = gogeo.ErrRegionCodeInvalidScanType // Continents is the static continent catalog (IDs 1..7). Continents = gogeo.Continents // Countries is the static country catalog. Index equals Country.ID. Countries = gogeo.Countries // Regions is the static ISO 3166-2 catalog. Index equals Region.ID. Regions = gogeo.Regions )
Functions ¶
func CountryCodes2IDs ¶
func CountryCodes2IDs(codes []string) gosql.NullableOrderedNumberArray[uint64]
CountryCodes2IDs convert country codes to country IDs. Continent codes EU, AS, AF, OC, SA, NA, AN expand to all countries on that continent.
func RegionCodes2IDs ¶
func RegionCodes2IDs(codes []string) gosql.NullableOrderedNumberArray[uint64]
RegionCodes2IDs convert ISO 3166-2 region codes to region IDs. Unrecognised codes resolve to ID 0 (undefined).
Types ¶
type Continent ¶
Type aliases keep gogeo methods and stay assignable to udetect.Geo fields.
func ContinentByCode2 ¶
ContinentByCode2 returns a continent by 2-letter code, or nil.
type Coordinates ¶
type Coordinates = gogeo.Coordinates
Type aliases keep gogeo methods and stay assignable to udetect.Geo fields.
type Country ¶
Type aliases keep gogeo methods and stay assignable to udetect.Geo fields.
func CountriesByContinent ¶
CountriesByContinent returns countries whose continent code matches. Unknown or empty continent codes yield nil.
func CountryByCode ¶
CountryByCode returns the country for an ISO-2 or ISO-3 code.
func CountryByCode2 ¶
CountryByCode2 returns the country for an ISO-2 code. Unknown codes resolve to the undefined country (never nil).
func CountryByCode2Bytes ¶
func CountryByCode2Bytes(code CountryCode2) *Country
CountryByCode2Bytes is the allocation-free ISO-2 lookup. Unknown codes resolve to the undefined country (never nil).
func CountryByCode3 ¶
CountryByCode3 returns the country for an ISO-3 code. Empty and unknown codes resolve to the undefined country (never nil).
func CountryByID ¶
CountryByID returns the country with the given ID, or the undefined country.
type CountryCode2 ¶
type CountryCode2 = gogeo.CountryCode2
Type aliases keep gogeo methods and stay assignable to udetect.Geo fields.
func CountryCode2ByString ¶
func CountryCode2ByString(code string) CountryCode2
CountryCode2ByString returns a Code2 from an ISO-2 or ISO-3 string.
type Region ¶
Type aliases keep gogeo methods and stay assignable to udetect.Geo fields.
func RegionByCode ¶
RegionByCode returns the region for an ISO 3166-2 code (for example "US-CA"). "GB-*" and "UK-*" resolve to the same United Kingdom subdivisions. Unknown codes resolve to the undefined region (never nil).
func RegionByID ¶
RegionByID returns the region with the given ID, or the undefined region.
func RegionByLatLng ¶
RegionByLatLng returns the nearest region with coordinates, or undefined.
type RegionCode ¶
type RegionCode = gogeo.RegionCode
Type aliases keep gogeo methods and stay assignable to udetect.Geo fields.
func RegionCodeByPartial ¶
func RegionCodeByPartial(code string, country CountryCode2) RegionCode
RegionCodeByPartial accepts a full ISO 3166-2 code ("SK-BA") or a subdivision suffix ("BA") when the parent country is known. Empty and unknown values return UndefinedRegionCode.
func RegionCodeByString ¶
func RegionCodeByString(code string) RegionCode
RegionCodeByString parses an ISO 3166-2 code. Unknown values become undefined.