country

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCountryNotFound = errors.New("country not found")
	ErrNoCountryRows   = errors.New("no country row")
)

Functions

func HasCountry added in v1.1.0

func HasCountry(value string) bool

Types

type Alpha3

type Alpha3 string
const (
	Andorra                              Alpha3 = "AND"
	UnitedArabEmirates                   Alpha3 = "ARE"
	Afghanistan                          Alpha3 = "AFG"
	AntiguaAndBarbuda                    Alpha3 = "ATG"
	Anguilla                             Alpha3 = "AIA"
	Albania                              Alpha3 = "ALB"
	Armenia                              Alpha3 = "ARM"
	Angola                               Alpha3 = "AGO"
	Argentina                            Alpha3 = "ARG"
	AmericanSamoa                        Alpha3 = "ASM"
	Austria                              Alpha3 = "AUT"
	Australia                            Alpha3 = "AUS"
	Aruba                                Alpha3 = "ABW"
	AlandIslands                         Alpha3 = "ALA"
	Azerbaijan                           Alpha3 = "AZE"
	BosniaAndHerzegovina                 Alpha3 = "BIH"
	Barbados                             Alpha3 = "BRB"
	Bangladesh                           Alpha3 = "BGD"
	Belgium                              Alpha3 = "BEL"
	BurkinaFaso                          Alpha3 = "BFA"
	Bulgaria                             Alpha3 = "BGR"
	Bahrain                              Alpha3 = "BHR"
	Burundi                              Alpha3 = "BDI"
	Benin                                Alpha3 = "BEN"
	SaintBarthelemy                      Alpha3 = "BLM"
	Bermuda                              Alpha3 = "BMU"
	Brunei                               Alpha3 = "BRN"
	Bolivia                              Alpha3 = "BOL"
	Brazil                               Alpha3 = "BRA"
	Bahamas                              Alpha3 = "BHS"
	Bhutan                               Alpha3 = "BTN"
	BouvetIsland                         Alpha3 = "BVT"
	Botswana                             Alpha3 = "BWA"
	Belarus                              Alpha3 = "BLR"
	Belize                               Alpha3 = "BLZ"
	Canada                               Alpha3 = "CAN"
	CocosIslands                         Alpha3 = "CCK"
	DemocraticRepublicOfTheCongo         Alpha3 = "COD"
	CentralAfricanRepublic               Alpha3 = "CAF"
	Congo                                Alpha3 = "COG"
	Switzerland                          Alpha3 = "CHE"
	CoteDIvoire                          Alpha3 = "CIV"
	CookIslands                          Alpha3 = "COK"
	Chile                                Alpha3 = "CHL"
	Cameroon                             Alpha3 = "CMR"
	China                                Alpha3 = "CHN"
	Colombia                             Alpha3 = "COL"
	CostaRica                            Alpha3 = "CRI"
	Cuba                                 Alpha3 = "CUB"
	CaboVerde                            Alpha3 = "CPV"
	Curacao                              Alpha3 = "CUW"
	ChristmasIsland                      Alpha3 = "CXR"
	Cyprus                               Alpha3 = "CYP"
	Czechia                              Alpha3 = "CZE"
	Germany                              Alpha3 = "DEU"
	Djibouti                             Alpha3 = "DJI"
	Denmark                              Alpha3 = "DNK"
	Dominica                             Alpha3 = "DMA"
	DominicanRepublic                    Alpha3 = "DOM"
	Algeria                              Alpha3 = "DZA"
	Ecuador                              Alpha3 = "ECU"
	Estonia                              Alpha3 = "EST"
	Egypt                                Alpha3 = "EGY"
	WesternSahara                        Alpha3 = "ESH"
	Eritrea                              Alpha3 = "ERI"
	Spain                                Alpha3 = "ESP"
	Ethiopia                             Alpha3 = "ETH"
	Finland                              Alpha3 = "FIN"
	Fiji                                 Alpha3 = "FJI"
	FalklandIslands                      Alpha3 = "FLK"
	Micronesia                           Alpha3 = "FSM"
	FaroeIslands                         Alpha3 = "FRO"
	France                               Alpha3 = "FRA"
	Gabon                                Alpha3 = "GAB"
	UnitedKingdom                        Alpha3 = "GBR"
	Grenada                              Alpha3 = "GRD"
	Georgia                              Alpha3 = "GEO"
	FrenchGuiana                         Alpha3 = "GUF"
	Guernsey                             Alpha3 = "GGY"
	Ghana                                Alpha3 = "GHA"
	Gibraltar                            Alpha3 = "GIB"
	Greenland                            Alpha3 = "GRL"
	Gambia                               Alpha3 = "GMB"
	Guinea                               Alpha3 = "GIN"
	Guadeloupe                           Alpha3 = "GLP"
	EquatorialGuinea                     Alpha3 = "GNQ"
	Greece                               Alpha3 = "GRC"
	SouthGeorgia                         Alpha3 = "SGS"
	Guatemala                            Alpha3 = "GTM"
	Guam                                 Alpha3 = "GUM"
	GuineaBissau                         Alpha3 = "GNB"
	Guyana                               Alpha3 = "GUY"
	HongKong                             Alpha3 = "HKG"
	HeardIsland                          Alpha3 = "HMD"
	Honduras                             Alpha3 = "HND"
	Croatia                              Alpha3 = "HRV"
	Haiti                                Alpha3 = "HTI"
	Hungary                              Alpha3 = "HUN"
	Indonesia                            Alpha3 = "IDN"
	Ireland                              Alpha3 = "IRL"
	Israel                               Alpha3 = "ISR"
	IsleOfMan                            Alpha3 = "IMN"
	India                                Alpha3 = "IND"
	BritishIndianOceanTerritory          Alpha3 = "IOT"
	Iraq                                 Alpha3 = "IRQ"
	Iran                                 Alpha3 = "IRN"
	Iceland                              Alpha3 = "ISL"
	Italy                                Alpha3 = "ITA"
	Jersey                               Alpha3 = "JEY"
	Jamaica                              Alpha3 = "JAM"
	Jordan                               Alpha3 = "JOR"
	Japan                                Alpha3 = "JPN"
	Kenya                                Alpha3 = "KEN"
	Kyrgyzstan                           Alpha3 = "KGZ"
	Cambodia                             Alpha3 = "KHM"
	Kiribati                             Alpha3 = "KIR"
	Comoros                              Alpha3 = "COM"
	SaintKittsAndNevis                   Alpha3 = "KNA"
	DemocraticPeoplesRepublicOfKorea     Alpha3 = "PRK"
	RepublicOfKorea                      Alpha3 = "KOR"
	Kuwait                               Alpha3 = "KWT"
	CaymanIslands                        Alpha3 = "CYM"
	Kazakhstan                           Alpha3 = "KAZ"
	LaoPeoplesDemocraticRepublic         Alpha3 = "LAO"
	Lebanon                              Alpha3 = "LBN"
	SaintLucia                           Alpha3 = "LCA"
	Liechtenstein                        Alpha3 = "LIE"
	SriLanka                             Alpha3 = "LKA"
	Liberia                              Alpha3 = "LBR"
	Lesotho                              Alpha3 = "LSO"
	Lithuania                            Alpha3 = "LTU"
	Luxembourg                           Alpha3 = "LUX"
	Latvia                               Alpha3 = "LVA"
	Libya                                Alpha3 = "LBY"
	Morocco                              Alpha3 = "MAR"
	Monaco                               Alpha3 = "MCO"
	RepublicOfMoldova                    Alpha3 = "MDA"
	Montenegro                           Alpha3 = "MNE"
	SaintMartinFrench                    Alpha3 = "MAF"
	Madagascar                           Alpha3 = "MDG"
	MarshallIslands                      Alpha3 = "MHL"
	TheFormerYugoslavRepublicOfMacedonia Alpha3 = "MKD"
	Mali                                 Alpha3 = "MLI"
	Myanmar                              Alpha3 = "MMR"
	Mongolia                             Alpha3 = "MNG"
	Macao                                Alpha3 = "MAC"
	NorthernMarianaIslands               Alpha3 = "MNP"
	Martinique                           Alpha3 = "MTQ"
	Mauritania                           Alpha3 = "MRT"
	Montserrat                           Alpha3 = "MSR"
	Malta                                Alpha3 = "MLT"
	Mauritius                            Alpha3 = "MUS"
	Maldives                             Alpha3 = "MDV"
	Malawi                               Alpha3 = "MWI"
	Mexico                               Alpha3 = "MEX"
	Malaysia                             Alpha3 = "MYS"
	Mozambique                           Alpha3 = "MOZ"
	Namibia                              Alpha3 = "NAM"
	NewCaledonia                         Alpha3 = "NCL"
	Niger                                Alpha3 = "NER"
	NorfolkIsland                        Alpha3 = "NFK"
	Nigeria                              Alpha3 = "NGA"
	Nicaragua                            Alpha3 = "NIC"
	Netherlands                          Alpha3 = "NLD"
	Norway                               Alpha3 = "NOR"
	Nepal                                Alpha3 = "NPL"
	Nauru                                Alpha3 = "NRU"
	Niue                                 Alpha3 = "NIU"
	NewZealand                           Alpha3 = "NZL"
	Oman                                 Alpha3 = "OMN"
	Panama                               Alpha3 = "PAN"
	Peru                                 Alpha3 = "PER"
	FrenchPolynesia                      Alpha3 = "PYF"
	PapuaNewGuinea                       Alpha3 = "PNG"
	Philippines                          Alpha3 = "PHL"
	Pakistan                             Alpha3 = "PAK"
	Poland                               Alpha3 = "POL"
	SaintPierreAndMiquelon               Alpha3 = "SPM"
	Pitcairn                             Alpha3 = "PCN"
	PuertoRico                           Alpha3 = "PRI"
	StateOfPalestine                     Alpha3 = "PSE"
	Portugal                             Alpha3 = "PRT"
	Palau                                Alpha3 = "PLW"
	Paraguay                             Alpha3 = "PRY"
	Qatar                                Alpha3 = "QAT"
	Reunion                              Alpha3 = "REU"
	Romania                              Alpha3 = "ROU"
	Serbia                               Alpha3 = "SRB"
	RussianFederation                    Alpha3 = "RUS"
	Rwanda                               Alpha3 = "RWA"
	SaudiArabia                          Alpha3 = "SAU"
	SolomonIslands                       Alpha3 = "SLB"
	Seychelles                           Alpha3 = "SYC"
	Sudan                                Alpha3 = "SDN"
	Sweden                               Alpha3 = "SWE"
	Singapore                            Alpha3 = "SGP"
	SaintHelena                          Alpha3 = "SHN"
	Slovenia                             Alpha3 = "SVN"
	SvalbardAndJanMayenIslands           Alpha3 = "SJM"
	Slovakia                             Alpha3 = "SVK"
	SierraLeone                          Alpha3 = "SLE"
	SanMarino                            Alpha3 = "SMR"
	Senegal                              Alpha3 = "SEN"
	Somalia                              Alpha3 = "SOM"
	Suriname                             Alpha3 = "SUR"
	SouthSudan                           Alpha3 = "SSD"
	SaoTomeAndPrincipe                   Alpha3 = "STP"
	ElSalvador                           Alpha3 = "SLV"
	SintMaartenDutchPart                 Alpha3 = "SXM"
	SyrianArabRepublic                   Alpha3 = "SYR"
	Swaziland                            Alpha3 = "SWZ"
	TurksAndCaicosIslands                Alpha3 = "TCA"
	Chad                                 Alpha3 = "TCD"
	FrenchSouthernTerritories            Alpha3 = "ATF"
	Togo                                 Alpha3 = "TGO"
	Thailand                             Alpha3 = "THA"
	Tajikistan                           Alpha3 = "TJK"
	Tokelau                              Alpha3 = "TKL"
	TimorLeste                           Alpha3 = "TLS"
	Turkmenistan                         Alpha3 = "TKM"
	Tunisia                              Alpha3 = "TUN"
	Tonga                                Alpha3 = "TON"
	Turkey                               Alpha3 = "TUR"
	TrinidadAndTobago                    Alpha3 = "TTO"
	Tuvalu                               Alpha3 = "TUV"
	Taiwan                               Alpha3 = "TWN"
	UnitedRepublicOfTanzania             Alpha3 = "TZA"
	Ukraine                              Alpha3 = "UKR"
	Uganda                               Alpha3 = "UGA"
	UnitedStatesMinorOutlyingIslands     Alpha3 = "UMI"
	UnitedStatesOfAmerica                Alpha3 = "USA"
	Uruguay                              Alpha3 = "URY"
	Uzbekistan                           Alpha3 = "UZB"
	HolySee                              Alpha3 = "VAT"
	SaintVincentAndTheGrenadines         Alpha3 = "VCT"
	Venezuela                            Alpha3 = "VEN"
	BritishVirginIslands                 Alpha3 = "VGB"
	UnitedStatesVirginIslands            Alpha3 = "VIR"
	VietNam                              Alpha3 = "VNM"
	Vanuatu                              Alpha3 = "VUT"
	WallisAndFutunaIslands               Alpha3 = "WLF"
	Samoa                                Alpha3 = "WSM"
	Yemen                                Alpha3 = "YEM"
	Mayotte                              Alpha3 = "MYT"
	SouthAfrica                          Alpha3 = "ZAF"
	Zambia                               Alpha3 = "ZMB"
	Zimbabwe                             Alpha3 = "ZWE"
)

