location

package
v1.117.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: AGPL-3.0 Imports: 4 Imported by: 2

Documentation

Overview

Package location contains geolocation related constants and variables.

Index

Constants

View Source
const (
	None                                   = CountryCode(0)
	Afghanistan                            = CountryCode(6)
	AlandIslands                           = CountryCode(24)
	Albania                                = CountryCode(12)
	Algeria                                = CountryCode(104)
	AmericanSamoa                          = CountryCode(19)
	Andorra                                = CountryCode(4)
	Angola                                 = CountryCode(15)
	Anguilla                               = CountryCode(9)
	Antarctica                             = CountryCode(17)
	AntiguaandBarbuda                      = CountryCode(7)
	Argentina                              = CountryCode(18)
	Armenia                                = CountryCode(13)
	Aruba                                  = CountryCode(23)
	Australia                              = CountryCode(21)
	Austria                                = CountryCode(20)
	Azerbaijan                             = CountryCode(26)
	Bahamas                                = CountryCode(45)
	Bahrain                                = CountryCode(34)
	Bangladesh                             = CountryCode(30)
	Barbados                               = CountryCode(28)
	Belarus                                = CountryCode(51)
	Belgium                                = CountryCode(31)
	Belize                                 = CountryCode(52)
	Benin                                  = CountryCode(36)
	Bermuda                                = CountryCode(39)
	Bhutan                                 = CountryCode(46)
	Bolivia                                = CountryCode(41)
	BonaireSaintEustatiusandSaba           = CountryCode(43)
	BosniaandHerzegovina                   = CountryCode(27)
	Botswana                               = CountryCode(49)
	BouvetIsland                           = CountryCode(48)
	Brazil                                 = CountryCode(44)
	BritishIndianOceanTerritory            = CountryCode(223)
	BritishVirginIslands                   = CountryCode(553)
	Brunei                                 = CountryCode(40)
	Bulgaria                               = CountryCode(33)
	BurkinaFaso                            = CountryCode(32)
	Burundi                                = CountryCode(35)
	CaboVerde                              = CountryCode(74)
	Cambodia                               = CountryCode(268)
	Cameroon                               = CountryCode(65)
	Canada                                 = CountryCode(53)
	CaymanIslands                          = CountryCode(285)
	CentralAfricanRepublic                 = CountryCode(58)
	Chad                                   = CountryCode(498)
	Chile                                  = CountryCode(64)
	China                                  = CountryCode(66)
	ChristmasIsland                        = CountryCode(76)
	CocosIslands                           = CountryCode(55)
	Colombia                               = CountryCode(67)
	Comoros                                = CountryCode(273)
	CookIslands                            = CountryCode(63)
	CostaRica                              = CountryCode(70)
	Croatia                                = CountryCode(200)
	Cuba                                   = CountryCode(73)
	Curacao                                = CountryCode(75)
	Cyprus                                 = CountryCode(77)
	Czechia                                = CountryCode(78)
	DemocraticRepublicoftheCongo           = CountryCode(56)
	Denmark                                = CountryCode(89)
	Djibouti                               = CountryCode(88)
	Dominica                               = CountryCode(91)
	DominicanRepublic                      = CountryCode(93)
	Ecuador                                = CountryCode(107)
	Egypt                                  = CountryCode(111)
	ElSalvador                             = CountryCode(490)
	EquatorialGuinea                       = CountryCode(173)
	Eritrea                                = CountryCode(122)
	Estonia                                = CountryCode(109)
	Eswatini                               = CountryCode(494)
	Ethiopia                               = CountryCode(124)
	FalklandIslands                        = CountryCode(141)
	FaroeIslands                           = CountryCode(145)
	Fiji                                   = CountryCode(140)
	Finland                                = CountryCode(139)
	France                                 = CountryCode(148)
	FrenchGuiana                           = CountryCode(162)
	FrenchPolynesia                        = CountryCode(396)
	FrenchSouthernTerritories              = CountryCode(500)
	Gabon                                  = CountryCode(157)
	Gambia                                 = CountryCode(169)
	Georgia                                = CountryCode(161)
	Germany                                = CountryCode(83)
	Ghana                                  = CountryCode(164)
	Gibraltar                              = CountryCode(165)
	Greece                                 = CountryCode(174)
	Greenland                              = CountryCode(168)
	Grenada                                = CountryCode(160)
	Guadeloupe                             = CountryCode(172)
	Guam                                   = CountryCode(177)
	Guatemala                              = CountryCode(176)
	Guernsey                               = CountryCode(163)
	Guinea                                 = CountryCode(170)
	GuineaBissau                           = CountryCode(179)
	Guyana                                 = CountryCode(181)
	Haiti                                  = CountryCode(202)
	HeardIslandandMcDonaldIslands          = CountryCode(195)
	Honduras                               = CountryCode(196)
	HongKong                               = CountryCode(193)
	Hungary                                = CountryCode(203)
	Iceland                                = CountryCode(227)
	India                                  = CountryCode(222)
	Indonesia                              = CountryCode(212)
	Iran                                   = CountryCode(226)
	Iraq                                   = CountryCode(225)
	Ireland                                = CountryCode(213)
	IsleofMan                              = CountryCode(221)
	Israel                                 = CountryCode(220)
	Italy                                  = CountryCode(228)
	IvoryCoast                             = CountryCode(61)
	Jamaica                                = CountryCode(247)
	Japan                                  = CountryCode(250)
	Jersey                                 = CountryCode(239)
	Jordan                                 = CountryCode(249)
	Kazakhstan                             = CountryCode(286)
	Kenya                                  = CountryCode(265)
	Kiribati                               = CountryCode(269)
	Kosovo                                 = CountryCode(609)
	Kuwait                                 = CountryCode(283)
	Kyrgyzstan                             = CountryCode(267)
	Laos                                   = CountryCode(287)
	Latvia                                 = CountryCode(308)
	Lebanon                                = CountryCode(288)
	Lesotho                                = CountryCode(305)
	Liberia                                = CountryCode(304)
	Libya                                  = CountryCode(311)
	Liechtenstein                          = CountryCode(295)
	Lithuania                              = CountryCode(306)
	Luxembourg                             = CountryCode(307)
	Macao                                  = CountryCode(327)
	Madagascar                             = CountryCode(319)
	Malawi                                 = CountryCode(335)
	Malaysia                               = CountryCode(337)
	Maldives                               = CountryCode(334)
	Mali                                   = CountryCode(324)
	Malta                                  = CountryCode(332)
	MarshallIslands                        = CountryCode(320)
	Martinique                             = CountryCode(329)
	Mauritania                             = CountryCode(330)
	Mauritius                              = CountryCode(333)
	Mayotte                                = CountryCode(644)
	Mexico                                 = CountryCode(336)
	Micronesia                             = CountryCode(143)
	Moldova                                = CountryCode(316)
	Monaco                                 = CountryCode(315)
	Mongolia                               = CountryCode(326)
	Montenegro                             = CountryCode(317)
	Montserrat                             = CountryCode(331)
	Morocco                                = CountryCode(313)
	Mozambique                             = CountryCode(338)
	Myanmar                                = CountryCode(325)
	Namibia                                = CountryCode(339)
	Nauru                                  = CountryCode(356)
	Nepal                                  = CountryCode(354)
	NetherlandsAntilles                    = CountryCode(14)
	NewCaledonia                           = CountryCode(341)
	NewZealand                             = CountryCode(364)
	Nicaragua                              = CountryCode(347)
	Niger                                  = CountryCode(343)
	Nigeria                                = CountryCode(345)
	Niue                                   = CountryCode(359)
	NorfolkIsland                          = CountryCode(344)
	NorthKorea                             = CountryCode(276)
	NorthMacedonia                         = CountryCode(323)
	NorthernMarianaIslands                 = CountryCode(328)
	Norway                                 = CountryCode(353)
	Oman                                   = CountryCode(377)
	Pakistan                               = CountryCode(401)
	Palau                                  = CountryCode(413)
	PalestinianTerritory                   = CountryCode(409)
	Panama                                 = CountryCode(391)
	PapuaNewGuinea                         = CountryCode(397)
	Paraguay                               = CountryCode(415)
	Peru                                   = CountryCode(395)
	Philippines                            = CountryCode(398)
	Pitcairn                               = CountryCode(404)
	Poland                                 = CountryCode(402)
	Portugal                               = CountryCode(410)
	PuertoRico                             = CountryCode(408)
	Qatar                                  = CountryCode(417)
	RepublicoftheCongo                     = CountryCode(59)
	Reunion                                = CountryCode(447)
	Romania                                = CountryCode(457)
	Russia                                 = CountryCode(463)
	Rwanda                                 = CountryCode(465)
	SaintBarthelemy                        = CountryCode(38)
	SaintHelena                            = CountryCode(476)
	SaintKittsandNevis                     = CountryCode(274)
	SaintLucia                             = CountryCode(289)
	SaintMartin                            = CountryCode(318)
	SaintPierreandMiquelon                 = CountryCode(403)
	SaintVincentandtheGrenadines           = CountryCode(549)
	Samoa                                  = CountryCode(591)
	SanMarino                              = CountryCode(481)
	SaoTomeandPrincipe                     = CountryCode(488)
	SaudiArabia                            = CountryCode(469)
	Senegal                                = CountryCode(482)
	Serbia                                 = CountryCode(461)
	SerbiaandMontenegro                    = CountryCode(71)
	Seychelles                             = CountryCode(471)
	SierraLeone                            = CountryCode(480)
	Singapore                              = CountryCode(475)
	SintMaarten                            = CountryCode(492)
	Slovakia                               = CountryCode(479)
	Slovenia                               = CountryCode(477)
	SolomonIslands                         = CountryCode(470)
	Somalia                                = CountryCode(483)
	SouthAfrica                            = CountryCode(651)
	SouthGeorgiaandtheSouthSandwichIslands = CountryCode(175)
	SouthKorea                             = CountryCode(278)
	SouthSudan                             = CountryCode(487)
	Spain                                  = CountryCode(123)
	SriLanka                               = CountryCode(297)
	Sudan                                  = CountryCode(472)
	Suriname                               = CountryCode(486)
	SvalbardandJanMayen                    = CountryCode(478)
	Sweden                                 = CountryCode(473)
	Switzerland                            = CountryCode(60)
	Syria                                  = CountryCode(493)
	Taiwan                                 = CountryCode(517)
	Tajikistan                             = CountryCode(504)
	Tanzania                               = CountryCode(520)
	Thailand                               = CountryCode(502)
	TheNetherlands                         = CountryCode(350)
	TimorLeste                             = CountryCode(506)
	Togo                                   = CountryCode(501)
	Tokelau                                = CountryCode(505)
	Tonga                                  = CountryCode(509)
	TrinidadandTobago                      = CountryCode(514)
	Tunisia                                = CountryCode(508)
	Turkey                                 = CountryCode(512)
	Turkmenistan                           = CountryCode(507)
	TurksandCaicosIslands                  = CountryCode(497)
	Tuvalu                                 = CountryCode(516)
	USVirginIslands                        = CountryCode(555)
	Uganda                                 = CountryCode(527)
	Ukraine                                = CountryCode(521)
	UnitedArabEmirates                     = CountryCode(5)
	UnitedKingdom                          = CountryCode(158)
	UnitedStates                           = CountryCode(539)
	UnitedStatesMinorOutlyingIslands       = CountryCode(533)
	Uruguay                                = CountryCode(545)
	Uzbekistan                             = CountryCode(546)
	Vanuatu                                = CountryCode(567)
	Vatican                                = CountryCode(547)
	Venezuela                              = CountryCode(551)
	Vietnam                                = CountryCode(560)
	WallisandFutuna                        = CountryCode(578)
	WesternSahara                          = CountryCode(112)
	Yemen                                  = CountryCode(629)
	Zambia                                 = CountryCode(663)
	Zimbabwe                               = CountryCode(673)
)