func (Alpha3) Country

func (alpha3 Alpha3) Country() Country

func (Alpha3) String

func (alpha3 Alpha3) String() string

type Alpha3Map added in v1.1.0

type Alpha3Map map[Alpha3]string

type Countries

type Countries []Country

func List

func List() (Countries, error)

func ListByContinent

func ListByContinent(query continent.Code) (Countries, error)

func ListByRegion

func ListByRegion(query region.Code) (Countries, error)

func ListBySubRegion

func ListBySubRegion(query subregion.Code) (Countries, error)

type Country

type Country struct {
	OfficialNameAR                string         `json:"official_name_ar"`                        // Country or Area official Arabic short name from UN Statistics Divsion
	OfficialNameCN                string         `json:"official_name_cn"`                        // Country or Area official Chinese short name from UN Statistics Divsion
	OfficialNameEN                string         `json:"official_name_en"`                        // Country or Area official English short name from UN Statistics Divsion
	OfficialNameES                string         `json:"official_name_es"`                        // Country or Area official Spanish short name from UN Statistics Divsion
	OfficialNameFR                string         `json:"official_name_fr"`                        // Country or Area official French short name from UN Statistics Divsion
	OfficialNameRU                string         `json:"official_name_ru"`                        // Country or Area official Russian short name from UN Statistics Divsion
	ISO31661Alpha2                string         `json:"ISO3166-1-Alpha-2"`                       // Alpha-2 codes from ISO 3166-1
	ISO31661Alpha3                string         `json:"ISO3166-1-Alpha-3"`                       // Alpha-3 codes from ISO 3166-1 (synonymous with World Bank Codes)
	ISO31661Numeric               string         `json:"ISO3166-1-numeric"`                       // Numeric codes from ISO 3166-1
	ISO4217CurrencyAlphabeticCode string         `json:"ISO4217-currency_alphabetic_code"`        // ISO 4217 currency alphabetic code
	ISO4217CurrencyCountryName    string         `json:"ISO4217-currency_country_name"`           // ISO 4217 country name
	ISO4217CurrencyMinorUnit      string         `json:"ISO4217-currency_minor_unit"`             // ISO 4217 currency number of minor units
	ISO4217CurrencyName           string         `json:"ISO4217-currency_name"`                   // ISO 4217 currency name
	ISO4217CurrencyNumericCode    string         `json:"ISO4217-currency_numeric_code"`           // ISO 4217 currency numeric code
	M49                           float64        `json:"M49"`                                     // UN Statistics M49 numeric codes (nearly synonymous with ISO 3166-1 numeric codes, which are based on UN M49. ISO 3166-1 does not include Channel Islands or Sark, for example)
	UNTERMArabicFormal            string         `json:"UNTERM Arabic Formal"`                    // Country's formal Arabic name from UN Protocol and Liaison Service
	UNTERMArabicShort             string         `json:"UNTERM Arabic Short"`                     // Country's short Arabic name from UN Protocol and Liaison Service
	UNTERMChineseFormal           string         `json:"UNTERM Chinese Formal"`                   // Country's formal Chinese name from UN Protocol and Liaison Service
	UNTERMChineseShort            string         `json:"UNTERM Chinese Short"`                    // Country's short Chinese name from UN Protocol and Liaison Service
	UNTERMEnglishFormal           string         `json:"UNTERM English Formal"`                   // Country's formal English name from UN Protocol and Liaison Service
	UNTERMEnglishShort            string         `json:"UNTERM English Short"`                    // Country's short English name from UN Protocol and Liaison Service
	UNTERMFrenchFormal            string         `json:"UNTERM French Formal"`                    // Country's formal French name from UN Protocol and Liaison Service
	UNTERMFrenchShort             string         `json:"UNTERM French Short"`                     // Country's short French name from UN Protocol and Liaison Service
	UNTERMRussianFormal           string         `json:"UNTERM Russian Formal"`                   // Country's formal Russian name from UN Protocol and Liaison Service
	UNTERMRussianShort            string         `json:"UNTERM Russian Short"`                    // Country's short Russian name from UN Protocol and Liaison Service
	UNTERMSpanishFormal           string         `json:"UNTERM Spanish Formal"`                   // Country's formal Spanish name from UN Protocol and Liaison Service
	UNTERMSpanishShort            string         `json:"UNTERM Spanish Short"`                    // Country's short Spanish name from UN Protocol and Liaison Service
	CLDRDisplayName               string         `json:"CLDR display name"`                       // Country's customary English short name (CLDR)
	Capital                       string         `json:"Capital"`                                 // Capital city from Geonames
	Continent                     continent.Code `json:"Continent"`                               // Continent from Geonames
	DS                            string         `json:"DS"`                                      // Distinguishing signs of vehicles in international traffic
	DevelopedDevelopingCountries  string         `json:"Developed / Developing Countries"`        // Country classification from United Nations Statistics Division
	Dial                          string         `json:"Dial"`                                    // Country code from ITU-T recommendation E.164, sometimes followed by area code
	EDGAR                         string         `json:"EDGAR"`                                   // EDGAR country code from SEC
	FIFA                          string         `json:"FIFA"`                                    // Codes assigned by the Fédération Internationale de Football Association
	FIPS                          string         `json:"FIPS"`                                    // Codes from the U.S. standard FIPS PUB 10-4
	GAUL                          string         `json:"GAUL"`                                    // Global Administrative Unit Layers from the Food and Agriculture Organization
	GeonameID                     float64        `json:"Geoname ID"`                              // Geoname ID
	GlobalCode                    string         `json:"Global Code"`                             // Country classification from United Nations Statistics Division
	GlobalName                    string         `json:"Global Name"`                             // Country classification from United Nations Statistics Division
	IOC                           string         `json:"IOC"`                                     // Codes assigned by the International Olympics Committee
	ITU                           string         `json:"ITU"`                                     // Codes assigned by the International Telecommunications Union
	IntermediateRegionCode        string         `json:"Intermediate Region Code"`                // Country classification from United Nations Statistics Division
	IntermediateRegionName        string         `json:"Intermediate Region Name"`                // Country classification from United Nations Statistics Division
	LandLockedDevelopingCountries string         `json:"Land Locked Developing Countries (LLDC)"` // Country classification from United Nations Statistics Division
	Languages                     string         `json:"Languages"`                               // Languages from Geonames
	LeastDevelopedCountries       string         `json:"Least Developed Countries (LDC)"`         // Country classification from United Nations Statistics Division
	MARC                          string         `json:"MARC"`                                    // Machine-Readable Cataloging codes from the Library of Congress
	RegionCode                    region.Code    `json:"Region Code"`                             // Country classification from United Nations Statistics Division
	RegionName                    string         `json:"Region Name"`                             // Country classification from United Nations Statistics Division
	SmallIslandDevelopingStates   string         `json:"Small Island Developing States (SIDS)"`   // Country classification from United Nations Statistics Division
	SubRegionCode                 subregion.Code `json:"Sub-region Code"`                         // Country classification from United Nations Statistics Division
	SubRegionName                 string         `json:"Sub-region Name"`                         // Country classification from United Nations Statistics Division
	TLD                           string         `json:"TLD"`                                     // Top level domain from Geonames
	WMO                           string         `json:"WMO"`                                     // Country abbreviations by the World Meteorological Organization
	IsIndependent                 string         `json:"is_independent"`                          // Country status, based on the CIA World Factbook
}

func Find

func Find(query string) (*Country, error)

func (Country) LanguagesList

func (c Country) LanguagesList() language.Languages

func (Country) MainLanguage

func (c Country) MainLanguage() language.Language

Jump to

Keyboard shortcuts

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