country codes to two letter upper case ISO country code as uint16.

Variables

View Source
var Continents = map[string][]CountryCode{
	"SA": ContinentSA[:],
	"AS": ContinentAS[:],
	"EU": ContinentEU[:],
	"AF": ContinentAF[:],
	"OC": ContinentOC[:],
	"NA": ContinentNA[:],
	"AN": ContinentAN[:],
}
View Source
var CountryISOCode = [...]string{}/* 252 elements not displayed */
View Source
var EeaCountries = EuCountries.With(
	Iceland,
	Liechtenstein,
	Norway,
)

EeaCountries defined the EEA countries.

EuCountries defines the 27 member country of European Union.

Functions

This section is empty.

Types

type CountryCode

type CountryCode uint16

CountryCode stores ISO code of countries.

It's encoded as a base-26. For example, code "QR" is encoded as `('Q'-'A')*('Z'-'A'+1) + ('R'-'A') + 1`. This encoding allows for smaller lookup tables for countries.

func ToCountryCode

func ToCountryCode(s string) CountryCode

ToCountryCode convert string to CountryCode. encoding is based on the ASCII representation of the country code.

func (CountryCode) Equal

func (c CountryCode) Equal(o CountryCode) bool

Equal compares two country code.

func (*CountryCode) Scan

func (c *CountryCode) Scan(value interface{}) error

Scan implements the sql.Scanner interface.

func (CountryCode) String

func (c CountryCode) String() string

String returns with the upper-case (two letter) ISO code of the country.

func (CountryCode) Value

func (c CountryCode) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Set

type Set [(countryCodeCount + bitsPerBucket - 1) / bitsPerBucket]uint32

Set implements a data-structure for fast lookups for country codes.

func NewFullSet

func NewFullSet() (r Set)

NewFullSet returns a set that has every bit filled.

func NewSet

func NewSet(countries ...CountryCode) (r Set)

NewSet returns a set that has the specific countries set.

func (*Set) Contains

func (set *Set) Contains(c CountryCode) bool

Contains checks whether c exists in the set.

func (*Set) Count

func (set *Set) Count() int

Count returns the number of items in the set.

func (*Set) Include

func (set *Set) Include(c CountryCode)

Include adds c to the set.

func (*Set) Remove

func (set *Set) Remove(c CountryCode)

Remove removes c from the set.

func (Set) With

func (set Set) With(countries ...CountryCode) Set

With implements a fluid interface for constructing a set.

func (Set) Without

func (set Set) Without(countries ...CountryCode) Set

Without implements a fluid interface for constructing a set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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